X-Git-Url: http://git.cyclocoop.org/?a=blobdiff_plain;f=maintenance%2FconvertLinks.php;h=54c0edaecc8f953f87c968b0441c0ce0f2088492;hb=9a8e2b7124ed10db3db7f7767d532cde00935876;hp=c3ad46a012ac1494284c9aa865009d7e363b9705;hpb=9dfb45cc7c6ab53b55a484233795e7451cbee680;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/convertLinks.php b/maintenance/convertLinks.php index c3ad46a012..54c0edaecc 100644 --- a/maintenance/convertLinks.php +++ b/maintenance/convertLinks.php @@ -36,9 +36,9 @@ class ConvertLinks extends Maintenance { public function __construct() { parent::__construct(); - $this->mDescription = - "Convert from the old links schema (string->ID) to the new schema (ID->ID)." - . "The wiki should be put into read-only mode while this script executes"; + $this->addDescription( + 'Convert from the old links schema (string->ID) to the new schema (ID->ID). ' + . 'The wiki should be put into read-only mode while this script executes' ); $this->addArg( 'logperformance', "Log performance to perfLogFilename.", false ); $this->addArg( @@ -66,7 +66,7 @@ class ConvertLinks extends Maintenance { } public function execute() { - $dbw = wfGetDB( DB_MASTER ); + $dbw = $this->getDB( DB_MASTER ); $type = $dbw->getType(); if ( $type != 'mysql' ) { @@ -148,7 +148,7 @@ class ConvertLinks extends Maintenance { $dbw->bufferResults( false ); $res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" ); - $ids = array(); + $ids = []; foreach ( $res as $row ) { $title = $row->cur_title; @@ -193,9 +193,9 @@ class ConvertLinks extends Maintenance { $sqlRead = $dbw->limitResult( $sqlRead, $linksConvInsertInterval, $rowOffset ); $res = $dbw->query( $sqlRead ); if ( $noKeys ) { - $sqlWrite = array( "INSERT INTO $links_temp (l_from,l_to) VALUES " ); + $sqlWrite = [ "INSERT INTO $links_temp (l_from,l_to) VALUES " ]; } else { - $sqlWrite = array( "INSERT IGNORE INTO $links_temp (l_from,l_to) VALUES " ); + $sqlWrite = [ "INSERT IGNORE INTO $links_temp (l_from,l_to) VALUES " ]; } $tuplesAdded = 0; # no tuples added to INSERT yet @@ -267,7 +267,7 @@ class ConvertLinks extends Maintenance { } private function createTempTable() { - $dbConn = wfGetDB( DB_MASTER ); + $dbConn = $this->getDB( DB_MASTER ); if ( !( $dbConn->isOpen() ) ) { $this->output( "Opening connection to database failed.\n" );