registration: Improve duplicate config setting exception
[lhc/web/wiklou.git] / maintenance / checkImages.php
index 9761927..f858f03 100644 (file)
@@ -31,21 +31,23 @@ class CheckImages extends Maintenance {
 
        public function __construct() {
                parent::__construct();
-               $this->mDescription = "Check images to see if they exist, are readable, etc";
+               $this->addDescription( 'Check images to see if they exist, are readable, etc' );
                $this->setBatchSize( 1000 );
        }
 
        public function execute() {
                $start = '';
-               $dbr = $this->getDB( DB_SLAVE );
+               $dbr = $this->getDB( DB_REPLICA );
 
                $numImages = 0;
                $numGood = 0;
 
                $repo = RepoGroup::singleton()->getLocalRepo();
+               $fileQuery = LocalFile::getQueryInfo();
                do {
-                       $res = $dbr->select( 'image', '*', array( 'img_name > ' . $dbr->addQuotes( $start ) ),
-                               __METHOD__, array( 'LIMIT' => $this->mBatchSize ) );
+                       $res = $dbr->select( $fileQuery['tables'], $fileQuery['fields'],
+                               [ 'img_name > ' . $dbr->addQuotes( $start ) ],
+                               __METHOD__, [ 'LIMIT' => $this->getBatchSize() ], $fileQuery['joins'] );
                        foreach ( $res as $row ) {
                                $numImages++;
                                $start = $row->img_name;
@@ -80,5 +82,5 @@ class CheckImages extends Maintenance {
        }
 }
 
-$maintClass = "CheckImages";
+$maintClass = CheckImages::class;
 require_once RUN_MAINTENANCE_IF_MAIN;