X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateRestrictions.php;h=c0b7b10f9bbd2d93395d2af6286be0591fa8212d;hb=cd43f3f6d6978a0c25eab96439a8d9967034ad35;hp=96eaf822d6701c4ebcc8edc7021305819406c36b;hpb=f43fa6f4f0e2cb60b8543daad661b48a3e0653a9;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateRestrictions.php b/maintenance/updateRestrictions.php index 96eaf822d6..c0b7b10f9b 100644 --- a/maintenance/updateRestrictions.php +++ b/maintenance/updateRestrictions.php @@ -36,28 +36,29 @@ class UpdateRestrictions extends Maintenance { public function __construct() { parent::__construct(); $this->addDescription( 'Updates page_restrictions table from old page_restriction column' ); - $this->setBatchSize( 100 ); + $this->setBatchSize( 1000 ); } public function execute() { $db = $this->getDB( DB_MASTER ); + $batchSize = $this->getBatchSize(); if ( !$db->tableExists( 'page_restrictions' ) ) { - $this->error( "page_restrictions table does not exist", true ); + $this->fatalError( "page_restrictions table does not exist" ); } $start = $db->selectField( 'page', 'MIN(page_id)', false, __METHOD__ ); if ( !$start ) { - $this->error( "Nothing to do.", true ); + $this->fatalError( "Nothing to do." ); } $end = $db->selectField( 'page', 'MAX(page_id)', false, __METHOD__ ); # Do remaining chunk - $end += $this->mBatchSize - 1; + $end += $batchSize - 1; $blockStart = $start; - $blockEnd = $start + $this->mBatchSize - 1; + $blockEnd = $start + $batchSize - 1; $encodedExpiry = 'infinity'; while ( $blockEnd <= $end ) { - $this->output( "...doing page_id from $blockStart to $blockEnd\n" ); + $this->output( "...doing page_id from $blockStart to $blockEnd out of $end\n" ); $cond = "page_id BETWEEN $blockStart AND $blockEnd AND page_restrictions !=''"; $res = $db->select( 'page', @@ -105,8 +106,8 @@ class UpdateRestrictions extends Maintenance { throw new MWException( "Deadlock loop failed wtf :(" ); } } - $blockStart += $this->mBatchSize - 1; - $blockEnd += $this->mBatchSize - 1; + $blockStart += $batchSize - 1; + $blockEnd += $batchSize - 1; wfWaitForSlaves(); } $this->output( "...removing dead rows from page_restrictions\n" );