$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 );
$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();
$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 );