Manual:checkImages.php
| MediaWiki file: checkImages.php | |
|---|---|
| Location: | maintenance/ |
| Source code: | master • 1.45.1 • 1.44.3 • 1.43.6 |
| Classes: | CheckImages |
Details
[edit]checkImages.php file is a maintenance script to check images to see if they exist, are readable, etc.
Technical details
[edit]These notes based on an examination of checkImages.php from MediaWiki version 1.19.
When executed, the main loop iterates through the wiki database's image table, fetching 1000 rows at a time by default, until all rows are obtained.
Each row specifies an image name, image size, and location of the associated image data.
If the location is filename on a local path, the filename is tested with stat().
| unable to open file | "$IMG missing" |
| file is directory | "$IMG is a directory" |
| image size non-zero and file has zero length | "$IMG truncated ..." |
| image size and file length not equal | "$IMG size mismatch" |
This test does not attempt to read any data from the image files, so it will not detect unreadable blocks in the local file system.
Options/Arguments
[edit]This script does not take any arguments.
Usage
[edit]php maintenance/run.php checkImages
$ php maintenance/run.php checkImages Good images: 27/27
php maintenance/scriptName.php instead of php maintenance/run.php scriptName.How to report file paths
[edit]If you need not just file names, but paths, then replace three occurrences of
{$row->img_name}
(namely, “missing”, “truncated…”, and “size mismatch…”) with
{$path}
in the PHP source code.