Extension:CommonsMediaCaching
From Biowikifarm Metawiki
TODO documentation
This extension reads all new thumbs (from commons.wikimedia.org/wiki/) in the wiki media
or image
folder an if they are new it downloads them to a local specified Wiki or repository Wiki (OpenMedia).
(1) Set up a cronjob
for runJobs.php
TODO documentation
For instance in a file like /etc/cron.d/wiki-run-jobs
you can specify how often the job should run the maintenance script runJobs.php
# RUN every 5 minutes mediawiki Jobs: Species-ID, Offene Naturfuehrer, etc
# NOTE: without &> /dev/null it will create mails to www-data!
3,8,13,18,23,28,33,38,43,48,53,58 * * * * www-data bash /usr/share/mediawiki26/extensions-rich-features/CommonsMediaCaching/runJobs.sh &> /dev/null
1,6,11,16,21,26,31,36,41,46,51,56 * * * * www-data bash /usr/share/mediawiki26/extensions-simple-features/CommonsMediaCaching/runJobs_simple-extensions.sh &> /dev/null
The script …
-
extensions-rich-features/…/runJobs.sh
contains all Wikis with extended extension set up - and
extensions-simple-features/…/runJobs_simple-extensions.sh
for those with a simple extension setup.
(2) Logrotate for runJobsOutput.log
Set up logrotate
, eg. with a configuration in /etc/logrotate.d/wiki-runJobs
/usr/share/mediawiki26/extensions-rich-features/CommonsMediaCaching/runJobsOutput.log {
missingok
compress
delaycompress
daily
size 1M
create 644 www-data www-data
rotate 10
}
/usr/share/mediawiki26/extensions-simple-features/CommonsMediaCaching/runJobsOutput.log {
missingok
compress
delaycompress
daily
size 1M
create 644 www-data www-data
rotate 10
}
Set up a template in the local (repository) Wiki
Template:Cached Commons Copy
is used on File pages to store the information of the original commons file. It can look like this:
<noinclude>A simplified version of [[Template:Cached Copy]] (see there), specific to Wikimedia commons. It also adds a new parameter: lastuploader
The parameters are simplified to only:
* '''file=''' (without the File: prefix)
* '''lastuploader''' =for the name of the last user uploading this file on commons (not sufficient for licensing and attribution purposes, this user may only have modified someone elses original work.
* '''time=''' (optional).
Example: <nowiki>{{Cached_Commons_Copy|file=x.jpg|lastuploader=xxuser|time=2011-08-23 : 20:12}}</nowiki> results in:
{{Cached_Commons_Copy|file=x.jpg|lastuploader=xxuser|time=2011-08-23 : 20:12}}
</noinclude><includeonly><table cellspacing="4" cellpadding="4" style="margin:1em 0; width:99%; font-size:100%; background-color:#FFFFEE; border-style:solid; border-color:#BB4020; border-width: 2px; clear: both; position:relative; text-align:left;" width="99%"><tr><td>This media item is originally from ''http://commons.wikimedia.org/wiki/File:{{{file|'''The source file is missing!'''}}}''{{#if:{{{lastuploader|}}}|, last uploaded by [http://commons.wikimedia.org/wiki/User:{{anchorencode:{{{lastuploader}}}}} {{{lastuploader}}}]}}; it was copied to a local repository as a caching mechanism to speed up page rendering and to prevent links to break when media items are renamed on commons. For a full list of earlier authors and contributors please refer to the ''[http://commons.wikimedia.org/wiki/File:{{{file|}}}#filehistory file version history]'' and the ''[http://commons.wikimedia.org/w/index.php?title=File:{{{file|}}}&action=history metadata version history]'' in the repository from which this media item has been copied.
'''Below you find the original information from the metadata page at the time of copying{{#if:{{{time|}}}| ({{{time}}})}}:'''
</td></tr></table><includeonly>{{#ifeq:{{NAMESPACE}}|{{ns:Category}}||[[Category:Cached Commons Images]]}}</includeonly>