Ottomata has submitted this change and it was merged.

Change subject: l10nupdate: add support for --verbose flag
......................................................................


l10nupdate: add support for --verbose flag

Calling `l10nupdate --verbose` or `l10nupdate-1 --verbose` will log
additional progress messages as the l10n cache is updated. Also use the
new --verbose flag when running from cron.

Change-Id: If5ce751ba9d22c8584e942aae901c743911ebfe3
---
M files/misc/l10nupdate/l10nupdate
M files/misc/l10nupdate/l10nupdate-1
M manifests/misc/deployment.pp
3 files changed, 25 insertions(+), 6 deletions(-)

Approvals:
  Ottomata: Verified; Looks good to me, approved



diff --git a/files/misc/l10nupdate/l10nupdate b/files/misc/l10nupdate/l10nupdate
index f1c4802..2e41093 100755
--- a/files/misc/l10nupdate/l10nupdate
+++ b/files/misc/l10nupdate/l10nupdate
@@ -1,3 +1,3 @@
 #! /bin/bash
 # This script belongs in /usr/local/bin/.
-sudo -u l10nupdate /usr/local/bin/l10nupdate-1
+sudo -u l10nupdate /usr/local/bin/l10nupdate-1 "$@"
diff --git a/files/misc/l10nupdate/l10nupdate-1 
b/files/misc/l10nupdate/l10nupdate-1
index cd2c20e..e4e65cc 100755
--- a/files/misc/l10nupdate/l10nupdate-1
+++ b/files/misc/l10nupdate/l10nupdate-1
@@ -9,9 +9,28 @@
 GITDIR=/var/lib/l10nupdate/mediawiki
 GITURL=https://gerrit.wikimedia.org/r/p/mediawiki
 GITREPOS="core extensions"
+QUIET=--quiet
 
 umask 0002
 BEGAN=$(date +"%s")
+
+TEMP=`getopt -o '' -l verbose -- "$@"`
+if [ $? -ne 0 ]; then
+    exit 1
+fi
+eval set -- "$TEMP"
+while true; do
+    case "$1" in
+        --verbose)
+            QUIET=
+            shift
+            ;;
+        --)
+            shift
+            break
+    esac
+done
+
 echo "Starting l10nupdate at $(date -ud @$BEGAN)."
 
 # Update i18n messages from git to the HEAD of master, or create the clone if 
it doesn't exist yet
@@ -66,12 +85,12 @@
 
        echo "Running updates for $mwVerNum (on $mwDbName)"
        if /usr/local/bin/mwscript extensions/LocalisationUpdate/update.php \
-                 --wiki="$mwDbName" \
-                 --quiet
+                 --wiki="$mwDbName" $QUIET
        then
                echo "Rebuilding localization cache at `date 
--rfc-3339=seconds`"
-               /usr/local/bin/mwscript rebuildLocalisationCache.php 
--wiki="$mwDbName" \
-                                 --quiet 
--outdir=/var/lib/l10nupdate/cache-"$mwVerNum"
+               /usr/local/bin/mwscript rebuildLocalisationCache.php \
+                       --wiki="$mwDbName" \
+                       --outdir=/var/lib/l10nupdate/cache-${mwVerNum} $QUIET
                # Copy the LC files
                echo "Completed at `date --rfc-3339=seconds`. Copying LC files 
to $MW_COMMON_SOURCE"
                cp --preserve=timestamps --force 
/var/lib/l10nupdate/cache-"$mwVerNum"/l10n_cache-* 
$MW_COMMON_SOURCE/php-"$mwVerNum"/cache/l10n
diff --git a/manifests/misc/deployment.pp b/manifests/misc/deployment.pp
index 1f6a2ce..cd02fc4 100644
--- a/manifests/misc/deployment.pp
+++ b/manifests/misc/deployment.pp
@@ -273,7 +273,7 @@
        $scriptpath = "/usr/local/bin"
 
        cron { 'l10nupdate':
-               command => "${scriptpath}/l10nupdate-1 >> 
/var/log/l10nupdatelog/l10nupdate.log 2>&1",
+               command => "${scriptpath}/l10nupdate-1 --verbose >> 
/var/log/l10nupdatelog/l10nupdate.log 2>&1",
                user => 'l10nupdate',
                hour => 2,
                minute => 0,

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

Gerrit-MessageType: merged
Gerrit-Change-Id: If5ce751ba9d22c8584e942aae901c743911ebfe3
Gerrit-PatchSet: 2
Gerrit-Project: operations/puppet
Gerrit-Branch: production
Gerrit-Owner: BryanDavis <[email protected]>
Gerrit-Reviewer: Catrope <[email protected]>
Gerrit-Reviewer: Greg Grossmeier <[email protected]>
Gerrit-Reviewer: Ori.livneh <[email protected]>
Gerrit-Reviewer: Ottomata <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to