MediaWiki REL1_34
commandLine.inc
Go to the documentation of this file.
1<?php
24require_once __DIR__ . '/Maintenance.php';
25
26// phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
28
29if ( !isset( $optionsWithArgs ) ) {
31}
32if ( !isset( $optionsWithoutArgs ) ) {
34}
35if ( !isset( $allowUnregisteredOptions ) ) {
37}
38
40 public function __construct() {
41 // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
43
44 parent::__construct();
45
46 foreach ( $optionsWithArgs as $name ) {
47 $this->addOption( $name, '', false, true );
48 }
49 foreach ( $optionsWithoutArgs as $name ) {
50 $this->addOption( $name, '', false, false );
51 }
52
53 $this->setAllowUnregisteredOptions( $allowUnregisteredOptions );
54 }
55
60 protected function maybeHelp( $force = false ) {
61 if ( !$force ) {
62 return;
63 }
64 parent::maybeHelp( true );
65 }
66
67 public function execute() {
68 // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
69 global $args, $options;
70
72 $options = $this->mOptions;
73 }
74}
75
76$maintClass = CommandLineInc::class;
const RUN_MAINTENANCE_IF_MAIN
if( $line===false) $args
Definition cdb.php:64
execute()
Do the actual work.
maybeHelp( $force=false)
No help, it would just be misleading since it misses custom options.
__construct()
Default constructor.
Abstract maintenance class for quickly writing and churning out maintenance scripts with minimal effo...
setAllowUnregisteredOptions( $allow)
Sets whether to allow unregistered options, which are options passed to a script that do not match an...
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
global $optionsWithArgs
$maintClass
global $allowUnregisteredOptions
global $optionsWithoutArgs