function execute() { global $IP, $wgTitle; $siteName = isset($this->mArgs[0]) ? $this->mArgs[0] : "Don't care"; // Will not be set if used with --env-checks $adminName = isset($this->mArgs[1]) ? $this->mArgs[1] : null; $wgTitle = Title::newFromText('Installer script'); $dbpassfile = $this->getOption('dbpassfile', false); if ($dbpassfile !== false) { wfSuppressWarnings(); $dbpass = file_get_contents($dbpassfile); wfRestoreWarnings(); if ($dbpass === false) { $this->error("Couldn't open {$dbpassfile}", true); } $this->mOptions['dbpass'] = trim($dbpass, "\r\n"); } $installer = InstallerOverrides::getCliInstaller($siteName, $adminName, $this->mOptions); $status = $installer->doEnvironmentChecks(); if ($status->isGood()) { $installer->showMessage('config-env-good'); } else { $installer->showStatusMessage($status); return; } if (!$this->hasOption('env-checks')) { $installer->execute(); $installer->writeConfigurationFile($this->getOption('confpath', $IP)); } }
function execute() { global $IP, $wgTitle; $siteName = isset($this->mArgs[0]) ? $this->mArgs[0] : "Don't care"; // Will not be set if used with --env-checks $adminName = isset($this->mArgs[1]) ? $this->mArgs[1] : null; $wgTitle = Title::newFromText('Installer script'); $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(); if ($dbpass === false) { $this->error("Couldn't open {$dbpassfile}", true); } $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); $status = $installer->doEnvironmentChecks(); if ($status->isGood()) { $installer->showMessage('config-env-good'); } else { $installer->showStatusMessage($status); return; } if (!$this->hasOption('env-checks')) { $installer->execute(); $installer->writeConfigurationFile($this->getOption('confpath', $IP)); } }
function execute() { global $IP; $siteName = $this->getArg(0, 'MediaWiki'); // Will not be set if used with --env-checks $adminName = $this->getArg(1); $dbpassfile = $this->getOption('dbpassfile'); if ($dbpassfile !== null) { if ($this->getOption('dbpass') !== null) { $this->error('WARNING: You have provided the options "dbpass" and "dbpassfile". ' . 'The content of "dbpassfile" overrides "dbpass".'); } MediaWiki\suppressWarnings(); $dbpass = file_get_contents($dbpassfile); // returns false on failure MediaWiki\restoreWarnings(); if ($dbpass === false) { $this->error("Couldn't open {$dbpassfile}", true); } $this->mOptions['dbpass'] = trim($dbpass, "\r\n"); } $passfile = $this->getOption('passfile'); if ($passfile !== null) { if ($this->getOption('pass') !== null) { $this->error('WARNING: You have provided the options "pass" and "passfile". ' . 'The content of "passfile" overrides "pass".'); } MediaWiki\suppressWarnings(); $pass = file_get_contents($passfile); // returns false on failure MediaWiki\restoreWarnings(); if ($pass === false) { $this->error("Couldn't open {$passfile}", true); } $this->mOptions['pass'] = trim($pass, "\r\n"); } elseif ($this->getOption('pass') === null) { $this->error('You need to provide the option "pass" or "passfile"', true); } $installer = InstallerOverrides::getCliInstaller($siteName, $adminName, $this->mOptions); $status = $installer->doEnvironmentChecks(); if ($status->isGood()) { $installer->showMessage('config-env-good'); } else { $installer->showStatusMessage($status); return; } if (!$this->hasOption('env-checks')) { $installer->execute(); $installer->writeConfigurationFile($this->getOption('confpath', $IP)); } }