[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/maintenance/ -> runScript.php (source)

   1  <?php
   2  /**
   3   * Convenience maintenance script wrapper, useful for scripts
   4   * or extensions located outside of standard locations.
   5   *
   6   * To use, give the maintenance script as a relative or full path.
   7   *
   8   * Example usage:
   9   *
  10   *  If your pwd is mediawiki base folder:
  11   *   php maintenance/runScript.php extensions/Wikibase/lib/maintenance/dispatchChanges.php
  12   *
  13   * If your pwd is maintenance folder:
  14   *  php runScript.php ../extensions/Wikibase/lib/maintenance/dispatchChanges.php
  15   *
  16   * Or full path:
  17   *  php /var/www/mediawiki/maintenance/runScript.php maintenance/runJobs.php
  18   *
  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.
  23   *
  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.
  28   *
  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
  33   *
  34   * @author Katie Filbert < [email protected] >
  35   * @file
  36   * @ingroup Maintenance
  37   */
  38  $IP = getenv( 'MW_INSTALL_PATH' );
  39  
  40  if ( $IP === false ) {
  41      $IP = dirname( __DIR__ );
  42  
  43      putenv( "MW_INSTALL_PATH=$IP" );
  44  }
  45  
  46  require_once "$IP/maintenance/Maintenance.php";
  47  
  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 );
  52  }
  53  
  54  $scriptFilename = $argv[1];
  55  array_shift( $argv );
  56  
  57  $scriptFile = realpath( $scriptFilename );
  58  
  59  if ( !$scriptFile ) {
  60      fwrite( STDERR, "The MediaWiki script file \"{$scriptFilename}\" does not exist.\n" );
  61      exit( 1 );
  62  }
  63  
  64  require_once $scriptFile;


Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1