X-Git-Url: https://git.cyclocoop.org/admin/?a=blobdiff_plain;f=maintenance%2FupdateCollation.php;h=12b33b47bb8524becf03b6b18de6ede6b898cc2d;hb=6be5e0a92ccf048f7e6c5c337f4696bc9c676d7c;hp=54ae1301f103df62051329490b3f856083272eb5;hpb=7504fb649afcfcfc50da858fa124fc42ee4998a6;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/updateCollation.php b/maintenance/updateCollation.php index 54ae1301f1..12b33b47bb 100644 --- a/maintenance/updateCollation.php +++ b/maintenance/updateCollation.php @@ -187,13 +187,7 @@ TEXT } # cl_type will be wrong for lots of pages if cl_collation is 0, # so let's update it while we're here. - if ( $title->getNamespace() == NS_CATEGORY ) { - $type = 'subcat'; - } elseif ( $title->getNamespace() == NS_FILE ) { - $type = 'file'; - } else { - $type = 'page'; - } + $type = MWNamespace::getCategoryLinkType( $title->getNamespace() ); $newSortKey = $collation->getSortKey( $title->getCategorySortkey( $prefix ) ); if ( $verboseStats ) { @@ -232,12 +226,6 @@ TEXT } else { $this->output( "$count done.\n" ); } - - if ( !$dryRun && ++$batchCount % self::SYNC_INTERVAL == 0 ) { - $this->output( "Waiting for replica DBs ... " ); - wfWaitForSlaves(); - $this->output( "done\n" ); - } } while ( $res->numRows() == self::BATCH_SIZE ); if ( !$dryRun ) { @@ -316,11 +304,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; @@ -339,11 +323,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 ) . ': ',