X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=maintenance%2Finstall.php;h=39e613f37fbc9ec764627dcb05de9b18b287b2d0;hb=8d6995937f9a058a539405c195de58122b3e143d;hp=6339773aa283c1b7a2b6f0dd5ab4b61484c23c1d;hpb=392af46809d831514f49618cdef1e1529d7fddf4;p=lhc%2Fweb%2Fwiklou.git diff --git a/maintenance/install.php b/maintenance/install.php index 6339773aa2..39e613f37f 100644 --- a/maintenance/install.php +++ b/maintenance/install.php @@ -30,7 +30,7 @@ if ( !function_exists( 'version_compare' ) || ( version_compare( phpversion(), ' define( 'MW_CONFIG_CALLBACK', 'Installer::overrideConfig' ); define( 'MEDIAWIKI_INSTALL', true ); -require_once( dirname( dirname( __FILE__ ) )."/maintenance/Maintenance.php" ); +require_once( dirname( __DIR__ )."/maintenance/Maintenance.php" ); /** * Maintenance script to install and configure MediaWiki @@ -45,7 +45,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 +78,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 +90,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 );