[evolvis-commits] r18483: almost no MW script should need LocalSettings preloading (Closes: #680165)

mirabilos at evolvis.org mirabilos at evolvis.org
Thu Jul 12 12:48:21 CEST 2012


Author: mirabilos
Date: 2012-07-12 12:48:21 +0200 (Thu, 12 Jul 2012)
New Revision: 18483

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/plugins/mediawiki/bin/mw-wrapper.php
Log:
almost no MW script should need LocalSettings preloading (Closes: #680165)

changes mw-wrapper to require -L to enable the preloading, for use with
maintenance scripts that don’t include commandLine.inc (or, rather, that
don’t honour the --conf option); all we call in FF do so this should work

Modified: trunk/gforge_base/evolvisforge-5.1/src/plugins/mediawiki/bin/mw-wrapper.php
===================================================================
--- trunk/gforge_base/evolvisforge-5.1/src/plugins/mediawiki/bin/mw-wrapper.php	2012-07-12 10:28:23 UTC (rev 18482)
+++ trunk/gforge_base/evolvisforge-5.1/src/plugins/mediawiki/bin/mw-wrapper.php	2012-07-12 10:48:21 UTC (rev 18483)
@@ -27,16 +27,30 @@
  * Wrapper to call MediaWiki maintenance scripts on a forge project wiki.
  */
 
-if (count ($argv) < 3) {
-        echo "Usage: .../mw-wrapper.php <project> <script> [ arguments... ]
+function usage($rv=1) {
+        echo "Usage: .../mw-wrapper.php [-L] <project> <script> [ arguments... ]
 For instance: .../mw-wrapper.php siteadmin importDump.php /tmp/wikidump.xml
               .../mw-wrapper.php siteadmin rebuildrecentchanges.php
 " ;
-        exit (1) ;
+        exit($rv);
 }
 
+if (count ($argv) < 3) {
+	usage();
+}
+
 $wrapperscript = array_shift ($argv) ;
 $fusionforgeproject = array_shift ($argv) ;
+if ($fusionforgeproject == "-L") {
+	$fusionforgeproject = array_shift($argv);
+	$preload_localsettings = true;
+} else {
+	/*
+	 * saves some warnings
+	 * works if the mwscript includes e.g. commandLine.inc
+	 */
+	$preload_localsettings = false;
+}
 $mwscript = array_shift ($argv) ;
 
 require_once dirname(__FILE__).'/../../../common/include/env.inc.php';
@@ -66,13 +80,16 @@
 register_shutdown_function('ffmw_wrapper_fixup_searchpath',
     forge_get_config('database_user'));
 
-define( "MEDIAWIKI", true );
-require_once $gfwww.'plugins/mediawiki/LocalSettings.php' ;
+$ff_localsettings = $gfwww . 'plugins/mediawiki/LocalSettings.php';
+if ($preload_localsettings) {
+	define("MEDIAWIKI", true);
+	require_once($ff_localsettings);
+}
 
 $src_path = forge_get_config('src_path', 'mediawiki');
 $mwscript = $src_path . '/maintenance/'.$mwscript ;
 
-array_unshift ($argv, $mwscript, '--conf', $fusionforge_basedir . '/plugins/mediawiki/www/LocalSettings.php') ;
+array_unshift($argv, $mwscript, '--conf', $ff_localsettings);
 
 while (@ob_end_flush());
 



More information about the evolvis-commits mailing list