X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateContentModel.php;h=74a918ae12b6774861dfb2f61eb9f872a4a8ee9d;hb=949dc920ee61e838320186565cb6dc146a013b25;hp=b41e0e0d6e74551319085e9e02afbb06ed1e995f;hpb=c253b03fe5799331d34f390d426bd58d20fc50d6;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateContentModel.php b/maintenance/populateContentModel.php index b41e0e0d6e..74a918ae12 100644 --- a/maintenance/populateContentModel.php +++ b/maintenance/populateContentModel.php @@ -23,13 +23,16 @@ require_once __DIR__ . '/Maintenance.php'; +use Wikimedia\Rdbms\IDatabase; +use MediaWiki\MediaWikiServices; + /** * Usage: * populateContentModel.php --ns=1 --table=page */ class PopulateContentModel extends Maintenance { protected $wikiId; - + /** @var WANObjectCache */ protected $wanCache; public function __construct() { @@ -43,9 +46,8 @@ class PopulateContentModel extends Maintenance { public function execute() { $dbw = $this->getDB( DB_MASTER ); - $this->wikiId = $dbw->getWikiID(); - - $this->wanCache = ObjectCache::getMainWANInstance(); + $this->wikiId = $dbw->getDomainID(); + $this->wanCache = MediaWikiServices::getInstance()->getMainWANObjectCache(); $ns = $this->getOption( 'ns' ); if ( !ctype_digit( $ns ) && $ns !== 'all' ) { @@ -78,7 +80,7 @@ class PopulateContentModel extends Maintenance { $this->wanCache->delete( $revisionKey ); } - private function updatePageRows( Database $dbw, $pageIds, $model ) { + private function updatePageRows( IDatabase $dbw, $pageIds, $model ) { $count = count( $pageIds ); $this->output( "Setting $count rows to $model..." ); $dbw->update( @@ -91,7 +93,7 @@ class PopulateContentModel extends Maintenance { $this->output( "done.\n" ); } - protected function populatePage( Database $dbw, $ns ) { + protected function populatePage( IDatabase $dbw, $ns ) { $toSave = []; $lastId = 0; $nsCondition = $ns === 'all' ? [] : [ 'page_namespace' => $ns ]; @@ -123,7 +125,7 @@ class PopulateContentModel extends Maintenance { } } - private function updateRevisionOrArchiveRows( Database $dbw, $ids, $model, $table ) { + private function updateRevisionOrArchiveRows( IDatabase $dbw, $ids, $model, $table ) { $prefix = $table === 'archive' ? 'ar' : 'rev'; $model_column = "{$prefix}_content_model"; $format_column = "{$prefix}_content_format"; @@ -142,7 +144,7 @@ class PopulateContentModel extends Maintenance { $this->output( "done.\n" ); } - protected function populateRevisionOrArchive( Database $dbw, $table, $ns ) { + protected function populateRevisionOrArchive( IDatabase $dbw, $table, $ns ) { $prefix = $table === 'archive' ? 'ar' : 'rev'; $model_column = "{$prefix}_content_model"; $format_column = "{$prefix}_content_format";