Hi,
I'm currently exploring the file storage of MediaWiki which left me for several hours in pure amazement, when I realized, that *several wikis* can share the same files even *without* enabling $wgUseSharedUploads.
Now I'm trying to figure out if this is safe (most probably it isn't, why else would $wgUseSharedUploads have been invented?). Anyway I'd love to hear comments from people who have tried similiar stuff!
Starting point:
* Two wikis with apparently different topics (canids, photography), separate domains, separate codebase, separate image storage. At first I thought, the topics would be completely different, later I found myself and others increasingly often replicating images & descriptions between those two wikis (e.g. images of canids used at the photography wiki to display characteristics of several lenses, and vice versa). Thus I started to experiment with shared storage, firstly according to [1] ("Scenario 4: Multiple wikis sharing common resources"), later trying to avoid a separate image "pool".
Setup:
* Image storage: /var/mw_shared * MediaWiki sites: /var/www/site1, /var/www/site2 * LocalSettings.php: $wgUploadDirectory = "/var/mw_shared";
* Apache2 (for site1; site2 similar): ** Alias /wiki "/var/www/site1/w/index.php" ** Alias /index.php "/var/www/site1/w/index.php" ** Alias /w/images "/var/mw_shared"
Preliminary result:
* This extremly simple setup gives me (a) short URLs and (b) and a shared file storage for both sites. The Alias "/w/images" takes care that image locations point to a path outside the website's root, and $wgUploadDirectory from both wikis points to /var/mw_shared, images can be used in both wikis with the usual syntax [[image:file.ext]].
* At the moment this seems to work, and I haven't yet run into side effects. However, I'd like to know if this setup is safe and sane since it appears much too simple to be true.
I'm planning to have both wikis around long term. Even if this setup would continue to work, would it be preferable fall back to the separate image "pool" setup according to [1]?
Thanks & Greetings, -asb
How do image description pages work with this setup? If you upload an image on one wiki, the database for the other wiki won't know anything about it, so what does it show for the file history, etc?
Thomas Dalton wrote:
How do image description pages work with this setup? If you upload an image on one wiki, the database for the other wiki won't know anything about it, so what does it show for the file history, etc?
Yes, that's right. Since the default upload mechanism isn't altered, the behaviour is as expected: If I upload to site1, the image description appears at site1 (and not at site2), and vice versa.
To make the images available to both sites, I'm running ./maintenance/rebuildImages.php on a regular basis with a Cron job; that takes only a few seconds and causes neglectable server load (surely this wouldn't work anymore if we had several 100k images). And, of course this doesn't replicate the descriptions itself; we can do this since it's our own data that we share between the two wikis and we know the file's names, but obviously such an setup wouldn't be advisable on a site like Commons where correct licensing is crucial.
I think, however, if you used a Wikipedia dump and added the matching image files with a script, description pages would go bonkers in any case (our simple setup, or the "pool" setup). I haven't tried this yet, but I think the image descriptions from the XML dumps become useless as soon as you utilize some kind of shared data storage (correct me if I'm wrong). As always, it all depends on what you try to accomplish ;)
Greetings, -asb
To make the images available to both sites, I'm running ./maintenance/rebuildImages.php on a regular basis with a Cron job;
Ah, that's the key piece of the puzzle I was missing. Sounds like a pretty good system (for what you're doing, at least - probably wouldn't work very well in most setups).
You may run into issues with the databases though. When you upload an image you also add a database entry to the image database table. If you are sharing images with some odd method you should also share the database. That would involve hacking inclues/Database.php with a method I am very familiar with to tell it to use a different database when dealing with that table.
But it's not possible to make image information pages shared between the two wiki. So it would probably be best to use the commons method. That method uses an image fallback, and also uses image pages from that commons wiki when it's using the fallback images. It's also tested and used on the WikiMedia projects so it's reliably safe to use in comparison to a random method of sharing.
~Daniel Friesen(Dantman) of The Gaiapedia, Wikia Graphical Entertainment Project, and Wiki-Tools.com
Agon S. Buchholz wrote:
Hi,
I'm currently exploring the file storage of MediaWiki which left me for several hours in pure amazement, when I realized, that *several wikis* can share the same files even *without* enabling $wgUseSharedUploads.
Now I'm trying to figure out if this is safe (most probably it isn't, why else would $wgUseSharedUploads have been invented?). Anyway I'd love to hear comments from people who have tried similiar stuff!
Starting point:
- Two wikis with apparently different topics (canids, photography),
separate domains, separate codebase, separate image storage. At first I thought, the topics would be completely different, later I found myself and others increasingly often replicating images & descriptions between those two wikis (e.g. images of canids used at the photography wiki to display characteristics of several lenses, and vice versa). Thus I started to experiment with shared storage, firstly according to [1] ("Scenario 4: Multiple wikis sharing common resources"), later trying to avoid a separate image "pool".
Setup:
Image storage: /var/mw_shared
MediaWiki sites: /var/www/site1, /var/www/site2
LocalSettings.php: $wgUploadDirectory = "/var/mw_shared";
Apache2 (for site1; site2 similar):
** Alias /wiki "/var/www/site1/w/index.php" ** Alias /index.php "/var/www/site1/w/index.php" ** Alias /w/images "/var/mw_shared"
Preliminary result:
- This extremly simple setup gives me (a) short URLs and (b) and a
shared file storage for both sites. The Alias "/w/images" takes care that image locations point to a path outside the website's root, and $wgUploadDirectory from both wikis points to /var/mw_shared, images can be used in both wikis with the usual syntax [[image:file.ext]].
- At the moment this seems to work, and I haven't yet run into side
effects. However, I'd like to know if this setup is safe and sane since it appears much too simple to be true.
I'm planning to have both wikis around long term. Even if this setup would continue to work, would it be preferable fall back to the separate image "pool" setup according to [1]?
Thanks & Greetings, -asb
[1] http://www.mediawiki.org/wiki/Manual:Wiki_family
MediaWiki-l mailing list MediaWiki-l@lists.wikimedia.org http://lists.wikimedia.org/mailman/listinfo/mediawiki-l
mediawiki-l@lists.wikimedia.org