Hashar has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/119955

Change subject: Option to increase verbosity of refreshCdbJsonFiles
......................................................................

Option to increase verbosity of refreshCdbJsonFiles

Generating the JSON and md5 files can take a while (up to 2 minutes on
the beta cluster) which leave people with little clues about what is
going on.

The patch adds an optional "--verbose" option to refreshCdbJsonFiles
which is passed to it whenever mw-update-l10n is invoked with --verbose.

Change-Id: I0cfd59f0fd1ab962522b9d3008631560433959a0
---
M bin/mw-update-l10n
M bin/refreshCdbJsonFiles
2 files changed, 13 insertions(+), 4 deletions(-)


  git pull ssh://gerrit.wikimedia.org:29418/mediawiki/tools/scap 
refs/changes/55/119955/1

diff --git a/bin/mw-update-l10n b/bin/mw-update-l10n
index 1bcb780..cec4f3b 100755
--- a/bin/mw-update-l10n
+++ b/bin/mw-update-l10n
@@ -21,6 +21,7 @@
 fi
 
 QUIET=--quiet
+VERBOSE=
 FORCE_FULL_REBUILD=
 TEMP=`getopt -o '' -l verbose -- "$@"`
 if [ $? -ne 0 ]; then
@@ -31,6 +32,7 @@
        case "$1" in
                --verbose)
                        QUIET=
+                       VERBOSE='--verbose'
                        shift
                        ;;
                --)
@@ -103,9 +105,12 @@
                --wiki="$mwDbName" --outdir="$mwL10nCacheDir" $QUIET \
                --threads=$THREADS $FORCE_FULL_REBUILD ||
                die
+       echo "done"
 
        # Include JSON versions of the CDB files and add MD5 files
-       sudo -u l10nupdate $BINDIR/refreshCdbJsonFiles 
--directory="$MW_COMMON_SOURCE/php-$mwVerNum/cache/l10n" \
+       echo "Generating JSON versions and md5 files..."
+       sudo -u l10nupdate $BINDIR/refreshCdbJsonFiles $VERBOSE \
+               --directory="$MW_COMMON_SOURCE/php-$mwVerNum/cache/l10n" \
                --threads=$THREADS \
                || die
 
diff --git a/bin/refreshCdbJsonFiles b/bin/refreshCdbJsonFiles
index 9fd4c13..37180ed 100755
--- a/bin/refreshCdbJsonFiles
+++ b/bin/refreshCdbJsonFiles
@@ -2,7 +2,7 @@
 <?php
 
 /**
- * Create JSON/MD5 files for all CDB files in a directory
+ * Create JSON/MD5 files for all CDB files in a directory.
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -28,7 +28,7 @@
 }
 
 $script = new RefreshCdbJsonFiles(
-       getopt( '', array( 'directory:', 'threads:' ) )
+       getopt( '', array( 'verbose', 'directory:', 'threads:' ) )
 );
 $script->execute();
 
@@ -53,12 +53,13 @@
        public function __construct( array $params ) {
                foreach ( array( 'directory' ) as $par ) {
                        if ( !isset( $params[$par] ) ) {
-                               die( "Usage: refreshCdbJsonFiles " .
+                               die( "Usage: refreshCdbJsonFiles [--verbose] " .
                                        "--directory <directory> --threads 
<integer>\n"
                                );
                        }
                }
                $this->params = $params;
+               $this->params['verbose'] = isset( $params['verbose'] );
                $this->params['threads'] = isset( $params['threads'] ) ? 
$params['threads'] : 1;
        }
 
@@ -146,6 +147,9 @@
        protected function doUpdate( $directory, array $files, $resFile ) {
                $rebuilt = 0;
                foreach ( $files as $file ) {
+                       if ( $this->params['verbose' ) {
+                               $this->output( "Processing $directory/$file\n" 
);
+                       }
                        $newCdbMd5 = md5_file( "$directory/$file" );
                        if ( is_file( "$directory/upstream/$file.MD5" ) &&
                                is_file( "$directory/upstream/$file.json" ) &&

-- 
To view, visit https://gerrit.wikimedia.org/r/119955
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I0cfd59f0fd1ab962522b9d3008631560433959a0
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/tools/scap
Gerrit-Branch: master
Gerrit-Owner: Hashar <has...@free.fr>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to