Mediawiki image update with overwrite

From Biowikifarm Metawiki
Jump to: navigation, search

In some situations (e.g. our collection of Images by G. Nitter) updates include both new images, new images overwriting old images, and old images replacing other old images (because the order is encoded in the file name). The following describes how to possible handle that, short of removing all old images and reimporting all.

Unfortunately, a command of the structure

sudo -u www-data php ./maintenance/importImages.php  --conf ./LocalSettings.php --overwrite --comment="xxx"

although it does overwrite the existing images with new ones, and correctly reporting them in the version history, does NOT import any images that are already present in the repository ("duplicates"). This is unfortunate, because in this case the duplicates only exist in older version, and, at least after the full import, nowhere in the current version.

When trying to simply repeat the import, it does not seem to work. Perhaps the error of type: "A file identical to this file (File:Adonis flammea 3 (G. Nitter).jpg) has previously been deleted. You should check that file's deletion history before proceeding to re-upload it." cannot be ignored using "overwrite"? Is almost acts as if the "--skip-dupes" option is on by default and cannot be turned off.

The only known solution is to create an additional batch deletion file and run:

cd /var/www/v-species/o; php ./maintenance/deleteBatch.php  --conf ./LocalSettings.php -r "preparing for reupload" ./a_batchdelete_Nitter.txt

Current method: COPY files which are old, but are maintained under a new name, into a separate folder (server-delete). Put files from new, including old renamed ones, into "server-upload".

Delete files to be deleted, either batch or manually. For batch:

cd server-delete
chcp  1252
dir/w > 000.txt

To add "File:" in front of each entry from the dir command, replace \n with \nFile:

Copy text to a_batchdelete_xxx.txt (or similar) and execute the prepared batch (or similar), e.g.

cd /var/www/v-species/o && sudo ./

Do a webserver reload (not sure why, but seems necessary) and normally import the new files, e.g.

sudo /usr/sbin/apache2ctl -k graceful && sudo service nginx restart && sudo service php5-fpm restart
cd /var/www/v-species/o && sudo ./