Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
0.00% covered (danger)
0.00%
0 / 21
0.00% covered (danger)
0.00%
0 / 3
CRAP
0.00% covered (danger)
0.00%
0 / 1
CommandLineInc
0.00% covered (danger)
0.00%
0 / 13
0.00% covered (danger)
0.00%
0 / 3
42
0.00% covered (danger)
0.00%
0 / 1
 __construct
0.00% covered (danger)
0.00%
0 / 7
0.00% covered (danger)
0.00%
0 / 1
12
 maybeHelp
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
6
 execute
0.00% covered (danger)
0.00%
0 / 3
0.00% covered (danger)
0.00%
0 / 1
2
1<?php
2/**
3 * Backwards-compatibility wrapper for old-style maintenance scripts.
4 *
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 *
15 * You should have received a copy of the GNU General Public License along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * http://www.gnu.org/copyleft/gpl.html
19 *
20 * @file
21 * @ingroup Maintenance
22 */
23
24use MediaWiki\Maintenance\Maintenance;
25
26// NO_AUTOLOAD -- unsafe file-scope code
27
28require_once __DIR__ . '/Maintenance.php';
29
30global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions;
31
32if ( !isset( $optionsWithArgs ) ) {
33    $optionsWithArgs = [];
34}
35if ( !isset( $optionsWithoutArgs ) ) {
36    $optionsWithoutArgs = [];
37}
38if ( !isset( $allowUnregisteredOptions ) ) {
39    $allowUnregisteredOptions = false;
40}
41
42class CommandLineInc extends Maintenance {
43    public function __construct() {
44        global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions;
45
46        parent::__construct();
47
48        foreach ( $optionsWithArgs as $name ) {
49            $this->addOption( $name, '', false, true );
50        }
51        foreach ( $optionsWithoutArgs as $name ) {
52            $this->addOption( $name, '', false, false );
53        }
54
55        $this->setAllowUnregisteredOptions( $allowUnregisteredOptions );
56    }
57
58    /**
59     * No help, it would just be misleading since it misses custom options
60     * @param bool $force
61     */
62    protected function maybeHelp( $force = false ) {
63        if ( !$force ) {
64            return;
65        }
66        parent::maybeHelp( true );
67    }
68
69    public function execute() {
70        global $args, $options;
71
72        $args = $this->parameters->getArgs();
73        $options = $this->parameters->getOptions();
74    }
75}
76
77// @codeCoverageIgnoreStart
78$maintClass = CommandLineInc::class;
79require_once RUN_MAINTENANCE_IF_MAIN;
80// @codeCoverageIgnoreEnd