mDescription = 'ApplyPatchT6095'; } public function execute() { global $wgLocalDatabases; sort( $wgLocalDatabases ); $dbClusterArr = [ 'c1' => [], 'c2' => [], 'c3' => [], 'c4' => [], ]; foreach ( $wgLocalDatabases as $wikiDb ) { $wikiObj = new RemoteWiki( $wikiDb ); $dbClusterArr[$wikiObj->getDBCluster()][] = $wikiDb; unset( $wikiObj ); } foreach ( $dbClusterArr['c2'] as $wikiDb ) { $dbObj = wfGetDB( DB_MASTER, [], $wikiDb ); $rlTable = []; $rlTable[$wikiDb] = []; foreach ( $dbObj->query( 'DESCRIBE rottenlinks' ) as $row ) { $rlTable[$wikiDb][$row->Field] = [ 'Type' => $row->Type, 'Key' => $row->Key ]; } if ( !isset( $rlTable[$wikiDb]['rl_id'] ) ) { $this->output( "ALTER TABLE {$wikiDb}.rottenlinks DROP INDEX IF EXISTS `PRIMARY`;\n" ); $this->output( "ALTER TABLE {$wikiDb}.rottenlinks ADD COLUMN rl_id INT AUTO_INCREMENT PRIMARY KEY;\n" ); $this->output( "ALTER TABLE {$wikiDb}.rottenlinks MODIFY COLUMN rl_id INT AUTO_INCREMENT FIRST;\n" ); } if ( $rlTable[$wikiDb]['rl_externallink']['Type'] != 'blob' ) { $this->output( "ALTER TABLE {$wikiDb}.rottenlinks MODIFY COLUMN rl_externallink BLOB NOT NULL;\n" ); } } } } $maintClass = 'ApplyPatchT6095'; require_once RUN_MAINTENANCE_IF_MAIN;