X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FfixExtLinksProtocolRelative.php;h=0c60e62c702e2477ff55fae64634e1bb38a4eecd;hb=fb338573acb5d1394e0dd5c4ec0cb2d1af505f1a;hp=2403ec68b47be2260c429fa17173c282579a2864;hpb=67bfdc7a68940d901e585eadd984a2074bf0216a;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/fixExtLinksProtocolRelative.php b/maintenance/fixExtLinksProtocolRelative.php index 2403ec68b4..0c60e62c70 100644 --- a/maintenance/fixExtLinksProtocolRelative.php +++ b/maintenance/fixExtLinksProtocolRelative.php @@ -23,7 +23,7 @@ * @ingroup Maintenance */ -require_once( __DIR__ . '/Maintenance.php' ); +require_once __DIR__ . '/Maintenance.php'; /** * Maintenance script that fixes any entriy for protocol-relative URLs @@ -34,7 +34,8 @@ require_once( __DIR__ . '/Maintenance.php' ); class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance { public function __construct() { parent::__construct(); - $this->mDescription = "Fixes any entries in the externallinks table containing protocol-relative URLs"; + $this->mDescription = + "Fixes any entries in the externallinks table containing protocol-relative URLs"; } protected function getUpdateKey() { @@ -49,6 +50,7 @@ class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance { $db = wfGetDB( DB_MASTER ); if ( !$db->tableExists( 'externallinks' ) ) { $this->error( "externallinks table does not exist" ); + return false; } $this->output( "Fixing protocol-relative entries in the externallinks table...\n" ); @@ -66,23 +68,34 @@ class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance { $db->insert( 'externallinks', array( array( + 'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ), 'el_from' => $row->el_from, 'el_to' => $row->el_to, 'el_index' => "http:{$row->el_index}", ), array( + 'el_id' => $db->nextSequenceValue( 'externallinks_el_id_seq' ), 'el_from' => $row->el_from, 'el_to' => $row->el_to, 'el_index' => "https:{$row->el_index}", ) ), __METHOD__, array( 'IGNORE' ) ); - $db->delete( 'externallinks', array( 'el_index' => $row->el_index, 'el_from' => $row->el_from, 'el_to' => $row->el_to ), __METHOD__ ); + $db->delete( + 'externallinks', + array( + 'el_index' => $row->el_index, + 'el_from' => $row->el_from, + 'el_to' => $row->el_to + ), + __METHOD__ + ); } $this->output( "Done, $count rows updated.\n" ); + return true; } } $maintClass = "FixExtLinksProtocolRelative"; -require_once( RUN_MAINTENANCE_IF_MAIN ); +require_once RUN_MAINTENANCE_IF_MAIN;