MediaWiki REL1_31
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}
35
37 public function __construct() {
38 // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
40
41 parent::__construct();
42 foreach ( $optionsWithArgs as $name ) {
43 $this->addOption( $name, '', false, true );
44 }
45 foreach ( $optionsWithoutArgs as $name ) {
46 $this->addOption( $name, '', false, false );
47 }
48 }
49
54 protected function maybeHelp( $force = false ) {
55 if ( !$force ) {
56 return;
57 }
58 parent::maybeHelp( true );
59 }
60
61 public function execute() {
62 // phpcs:ignore MediaWiki.NamingConventions.ValidGlobalName.wgPrefix
63 global $args, $options;
64
67 }
68}
69
70$maintClass = CommandLineInc::class;
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...
addOption( $name, $description, $required=false, $withArg=false, $shortName=false, $multiOccurrence=false)
Add a parameter to the script.
global $optionsWithArgs
$maintClass
global $optionsWithoutArgs
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped & $options
Definition hooks.txt:2001
require_once RUN_MAINTENANCE_IF_MAIN