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 * @license GPL-2.0-or-later
6 * @file
7 * @ingroup Maintenance
8 */
9
10use MediaWiki\Maintenance\Maintenance;
11
12// NO_AUTOLOAD -- unsafe file-scope code
13
14require_once __DIR__ . '/Maintenance.php';
15
16global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions;
17
18if ( !isset( $optionsWithArgs ) ) {
19    $optionsWithArgs = [];
20}
21if ( !isset( $optionsWithoutArgs ) ) {
22    $optionsWithoutArgs = [];
23}
24if ( !isset( $allowUnregisteredOptions ) ) {
25    $allowUnregisteredOptions = false;
26}
27
28class CommandLineInc extends Maintenance {
29    public function __construct() {
30        global $optionsWithArgs, $optionsWithoutArgs, $allowUnregisteredOptions;
31
32        parent::__construct();
33
34        foreach ( $optionsWithArgs as $name ) {
35            $this->addOption( $name, '', false, true );
36        }
37        foreach ( $optionsWithoutArgs as $name ) {
38            $this->addOption( $name, '', false, false );
39        }
40
41        $this->setAllowUnregisteredOptions( $allowUnregisteredOptions );
42    }
43
44    /**
45     * No help, it would just be misleading since it misses custom options
46     * @param bool $force
47     */
48    protected function maybeHelp( $force = false ) {
49        if ( !$force ) {
50            return;
51        }
52        parent::maybeHelp( true );
53    }
54
55    public function execute() {
56        global $args, $options;
57
58        $args = $this->parameters->getArgs();
59        $options = $this->parameters->getOptions();
60    }
61}
62
63// @codeCoverageIgnoreStart
64$maintClass = CommandLineInc::class;
65require_once RUN_MAINTENANCE_IF_MAIN;
66// @codeCoverageIgnoreEnd