Emanuele D'Arrigo wrote:
If you remove these lines from importImages.php
if( !$image->exists() ) {
(....code, code code...)
} else { echo( "{$base} could not be imported; a file with this name exists in the wiki\n" ); }
Argh, I commented out *one* line too much (the one below the comment "# Check existence"). And yes, It's working perfectly - after a few seconds, all images were imported and I could delete them from ./images. All file descriptions remained untouched, only the the file dates have changed.
I'm not quite sure if this has drawbacks though.
At least I can't see any so far. I assume, the check is mostly there to prevent idiots like me to overwrite stuff unintentionally. This makes absolute sense, considered the power of large bulk operations this script might undertake. However, there's a warnung note on [2], but the mentioned problems didn't appear on my site.
@Rob: Thanks for your offer to provide a patch, but Emanueles instructions already did the trick for me.
However, if your addition gets into the next release of MW, wouldn't it be helpful to update [1] and [2]? I'd offer to invest the time you saved me to freshen up the manual a bit ;)
[2] reads: "Note: This parameter can not be changed after the first image or file has been uploaded (or you need to move all previous uploaded pictures). It will result in php-errors (see the discussion page) if articles with the old logic try to find their pictures, since the image path is calculated an not stored in the database."
As mentioned above, this didn't happen at my site. Maybe this error is specific to XAMPP installations (I'm using Debian GNU/Linux).
If there are no objections, I'd update [1] and [2] with this workaround for switching $wgHashedUploadDirectory from "false" to "true".
Thank you very much, and thanks for providing the great utility toolkit in ./maintenance (stuff like this I'm missing most painfully in Drupal ;)
Greetings, -asb
[1] http://www.mediawiki.org/wiki/Manual:Image_Administration [2] http://www.mediawiki.org/wiki/Manual:%24wgHashedUploadDirectory
PS: Ceterum censeo MediaWikinem esse amandam ;-)