X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FpopulateContentTables.php;h=49db4fb978ae377b0d888cac93a80bc0327e57bc;hb=ed6d53fd38cbc08ad503174aa09d155dc9867a13;hp=b550cc2a094035c7b099f05e5dfeeae863bd2ebe;hpb=55aab97bb4b507911e24995ae870b78f86c17557;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateContentTables.php b/maintenance/populateContentTables.php index b550cc2a09..49db4fb978 100644 --- a/maintenance/populateContentTables.php +++ b/maintenance/populateContentTables.php @@ -58,6 +58,8 @@ class PopulateContentTables extends Maintenance { 'Reuse content table rows when the address and model are the same. ' . 'This will increase the script\'s time and memory usage, perhaps significantly.', false, false ); + $this->addOption( 'start-revision', 'The rev_id to start at', false, true ); + $this->addOption( 'start-archive', 'The ar_rev_id to start at', false, true ); $this->setBatchSize( 500 ); } @@ -92,6 +94,7 @@ class PopulateContentTables extends Maintenance { $elapsed = microtime( true ) - $t0; $this->writeln( "Done. Processed $this->totalCount rows in $elapsed seconds" ); + return true; } /** @@ -164,6 +167,7 @@ class PopulateContentTables extends Maintenance { 'slots' => [ 'LEFT JOIN', 'rev_id=slot_revision_id' ], 'page' => [ 'LEFT JOIN', 'rev_page=page_id' ], ]; + $startOption = 'start-revision'; } else { $idField = 'ar_rev_id'; $tables = [ 'archive', 'slots' ]; @@ -179,6 +183,7 @@ class PopulateContentTables extends Maintenance { $joins = [ 'slots' => [ 'LEFT JOIN', 'ar_rev_id=slot_revision_id' ], ]; + $startOption = 'start-archive'; } $minmax = $this->dbw->selectRow( @@ -187,6 +192,14 @@ class PopulateContentTables extends Maintenance { '', __METHOD__ ); + if ( $this->hasOption( $startOption ) ) { + $minmax->min = (int)$this->getOption( $startOption ); + } + if ( !$minmax || !is_numeric( $minmax->min ) || !is_numeric( $minmax->max ) ) { + // No rows? + $minmax = (object)[ 'min' => 1, 'max' => 0 ]; + } + $batchSize = $this->getBatchSize(); for ( $startId = $minmax->min; $startId <= $minmax->max; $startId += $batchSize ) {