X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FfixExtLinksProtocolRelative.php;h=0fae63c3bf2441ad9b3dc52cb7882d0418a68e30;hb=f5b9af121a07ecc674a63cbc65c3a01e9fa7d785;hp=0c60e62c702e2477ff55fae64634e1bb38a4eecd;hpb=f0edb3e368a5fc69218d20f76f1538b68f37db42;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/fixExtLinksProtocolRelative.php b/maintenance/fixExtLinksProtocolRelative.php index 0c60e62c70..0fae63c3bf 100644 --- a/maintenance/fixExtLinksProtocolRelative.php +++ b/maintenance/fixExtLinksProtocolRelative.php @@ -34,8 +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->addDescription( + 'Fixes any entries in the externallinks table containing protocol-relative URLs' ); } protected function getUpdateKey() { @@ -47,15 +47,15 @@ class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance { } protected function doDBUpdates() { - $db = wfGetDB( DB_MASTER ); + $db = $this->getDB( 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" ); - $res = $db->select( 'externallinks', array( 'el_from', 'el_to', 'el_index' ), - array( 'el_index' . $db->buildLike( '//', $db->anyString() ) ), + $res = $db->select( 'externallinks', [ 'el_from', 'el_to', 'el_index' ], + [ 'el_index' . $db->buildLike( '//', $db->anyString() ) ], __METHOD__ ); $count = 0; @@ -66,28 +66,28 @@ class FixExtLinksProtocolRelative extends LoggedUpdateMaintenance { wfWaitForSlaves(); } $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' ) + ] + ], __METHOD__, [ 'IGNORE' ] ); $db->delete( 'externallinks', - array( + [ 'el_index' => $row->el_index, 'el_from' => $row->el_from, 'el_to' => $row->el_to - ), + ], __METHOD__ ); }