mediawiki_arch/maintenance/CommandLineInc.php

77 lines
2.1 KiB
PHP
Raw Normal View History

2006-10-11 20:12:39 +02:00
<?php
/**
* Backwards-compatibility wrapper for old-style maintenance scripts.
*
* This program 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.
*
* This program 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.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @ingroup Maintenance
2006-10-11 20:12:39 +02:00
*/
2021-07-15 08:18:19 +02:00
// NO_AUTOLOAD -- unsafe file-scope code
2013-12-08 09:55:49 +01:00
require_once __DIR__ . '/Maintenance.php';
2006-10-11 20:12:39 +02:00
2019-02-10 10:16:47 +01:00
global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions;
2018-08-12 07:51:01 +02:00
2006-10-11 20:12:39 +02:00
if ( !isset( $optionsWithArgs ) ) {
2016-09-25 09:13:49 +02:00
$optionsWithArgs = [];
}
if ( !isset( $optionsWithoutArgs ) ) {
$optionsWithoutArgs = [];
2006-10-11 20:12:39 +02:00
}
2019-02-10 10:16:47 +01:00
if ( !isset( $allowUnregisteredOptions ) ) {
$allowUnregisteredOptions = false;
}
2006-10-11 20:12:39 +02:00
2010-07-28 11:52:48 +02:00
class CommandLineInc extends Maintenance {
public function __construct() {
2019-02-10 10:16:47 +01:00
global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions;
2018-08-12 07:51:01 +02:00
2010-07-28 11:52:48 +02:00
parent::__construct();
2019-02-10 10:16:47 +01:00
2010-07-28 11:52:48 +02:00
foreach ( $optionsWithArgs as $name ) {
$this->addOption( $name, '', false, true );
2006-10-11 20:12:39 +02:00
}
2016-09-25 09:13:49 +02:00
foreach ( $optionsWithoutArgs as $name ) {
$this->addOption( $name, '', false, false );
}
2019-02-10 10:16:47 +01:00
$this->setAllowUnregisteredOptions( $allowUnregisteredOptions );
2006-10-11 20:12:39 +02:00
}
2010-07-28 11:52:48 +02:00
/**
* No help, it would just be misleading since it misses custom options
2014-12-27 15:41:37 +01:00
* @param bool $force
2010-07-28 11:52:48 +02:00
*/
protected function maybeHelp( $force = false ) {
2012-05-03 13:01:35 +02:00
if ( !$force ) {
2010-07-28 11:52:48 +02:00
return;
2012-05-03 13:01:35 +02:00
}
2010-07-28 11:52:48 +02:00
parent::maybeHelp( true );
2006-10-11 20:12:39 +02:00
}
2010-07-28 11:52:48 +02:00
public function execute() {
global $args, $options;
2018-08-12 07:51:01 +02:00
2010-07-28 11:52:48 +02:00
$args = $this->mArgs;
$options = $this->mOptions;
2008-03-21 11:49:34 +01:00
}
}
2006-10-11 22:21:25 +02:00
2018-08-12 07:51:01 +02:00
$maintClass = CommandLineInc::class;
2021-07-15 08:18:19 +02:00
require_once RUN_MAINTENANCE_IF_MAIN;