http://www.mediawiki.org/wiki/Special:Code/MediaWiki/96032

Revision: 96032
Author:   aaron
Date:     2011-09-01 19:56:05 +0000 (Thu, 01 Sep 2011)
Log Message:
-----------
convenience script to run a script on all wikis on a dblist

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

Added: trunk/tools/mwmultiversion/scripts/mwscriptwikiset
===================================================================
--- trunk/tools/mwmultiversion/scripts/mwscriptwikiset                          
(rev 0)
+++ trunk/tools/mwmultiversion/scripts/mwscriptwikiset  2011-09-01 19:56:05 UTC 
(rev 96032)
@@ -0,0 +1,40 @@
+#!/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.
+# Note that this script prints some status info.
+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
+       echo "-------------------------------------"
+       echo "$DBNAME"
+       echo "-------------------------------------"
+       php /usr/local/apache/common-local/multiversion/MWScript.php 
"$SCRIPTFILE" "$DBNAME" "$SCRIPTARGS"
+       echo "-------------------------------------"
+       echo ""
+done
+


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


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

Reply via email to