setBatchSize( 500 ); $this->requireExtension( 'Echo' ); } public function getUpdateKey() { return __CLASS__; } public function doDBUpdates() { global $wgEchoCluster; $lbFactory = MWEchoDbFactory::newFromDefault(); $dbr = $lbFactory->getEchoDb( DB_REPLICA ); $dbw = $lbFactory->getEchoDb( DB_MASTER ); if ( !$dbw->fieldExists( 'echo_event', 'event_page_title' ) ) { $this->output( "No event_page_title field, skipping migration from event_page_title to event_page_id\n" ); return true; } $reader = new BatchRowIterator( $dbr, $this->table, $this->idField, $this->mBatchSize ); $reader->addConditions( [ "event_page_title IS NOT NULL", "event_page_id" => null, ] ); $reader->setFetchColumns( [ 'event_page_namespace', 'event_page_title', 'event_extra', 'event_type' ] ); $updater = new BatchRowUpdate( $reader, new BatchRowWriter( $dbw, $this->table, $wgEchoCluster ), new EchoSuppressionRowUpdateGenerator ); $updater->setOutput( function ( $text ) { $this->output( $text ); } ); $updater->execute(); return true; } } $maintClass = UpdateEchoSchemaForSuppression::class; // Tells it to run the class require_once RUN_MAINTENANCE_IF_MAIN;