X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FconvertLinks.php;h=23c46bc2ff767bb0090beea49e68c08dbea8c495;hb=0e4f6e3b8d4b815e9f924720ad536d56c01f456d;hp=59820a5a8fff57f4c33a6b7c1f3fa49489f3feb9;hpb=f059cfda06cec090089436ad86acdce6cb3cc0b7;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/convertLinks.php b/maintenance/convertLinks.php index 59820a5a8f..23c46bc2ff 100644 --- a/maintenance/convertLinks.php +++ b/maintenance/convertLinks.php @@ -117,6 +117,7 @@ class ConvertLinks extends Maintenance { } $res = $dbw->query( "SELECT l_from FROM $links LIMIT 1" ); + // @phan-suppress-next-line PhanUndeclaredMethod if ( $dbw->fieldType( $res, 0 ) == "int" ) { $this->output( "Schema already converted\n" ); @@ -144,30 +145,34 @@ class ConvertLinks extends Maintenance { $this->output( "Loading IDs from $cur table...\n" ); $this->performanceLog( $fh, "Reading $numRows rows from cur table...\n" ); $this->performanceLog( $fh, "rows read vs seconds elapsed:\n" ); + $contentLang = MediaWikiServices::getInstance()->getContentLanguage(); - $dbw->bufferResults( false ); - $res = $dbw->query( "SELECT cur_namespace,cur_title,cur_id FROM $cur" ); $ids = []; - - foreach ( $res as $row ) { - $title = $row->cur_title; - if ( $row->cur_namespace ) { - $title = MediaWikiServices::getInstance()->getContentLanguage()-> - getNsText( $row->cur_namespace ) . ":$title"; - } - $ids[$title] = $row->cur_id; - $curRowsRead++; - if ( $reportCurReadProgress ) { - if ( ( $curRowsRead % $curReadReportInterval ) == 0 ) { - $this->performanceLog( - $fh, - $curRowsRead . " " . ( microtime( true ) - $baseTime ) . "\n" - ); - $this->output( "\t$curRowsRead rows of $cur table read.\n" ); + $lastId = 0; + do { + $res = $dbw->query( + "SELECT cur_namespace,cur_title,cur_id FROM $cur " . + "WHERE cur_id > $lastId ORDER BY cur_id LIMIT 10000" + ); + foreach ( $res as $row ) { + $title = $row->cur_title; + if ( $row->cur_namespace ) { + $title = $contentLang->getNsText( $row->cur_namespace ) . ":$title"; + } + $ids[$title] = $row->cur_id; + $curRowsRead++; + if ( $reportCurReadProgress ) { + if ( ( $curRowsRead % $curReadReportInterval ) == 0 ) { + $this->performanceLog( + $fh, + $curRowsRead . " " . ( microtime( true ) - $baseTime ) . "\n" + ); + $this->output( "\t$curRowsRead rows of $cur table read.\n" ); + } } + $lastId = $row->cur_id; } - } - $dbw->bufferResults( true ); + } while ( $res->numRows() > 0 ); $this->output( "Finished loading IDs.\n\n" ); $this->performanceLog( $fh,