X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FpopulateChangeTagDef.php;h=2be690b08df8adaae4f060c753f3de9cfc09b106;hb=2501d1dedfbdaba981cea49ff7b67fda0926d822;hp=7bec25ac975a78c0f5d24b0c740289b4b64b1214;hpb=0245bce0171c8e6466724bbfffbd97297bcbce35;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/populateChangeTagDef.php b/maintenance/populateChangeTagDef.php index 7bec25ac97..2be690b08d 100644 --- a/maintenance/populateChangeTagDef.php +++ b/maintenance/populateChangeTagDef.php @@ -34,7 +34,7 @@ class PopulateChangeTagDef extends LoggedUpdateMaintenance { $this->setBatchSize( 1000 ); $this->addOption( 'sleep', - 'Sleep time (in seconds) between every batch', + 'Sleep time (in seconds) between every batch, defaults to zero', false, true ); @@ -42,16 +42,6 @@ class PopulateChangeTagDef extends LoggedUpdateMaintenance { $this->addOption( 'set-user-tags-only', 'Only update ctd_user_defined from valid_tag table' ); } - public function execute() { - global $wgChangeTagsSchemaMigrationStage; - if ( $wgChangeTagsSchemaMigrationStage === MIGRATION_OLD ) { - // Return "success", but don't flag it as done so the next run will retry - $this->output( '... Not run, $wgChangeTagsSchemaMigrationStage === MIGRATION_OLD' . "\n" ); - return true; - } - return parent::execute(); - } - protected function doDBUpdates() { $this->lbFactory = MediaWiki\MediaWikiServices::getInstance()->getDBLoadBalancerFactory(); $this->setBatchSize( $this->getOption( 'batch-size', $this->getBatchSize() ) ); @@ -84,12 +74,15 @@ class PopulateChangeTagDef extends LoggedUpdateMaintenance { private function setUserDefinedTags() { $dbr = $this->lbFactory->getMainLB()->getConnection( DB_REPLICA ); - $userTags = $dbr->selectFieldValues( - 'valid_tag', - 'vt_tag', - [], - __METHOD__ - ); + $userTags = null; + if ( $dbr->tableExists( 'valid_tag' ) ) { + $userTags = $dbr->selectFieldValues( + 'valid_tag', + 'vt_tag', + [], + __METHOD__ + ); + } if ( empty( $userTags ) ) { $this->output( "No user defined tags to set, moving on...\n" ); @@ -207,7 +200,7 @@ class PopulateChangeTagDef extends LoggedUpdateMaintenance { private function backpopulateChangeTagPerTag( $tagName, $tagId ) { $dbr = $this->lbFactory->getMainLB()->getConnection( DB_REPLICA ); $dbw = $this->lbFactory->getMainLB()->getConnection( DB_MASTER ); - $sleep = (int)$this->getOption( 'sleep', 10 ); + $sleep = (int)$this->getOption( 'sleep', 0 ); $lastId = 0; $this->output( "Starting to add ct_tag_id = {$tagId} for ct_tag = {$tagName}\n" ); while ( true ) {