22849 Posts in 9674 Topics by 2803 members
General questions about getting started with SilverStripe that don't fit in any of the categories above.
|Go to End|
6 March 2009 at 11:21pm
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?
7 March 2009 at 7:49am
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.
7 March 2009 at 11:08am
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.
8 March 2009 at 12:55am
Just found another thread about the same topic:
Re: multisites possible?
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?
8 March 2009 at 1:30am
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.
10 March 2009 at 10:22am
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.
12 March 2009 at 8:31am
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.
|Go to Top|