X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Fstorage%2FtestCompression.php;h=2692a07a846e340a3b5540d3e3611c56fe0a9784;hb=e014b9a5050f27cabb00f1e7dcae494378318502;hp=148a9d18347aa24b941597153f623140b1364847;hpb=23299ca8790bcf1aebcf54e0932b94338e630474;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/storage/testCompression.php b/maintenance/storage/testCompression.php index 148a9d1834..2692a07a84 100644 --- a/maintenance/storage/testCompression.php +++ b/maintenance/storage/testCompression.php @@ -21,7 +21,7 @@ * @ingroup Maintenance ExternalStorage */ -$optionsWithArgs = array( 'start', 'limit', 'type' ); +$optionsWithArgs = [ 'start', 'limit', 'type' ]; require __DIR__ . '/../commandLine.inc'; if ( !isset( $args[0] ) ) { @@ -30,10 +30,11 @@ if ( !isset( $args[0] ) ) { exit( 1 ); } +$lang = Language::factory( 'en' ); $title = Title::newFromText( $args[0] ); if ( isset( $options['start'] ) ) { $start = wfTimestamp( TS_MW, strtotime( $options['start'] ) ); - echo "Starting from " . $wgLang->timeanddate( $start ) . "\n"; + echo "Starting from " . $lang->timeanddate( $start ) . "\n"; } else { $start = '19700101000000'; } @@ -48,20 +49,20 @@ $type = isset( $options['type'] ) ? $options['type'] : 'ConcatenatedGzipHistoryB $dbr = $this->getDB( DB_SLAVE ); $res = $dbr->select( - array( 'page', 'revision', 'text' ), + [ 'page', 'revision', 'text' ], '*', - array( + [ 'page_namespace' => $title->getNamespace(), 'page_title' => $title->getDBkey(), 'page_id=rev_page', 'rev_timestamp > ' . $dbr->addQuotes( $dbr->timestamp( $start ) ), 'rev_text_id=old_id' - ), __FILE__, array( 'LIMIT' => $limit ) + ], __FILE__, [ 'LIMIT' => $limit ] ); $blob = new $type; -$hashes = array(); -$keys = array(); +$hashes = []; +$keys = []; $uncompressedSize = 0; $t = -microtime( true ); foreach ( $res as $row ) { @@ -83,7 +84,7 @@ printf( "%s\nCompression ratio for %d revisions: %5.2f, %s -> %d\n", $type, count( $hashes ), $uncompressedSize / strlen( $serialized ), - $wgLang->formatSize( $uncompressedSize ), + $lang->formatSize( $uncompressedSize ), strlen( $serialized ) ); printf( "Compression time: %5.2f ms\n", $t * 1000 );