Since we shall be hosting multiple SilverStripe sites on 1 server, it makes sense to move all common SilverStripe files to a single location.
Has anybody done this? How did you do it?
This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.
Please use forum.silverstripe.org for any new questions
(announcement).
The forum archive will stick around, but will be read only.
You can also use our Slack channel
or StackOverflow to ask for help.
Check out our community overview for more options to contribute.
Since we shall be hosting multiple SilverStripe sites on 1 server, it makes sense to move all common SilverStripe files to a single location.
Has anybody done this? How did you do it?
I have done this by creating symlinks to all the folders that are needed. The only problem with this, is that each installation will need a separate temp folder, either by defining TEMP_FOLDER in a site specific _ss_environment.php file, or by creating a silverstripe-cache folder in each site root. This is because the manifest uses absolute paths, and the absolute path for all the sapphire, cms, jsparty and any linked module would be the same, thus causing conflicts.
You may also need to set Apache up to follow symlinks.
And by all means, update your File.php, Folder.php and GD.php to not use the relative path "/assets".. major problems when you SS install lives above the web root. :)
I host about 15 SS sites on one shared install in /var/ss... works great. All you need is a mysite and assets folder in each vhost.
Just found another thread about the same topic:
Re: multisites possible?
http://www.silverstripe.org/general-questions/show/251650#post251650
UncleCheese, you mentioned you have a script to automatically set-up a new SS site? Can you post the code?
How did you update File.php, Folder.php and GD.php? Did you use the site's physical path?
If I add a silverstripe-cache folder in the virtual host root, will it be automatically detected and used?
The problem with the symlinks solution is that it won't work on Windows. That's a real pain since we don't want extra steps after checking out code from subversion. I suppose we'll have to find a work-around for that.
Without symlinks it's going to be tricky to do what you're asking. It would be possible, but very difficult, and would require a pretty deep understanding of the core application.
Here's a brief sketch of how to do it:
Let's assume that your site live at c:\inetpub\wwwroot and the silverstripe common files are in c:\inetpub\sscommon
* The manifest builder is going to be amended to index the content of both c:\inetpub\wwwroot and c:\inetpub\sscommon
* Requests for assets that are downloaded directly from the silverstripe common archive are going to need to . This could be done with a rewrite rule that looked to see if the file exists in c:\inetpub\sscommon, and if so, serves that file instead.
* Your base rewriting rule, normally sends everything to sapphire/main.php, will need to be amended to instead send everything to a custom crafted index.php. This index.php will need to manipulate the $_SERVER variables and configure the manifest builder appropriately.
* Most significantly, you would need to review all of the code for direct file access - references to file_exists, fopen, file_get_contents, etc - and change them to be able to deal with the fact that some files are in one folder and some are in another.
To be frank, this isn't an approach that I recommend you take. A much easier approach would be to make a simple script that copied the silverstripe common files from one place into each of your sites.
Thanks for the reply Sam.
I see that a lot of work would be envolved in modifying SilverStripe. I think we'll go with your suggestion and make a script to copy the common files.