X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2FupdateCollation.php;h=ebace75eab45f383b2a14f9ffdd151dd6b272183;hb=c00c34f288c13b5360e30c694d929e4c65e3a3a1;hp=06704549470bd19c55a27b47e83f4f688afe7196;hpb=15f6eff90c305d405fe4331c8a8dc8caa842e5b3;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 0670454947..ebace75eab 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -26,6 +26,7 @@ require_once __DIR__ . '/Maintenance.php'; +use MediaWiki\MediaWikiServices; use Wikimedia\Rdbms\IDatabase; /** @@ -142,7 +143,6 @@ TEXT wfWaitForSlaves(); } $count = 0; - $batchCount = 0; $batchConds = []; do { $this->output( "Selecting next " . self::BATCH_SIZE . " rows..." ); @@ -187,7 +187,8 @@ TEXT } # cl_type will be wrong for lots of pages if cl_collation is 0, # so let's update it while we're here. - $type = MWNamespace::getCategoryLinkType( $title->getNamespace() ); + $type = MediaWikiServices::getInstance()->getNamespaceInfo()-> + getCategoryLinkType( $title->getNamespace() ); $newSortKey = $collation->getSortKey( $title->getCategorySortkey( $prefix ) ); if ( $verboseStats ) { @@ -304,11 +305,7 @@ TEXT if ( $raw !== '' ) { $raw .= ', '; } - if ( !isset( $this->sizeHistogram[$i] ) ) { - $val = 0; - } else { - $val = $this->sizeHistogram[$i]; - } + $val = $this->sizeHistogram[$i] ?? 0; for ( $coarseIndex = 0; $coarseIndex < $numBins - 1; $coarseIndex++ ) { if ( $coarseBoundaries[$coarseIndex] > $i ) { $coarseHistogram[$coarseIndex] += $val; @@ -327,11 +324,7 @@ TEXT $scale = 60 / $maxBinVal; $prevBoundary = 0; for ( $coarseIndex = 0; $coarseIndex < $numBins; $coarseIndex++ ) { - if ( !isset( $coarseHistogram[$coarseIndex] ) ) { - $val = 0; - } else { - $val = $coarseHistogram[$coarseIndex]; - } + $val = $coarseHistogram[$coarseIndex] ?? 0; $boundary = $coarseBoundaries[$coarseIndex]; $this->output( sprintf( "%-10s %-10d |%s\n", $prevBoundary . '-' . ( $boundary - 1 ) . ': ',