X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FrecountCategories.php;h=8ec648ff39d6bc60c7c7ff468d44af3ea15876ed;hb=6b89d180d9199b5703049eb9b5cc10a51e3e3045;hp=b4d75c7a1a78df387f3ef8f6883c3e07b59cbb10;hpb=be0d9f587138a79e8f18bc7b26dd297d708b72c4;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/recountCategories.php b/maintenance/recountCategories.php index b4d75c7a1a..8ec648ff39 100644 --- a/maintenance/recountCategories.php +++ b/maintenance/recountCategories.php @@ -36,6 +36,12 @@ use MediaWiki\MediaWikiServices; * @ingroup Maintenance */ class RecountCategories extends Maintenance { + /** @var string */ + private $mode; + + /** @var int */ + private $minimumId; + public function __construct() { parent::__construct(); $this->addDescription( <<<'TEXT' @@ -75,7 +81,7 @@ TEXT public function execute() { $this->mode = $this->getOption( 'mode' ); if ( !in_array( $this->mode, [ 'pages', 'subcats', 'files' ] ) ) { - $this->error( 'Please specify a valid mode: one of "pages", "subcats" or "files".', 1 ); + $this->fatalError( 'Please specify a valid mode: one of "pages", "subcats" or "files".' ); } $this->minimumId = intval( $this->getOption( 'begin', 0 ) ); @@ -156,7 +162,7 @@ TEXT [ "cat_{$this->mode}" => $row->count ], [ 'cat_id' => $row->cat_id, - "cat_{$this->mode} != {$row->count}", + "cat_{$this->mode} != " . (int)( $row->count ), ], __METHOD__ ); $affectedRows += $dbw->affectedRows(); @@ -168,5 +174,5 @@ TEXT } } -$maintClass = 'RecountCategories'; +$maintClass = RecountCategories::class; require_once RUN_MAINTENANCE_IF_MAIN;