Added release notes for 'ContentHandler::runLegacyHooks' removal
[mediawiki.git] / maintenance / runScript.php
blob385db157364d440336a93a73368608f850ad93ad
1 <?php
2 /**
3 * Convenience maintenance script wrapper, useful for scripts
4 * or extensions located outside of standard locations.
6 * To use, give the maintenance script as a relative or full path.
8 * Example usage:
10 * If your pwd is mediawiki base folder:
11 * php maintenance/runScript.php extensions/Wikibase/lib/maintenance/dispatchChanges.php
13 * If your pwd is maintenance folder:
14 * php runScript.php ../extensions/Wikibase/lib/maintenance/dispatchChanges.php
16 * Or full path:
17 * php /var/www/mediawiki/maintenance/runScript.php maintenance/runJobs.php
19 * This program is free software; you can redistribute it and/or modify
20 * it under the terms of the GNU General Public License as published by
21 * the Free Software Foundation; either version 2 of the License, or
22 * (at your option) any later version.
24 * This program is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
27 * GNU General Public License for more details.
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
32 * http://www.gnu.org/copyleft/gpl.html
34 * @author Katie Filbert < aude.wiki@gmail.com >
35 * @file
36 * @ingroup Maintenance
38 $IP = getenv( 'MW_INSTALL_PATH' );
40 if ( $IP === false ) {
41 $IP = dirname( __DIR__ );
43 putenv( "MW_INSTALL_PATH=$IP" );
46 require_once "$IP/maintenance/Maintenance.php";
48 if ( !isset( $argv[1] ) ) {
49 fwrite( STDERR, "This script requires a maintainance script as an argument.\n"
50 . "Usage: runScript.php extensions/Wikibase/lib/maintenance/dispatchChanges\n" );
51 exit( 1 );
54 $scriptFilename = $argv[1];
55 array_shift( $argv );
57 $scriptFile = realpath( $scriptFilename );
59 if ( !$scriptFile ) {
60 fwrite( STDERR, "The MediaWiki script file \"{$scriptFilename}\" does not exist.\n" );
61 exit( 1 );
64 require_once $scriptFile;