Last modified: 2014-03-05 21:01:34 UTC
The maintenance script checkImages.php currently only reports, that files would be missing: test.pdf: missing This output is repeated for every file; the statistic at the end finally says: However, this is wrong: The problem is that in checkImages.php around line 57 stat is called with a wrong parameter. This is the code, comments by me: $path = $file->getPath(); # $path is set to an internal path identifier, e.g. mwstore://local-backend/local-public/8/85/test.pdf if ( !$path ) { # does not happen as path is set $this->output( "{$row->img_name}: not locally accessible\n" ); continue; } $stat = stat( $file->getPath() ); # stat returns FALSE meaning: error. Reason is that it did not get an actual file path, but this internal identifier: stat(mwstore://local-backend/local-public/8/85/test.pdf); if ( !$stat ) { $this->output( "{$row->img_name}: missing\n" ); stat() however SHOULD be called with the real path to the file. That should fix the problem...
I have checked the methods of includes/filerepo/file/File.php. Changing the line $stat = stat( $file->getPath() ); to $stat = stat( $file->getLocalRefPath() ); Makes the script provide the correct results again.
Thanks for taking the time to report this and your analysis! In case you would like to turn the fix into a patch, you are welcome to use Developer access at https://www.mediawiki.org/wiki/Developer_access to submit this as a Git branch directly into Gerrit: https://www.mediawiki.org/wiki/Git/Tutorial If you don't want to set up Git/Gerrit, you can also use https://tools.wmflabs.org/gerrit-patch-uploader/
Change 117027 had a related patch set uploaded by AalekhN: Correct parameter passed checkImages.php https://gerrit.wikimedia.org/r/117027
Thanks for putting the patch into Gerrit! It looks good.