X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FfixDefaultJsonContentPages.php;h=460b553455e2f0ee37135870d04e8bf7b1dce787;hb=02aacff54cdb4440defaad9cb31368a92344d6f6;hp=18334d62e5b741413428f1cdf6b159ccb9b04f4e;hpb=59db24e90bc6027cb8bf2756eb8cb52230d24966;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/fixDefaultJsonContentPages.php b/maintenance/fixDefaultJsonContentPages.php index 18334d62e5..460b553455 100644 --- a/maintenance/fixDefaultJsonContentPages.php +++ b/maintenance/fixDefaultJsonContentPages.php @@ -47,24 +47,24 @@ class FixDefaultJsonContentPages extends LoggedUpdateMaintenance { return true; } - $dbr = $this->getDB( DB_SLAVE ); - $namespaces = array( + $dbr = $this->getDB( DB_REPLICA ); + $namespaces = [ NS_MEDIAWIKI => $dbr->buildLike( $dbr->anyString(), '.json' ), NS_USER => $dbr->buildLike( $dbr->anyString(), '/', $dbr->anyString(), '.json' ), - ); + ]; foreach ( $namespaces as $ns => $like ) { $lastPage = 0; do { $rows = $dbr->select( 'page', - array( 'page_id', 'page_title', 'page_namespace', 'page_content_model' ), - array( + [ 'page_id', 'page_title', 'page_namespace', 'page_content_model' ], + [ 'page_namespace' => $ns, 'page_title ' . $like, 'page_id > ' . $dbr->addQuotes( $lastPage ) - ), + ], __METHOD__, - array( 'ORDER BY' => 'page_id', 'LIMIT' => $this->mBatchSize ) + [ 'ORDER BY' => 'page_id', 'LIMIT' => $this->mBatchSize ] ); foreach ( $rows as $row ) { $this->handleRow( $row ); @@ -89,8 +89,8 @@ class FixDefaultJsonContentPages extends LoggedUpdateMaintenance { $this->output( "Setting page_content_model to json..." ); $dbw->update( 'page', - array( 'page_content_model' => CONTENT_MODEL_JSON ), - array( 'page_id' => $row->page_id ), + [ 'page_content_model' => CONTENT_MODEL_JSON ], + [ 'page_id' => $row->page_id ], __METHOD__ ); $this->output( "done.\n" ); @@ -105,14 +105,14 @@ class FixDefaultJsonContentPages extends LoggedUpdateMaintenance { $ids = $dbw->selectFieldValues( 'revision', 'rev_id', - array( 'rev_page' => $row->page_id ), + [ 'rev_page' => $row->page_id ], __METHOD__ ); foreach ( array_chunk( $ids, 50 ) as $chunk ) { $dbw->update( 'revision', - array( 'rev_content_model' => CONTENT_MODEL_WIKITEXT ), - array( 'rev_page' => $row->page_id, 'rev_id' => $chunk ) + [ 'rev_content_model' => CONTENT_MODEL_WIKITEXT ], + [ 'rev_page' => $row->page_id, 'rev_id' => $chunk ] ); wfWaitForSlaves(); }