4 * FusionForge/Mediawiki integration
6 * Copyright 2010, Roland Mas
8 * This file is part of FusionForge.
10 * FusionForge is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published
12 * by the Free Software Foundation; either version 2 of the License,
13 * or (at your option) any later version.
15 * FusionForge is distributed in the hope that it will be useful, but
16 * WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
18 * General Public License for more details.
20 * You should have received a copy of the GNU General Public License along
21 * with this program; if not, write to the Free Software Foundation, Inc.,
22 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
25 if (count ($argv) < 3) {
26 echo "Usage: .../mw-wrapper.php <project> <script> [ arguments... ]
27 For instance: .../mw-wrapper.php siteadmin importDump.php /tmp/wikidump.xml
28 .../mw-wrapper.php siteadmin rebuildrecentchanges.php
33 $wrapperscript = array_shift ($argv) ;
34 $fusionforgeproject = array_shift ($argv) ;
35 $mwscript = array_shift ($argv) ;
37 require_once dirname(__FILE__) . '/../../../www/env.inc.php';
38 require_once $gfcommon.'include/pre.php';
39 require_once $gfcommon.'include/cron_utils.php';
42 require_once($gfcommon.'include/Plugin.class.php');
43 require_once($gfcommon.'include/PluginManager.class.php');
45 setup_plugin_manager () ;
47 $group = group_get_object_by_name($fusionforgeproject) ;
48 if (!$group || $group->isError()) {
49 die ("Wrong group!\n") ;
52 if (!$group->usesPlugin('mediawiki')) {
53 die ("Project doesn't use the Mediawiki plugin\n") ;
57 define( "MEDIAWIKI", true );
58 require_once $gfwww.'plugins/mediawiki/LocalSettings.php' ;
60 $src_path = forge_get_config('src_path', 'mediawiki');
61 $mwscript = $src_path . '/maintenance/'.$mwscript ;
63 array_unshift ($argv, $mwscript, '--conf', $fusionforge_basedir . '/plugins/mediawiki/www/LocalSettings.php') ;
65 while (@ob_end_flush());
67 require_once $mwscript ;