X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FcleanupWatchlist.php;h=8e4a353df8c4a1d846e26815e5b74c7fb46f9d6e;hb=90d4f56fe46140f9e97e2fa72698f98b57447fe5;hp=d8c682b1ca9cb341466d363f9e1f2fe1cdb1eb26;hpb=4b069cd1b88877fbb253af8780e358d96ba2587c;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/cleanupWatchlist.php b/maintenance/cleanupWatchlist.php index d8c682b1ca..8e4a353df8 100644 --- a/maintenance/cleanupWatchlist.php +++ b/maintenance/cleanupWatchlist.php @@ -29,6 +29,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/cleanupTable.inc'; /** @@ -36,13 +38,13 @@ require_once __DIR__ . '/cleanupTable.inc'; * * @ingroup Maintenance */ -class WatchlistCleanup extends TableCleanup { - protected $defaultParams = array( +class CleanupWatchlist extends TableCleanup { + protected $defaultParams = [ 'table' => 'watchlist', - 'index' => array( 'wl_user', 'wl_namespace', 'wl_title' ), - 'conds' => array(), + 'index' => [ 'wl_user', 'wl_namespace', 'wl_title' ], + 'conds' => [], 'callback' => 'processRow' - ); + ]; public function __construct() { parent::__construct(); @@ -58,10 +60,9 @@ class WatchlistCleanup extends TableCleanup { } protected function processRow( $row ) { - global $wgContLang; $current = Title::makeTitle( $row->wl_namespace, $row->wl_title ); $display = $current->getPrefixedText(); - $verified = $wgContLang->normalize( $display ); + $verified = MediaWikiServices::getInstance()->getContentLanguage()->normalize( $display ); $title = Title::newFromText( $verified ); if ( $row->wl_user == 0 || is_null( $title ) || !$title->equals( $current ) ) { @@ -79,10 +80,10 @@ class WatchlistCleanup extends TableCleanup { if ( !$this->dryrun && $this->hasOption( 'fix' ) ) { $dbw = $this->getDB( DB_MASTER ); $dbw->delete( - 'watchlist', array( + 'watchlist', [ 'wl_user' => $row->wl_user, 'wl_namespace' => $row->wl_namespace, - 'wl_title' => $row->wl_title ), + 'wl_title' => $row->wl_title ], __METHOD__ ); @@ -95,5 +96,5 @@ class WatchlistCleanup extends TableCleanup { } } -$maintClass = "WatchlistCleanup"; +$maintClass = CleanupWatchlist::class; require_once RUN_MAINTENANCE_IF_MAIN;