[Mediawiki-l] importImages.php thinks that files already exist

Agon S. Buchholz asb at kefk.net
Sat Jul 28 16:30:04 UTC 2007


Hi,

I'm trying to fix an old MediaWiki installation, where a few hundred
images are located at ./images; they are registered at Special:Files,
but the images itself are missing. The paths do not point to
./images/{image.ext}, but to something like ./images/1/15/{image.ext}. I
moved a few images manually to the reported locations, which seems to
work fine, but I'd like to avoid wasting several hours to create missing
subdirectories etc.

I assume, when the Wiki was started, $wgHashedUploadDirectory was set
initially to "false" and later changed to "true"; as I understand, there
is no maintenance script to fix this. So I tried to utilize
./maintenance/importImages.php which should do the trick, I thought.

However, the script is smarter than me and checks for the existence of
the files; of course, this check results in "...could not be imported; a
file with this name exists in the wiki". As far as I can see, there is
no switch to override this check. In the script's code, I found a
routine starting with "# Check existence", which I tried to comment out;
this resulted in breaking the script since I don't speak PHP.

If this is the right approach, could someone tell me, which lines I have
to comment out in importImages.php or maybe even provide a quick Patch?
If, however, this is complicated, don't bother, then I'll waste a few
hours for manual fixing this.

Thanks & regards, -asb




More information about the MediaWiki-l mailing list