[evolvis-commits] r18441: FF r15621 – fix up the schema search path of the gforge user after running any MW script

mirabilos at evolvis.org mirabilos at evolvis.org
Wed May 30 17:55:43 CEST 2012


Author: mirabilos
Date: 2012-05-30 17:55:43 +0200 (Wed, 30 May 2012)
New Revision: 18441

Modified:
   trunk/gforge_base/evolvisforge-5.1/src/plugins/mediawiki/bin/mw-wrapper.php
Log:
FF r15621 – fix up the schema search path of the gforge user after running any MW script

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-05-30 15:55:39 UTC (rev 18440)
+++ trunk/gforge_base/evolvisforge-5.1/src/plugins/mediawiki/bin/mw-wrapper.php	2012-05-30 15:55:43 UTC (rev 18441)
@@ -1,25 +1,30 @@
 #! /usr/bin/php -f
 <?php
-/**
+/*-
  * FusionForge/Mediawiki integration
  *
- * Copyright 2010, Roland Mas
+ * Copyright © 2010
+ *	Roland Mas
+ * Copyright © 2012
+ *	Thorsten Glaser <t.glaser at tarent.de>
+ * All rights reserved.
  *
- * This file is part of FusionForge.
+ * This file is part of FusionForge. FusionForge is free software;
+ * you can redistribute it and/or modify it under the terms of the
+ * GNU General Public License as published by the Free Software
+ * Foundation; either version 2 of the Licence, or (at your option)
+ * any later version.
  *
- * FusionForge is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published
- * by the Free Software Foundation; either version 2 of the License,
- * or (at your option) any later version.
- * 
- * FusionForge is distributed in the hope that it will be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- * General Public License for more details.
+ * FusionForge is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
  *
  * You should have received a copy of the GNU General Public License along
- * with this program; if not, write to the Free Software Foundation, Inc.,
+ * with FusionForge; if not, write to the Free Software Foundation, Inc.,
  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ *-
+ * Wrapper to call MediaWiki maintenance scripts on a forge project wiki.
  */
 
 if (count ($argv) < 3) {
@@ -34,7 +39,7 @@
 $fusionforgeproject = array_shift ($argv) ;
 $mwscript = array_shift ($argv) ;
 
-require dirname(__FILE__).'/../../../common/include/env.inc.php';
+require_once dirname(__FILE__).'/../../../common/include/env.inc.php';
 require_once $gfcommon.'include/pre.php';
 require_once $gfcommon.'include/cron_utils.php';
 
@@ -46,13 +51,20 @@
 
 $group = group_get_object_by_name($fusionforgeproject) ;
 if (!$group || $group->isError()) {
-	die("Wrong group! " . $group->getErrorMessage() . "\n");
+	die("Wrong group! " .
+	    ($group ? $group->getErrorMessage() : "") . "\n");
 }
 
 if (!$group->usesPlugin('mediawiki')) {
 	die ("Project doesn't use the Mediawiki plugin\n") ;
 }
 
+function ffmw_wrapper_fixup_searchpath($username) {
+	db_query_params("ALTER ROLE $username SET search_path = public",
+	    array());
+}
+register_shutdown_function('ffmw_wrapper_fixup_searchpath',
+    forge_get_config('database_user'));
 
 define( "MEDIAWIKI", true );
 require_once $gfwww.'plugins/mediawiki/LocalSettings.php' ;
@@ -65,5 +77,3 @@
 while (@ob_end_flush());
 
 require_once $mwscript ;
-
-?>



More information about the evolvis-commits mailing list