define( 'DO_MAINTENANCE', dirname( __FILE__ ) . '/doMaintenance.php' );
$maintClass = false;
+function wfRunMaintenance( $class ) {
+ $maintClass = $class;
+ require_once( DO_MAINTENANCE );
+}
+
// Make sure we're on PHP5 or better
if ( version_compare( PHP_VERSION, '5.0.0' ) < 0 ) {
die ( "Sorry! This version of MediaWiki requires PHP 5; you are running " .
global $IP, $wgCommandLineMode, $wgRequestTime;
# Abort if called from a web server
- if ( isset( $_SERVER ) && array_key_exists( 'REQUEST_METHOD', $_SERVER ) ) {
+ if ( isset( $_SERVER ) && isset( $_SERVER['REQUEST_METHOD'] ) ) {
$this->error( 'This script must be run from the command line', true );
}
--- /dev/null
+<?php
+
+/**
+ * To the extent possible under law, I, Mark Hershberger, have waived all copyright and
+ * related or neighboring rights to Hello World. This work is published from United States.
+ * @copyright CC0 http://creativecommons.org/publicdomain/zero/1.0/
+ * @author Mark A. Hershberger <mah@everybody.org>
+ * @ingroup Maintenance
+ */
+
+require_once( dirname( __FILE__ ) . "/Maintenance.php" );
+
+class CommandLineInstaller extends Maintenance {
+
+ public function __construct() {
+ parent::__construct();
+
+ $this->addOption( 'name', 'Who to say Hello to', false, true);
+ }
+
+ public function execute() {
+ $name = $this->getOption( 'name', 'World' );
+ echo "Hello, $name!\n";
+ }
+}
+
+wfRunMaintenance( "CommandLineInstaller" );
+