https://www.mediawiki.org/wiki/Special:Code/MediaWiki/114996

Revision: 114996
Author:   aaron
Date:     2012-04-20 21:07:47 +0000 (Fri, 20 Apr 2012)
Log Message:
-----------
Added mwscriptwikiset-quite, based on mwscriptwikiset-short on /home.

Added Paths:
-----------
    trunk/tools/mwmultiversion/scripts/mwscriptwikiset-quite

Added: trunk/tools/mwmultiversion/scripts/mwscriptwikiset-quite
===================================================================
--- trunk/tools/mwmultiversion/scripts/mwscriptwikiset-quite                    
        (rev 0)
+++ trunk/tools/mwmultiversion/scripts/mwscriptwikiset-quite    2012-04-20 
21:07:47 UTC (rev 114996)
@@ -0,0 +1,44 @@
+#!/bin/bash
+# Shell wrapper for the local version of multiversion/MWScript.php.
+# This script belongs in /usr/bin/ and should be in PATH.
+# Unlike mwscript, the takes a dblist filename as the second argument
+# and runs the maintenance script on each of the wikis in the list.
+# This only prints information for wikis thas that the script gives
+# a non-empty result for via STD_OUT.
+COMMONDIR=/usr/local/apache/common-local
+
+SCRIPTFILE=$1
+LISTFILE=$2
+
+# Check that dblist is given and actually exists...
+if [ $# -lt 2 ]; then
+       echo 'Usage: mwscriptwikiset <script path> <filename.dblist> [script 
args]'
+       echo 'Note: No --wiki option or equivalent argument should be given'
+       exit 1
+fi
+
+if [ ! -f $COMMONDIR/$LISTFILE ]; then
+       echo "The specified dblist file, $COMMONDIR/$LISTFILE, could not be 
found."
+       exit 1
+fi
+
+# Get the arguments to the actual script file
+SCRIPTARGS=("$@")
+unset SCRIPTARGS[0] # script path
+unset SCRIPTARGS[1] # dblist file name
+SCRIPTARGS="${SCRIPTARGS[@]}"
+
+# Run the script on all wikis in the dblist                                    
                                                                  
+for DBNAME in $(cat $COMMONDIR/$LISTFILE)                                      
                                                                  
+do                                                                             
                                                                  
+       RES=$(php /home/wikipedia/common/multiversion/MWScript.php 
"$SCRIPTFILE" "$DBNAME" $SCRIPTARGS)                                        
+       if [ -n "$RES" ]; then                                                  
                                                                 
+               echo "-------------------------------------"                    
                                                                 
+               echo "$DBNAME"                                                  
                                                                 
+               echo "-------------------------------------"                    
                                                                 
+               echo "$RES"                                                     
                                                                 
+               echo "-------------------------------------"                    
                                                                 
+               echo ""                                                         
                                                                 
+       fi                                                                      
                                                                 
+done
+


Property changes on: trunk/tools/mwmultiversion/scripts/mwscriptwikiset-quite
___________________________________________________________________
Added: svn:executable
   + *


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

Reply via email to