X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FconvertLinks.php;h=af60eaa2ba81621c2f4a32b2b5776058e1c6d1c0;hb=9e5edca6c55bc386f899722cc50a62d669a1314b;hp=fa9c574b562a5146dc1c14594c7aadd154312b8c;hpb=592637225a4d5db5abcdc288d838c160284eef08;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/convertLinks.php b/maintenance/convertLinks.php index fa9c574b56..af60eaa2ba 100644 --- a/maintenance/convertLinks.php +++ b/maintenance/convertLinks.php @@ -21,6 +21,8 @@ * @ingroup Maintenance */ +use MediaWiki\MediaWikiServices; + require_once __DIR__ . '/Maintenance.php'; /** @@ -75,8 +77,6 @@ class ConvertLinks extends Maintenance { return; } - global $wgContLang; - # counters etc $numBadLinks = $curRowsRead = 0; @@ -148,12 +148,13 @@ 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; if ( $row->cur_namespace ) { - $title = $wgContLang->getNsText( $row->cur_namespace ) . ":$title"; + $title = MediaWikiServices::getInstance()->getContentLanguage()-> + getNsText( $row->cur_namespace ) . ":$title"; } $ids[$title] = $row->cur_id; $curRowsRead++; @@ -193,9 +194,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 @@ -302,5 +303,5 @@ class ConvertLinks extends Maintenance { } } -$maintClass = "ConvertLinks"; +$maintClass = ConvertLinks::class; require_once RUN_MAINTENANCE_IF_MAIN;