diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2013-08-12 09:28:15 +0200 |
commit | 08aa4418c30cfc18ccc69a0f0f9cb9e17be6c196 (patch) | |
tree | 577a29fb579188d16003a209ce2a2e9c5b0aa2bd /maintenance/install.php | |
parent | cacc939b34e315b85e2d72997811eb6677996cc1 (diff) |
Update to MediaWiki 1.21.1
Diffstat (limited to 'maintenance/install.php')
-rw-r--r-- | maintenance/install.php | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/maintenance/install.php b/maintenance/install.php index 762bb94f..935a2966 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -22,9 +22,8 @@ */ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), '5.3.2' ) < 0 ) ) { - echo "You are using PHP version " . phpversion() . " but MediaWiki needs PHP 5.3.2 or higher. ABORTING.\n" . - "Check if you have a newer php executable with a different name, such as php5.\n"; - die( 1 ); + require_once( dirname( __FILE__ ) . '/../includes/PHPVersionError.php' ); + wfPHPVersionError( 'cli' ); } define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); @@ -45,7 +44,8 @@ class CommandLineInstaller extends Maintenance { $this->addArg( 'name', 'The name of the wiki', true); $this->addArg( 'admin', 'The username of the wiki administrator (WikiSysop)', true ); - $this->addOption( 'pass', 'The password for the wiki administrator.', true, true ); + $this->addOption( 'pass', 'The password for the wiki administrator.', false, true ); + $this->addOption( 'passfile', 'An alternative way to provide pass option, as the contents of this file', false, true ); /* $this->addOption( 'email', 'The email for the wiki administrator', false, true ); */ $this->addOption( 'scriptpath', 'The relative path of the wiki in the web server (/wiki)', false, true ); @@ -77,6 +77,9 @@ class CommandLineInstaller extends Maintenance { $dbpassfile = $this->getOption( 'dbpassfile', false ); if ( $dbpassfile !== false ) { + if ( $this->getOption( 'dbpass', false ) !== false ) { + $this->error( 'WARNING: You provide the options "dbpass" and "dbpassfile". The content of "dbpassfile" overwrites "dbpass".' ); + } wfSuppressWarnings(); $dbpass = file_get_contents( $dbpassfile ); wfRestoreWarnings(); @@ -86,6 +89,22 @@ class CommandLineInstaller extends Maintenance { $this->mOptions['dbpass'] = trim( $dbpass, "\r\n" ); } + $passfile = $this->getOption( 'passfile', false ); + if ( $passfile !== false ) { + if ( $this->getOption( 'pass', false ) !== false ) { + $this->error( 'WARNING: You provide the options "pass" and "passfile". The content of "passfile" overwrites "pass".' ); + } + wfSuppressWarnings(); + $pass = file_get_contents( $passfile ); + wfRestoreWarnings(); + if ( $pass === false ) { + $this->error( "Couldn't open $passfile", true ); + } + $this->mOptions['pass'] = str_replace( array( "\n", "\r" ), "", $pass ); + } elseif ( $this->getOption( 'pass', false ) === false ) { + $this->error( 'You need to provide the option "pass" or "passfile"', true ); + } + $installer = InstallerOverrides::getCliInstaller( $siteName, $adminName, $this->mOptions ); |