$this->setVar( 'wgSitename', $siteName );
if ( $admin ) {
$this->setVar( '_AdminName', $admin );
- } else {
- $this->setVar( '_AdminName',
- wfMsgForContent( 'config-admin-default-username' ) );
}
if ( !isset( $option['installdbuser'] ) ) {
/**
* Main entry point.
*/
- function execute( ) {
- foreach( $this->getInstallSteps() as $stepObj ) {
- $step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
- $this->showMessage( wfMsg( "config-install-$step") .
- wfMsg( 'ellipsis' ) . wfMsg( 'word-separator' ) );
- $func = 'install' . ucfirst( $step );
- $status = $this->{$func}();
- $warnings = $status->getWarningsArray();
- if ( !$status->isOk() ) {
- $this->showStatusMessage( $status );
- echo "\n";
- exit;
- } elseif ( count($warnings) !== 0 ) {
- foreach ( $status->getWikiTextArray( $warnings ) as $w ) {
- $this->showMessage( $w . wfMsg( 'ellipsis') .
- wfMsg( 'word-separator' ) );
- }
+ public function execute( ) {
+ $this->performInstallation(
+ array( $this, 'startStage'),
+ array( $this, 'endStage' )
+ );
+ }
+
+ public function startStage( $step ) {
+ $this->showMessage( wfMsg( "config-install-$step") .
+ wfMsg( 'ellipsis' ) . wfMsg( 'word-separator' ) );
+ }
+
+ public function endStage( $step, $status ) {
+ $warnings = $status->getWarningsArray();
+ if ( !$status->isOk() ) {
+ $this->showStatusMessage( $status );
+ echo "\n";
+ exit;
+ } elseif ( count($warnings) !== 0 ) {
+ foreach ( $status->getWikiTextArray( $warnings ) as $w ) {
+ $this->showMessage( $w . wfMsg( 'ellipsis') .
+ wfMsg( 'word-separator' ) );
}
- $this->showMessage( wfMsg( 'config-install-step-done' ) ."\n");
}
+ $this->showMessage( wfMsg( 'config-install-step-done' ) ."\n");
}
function showMessage( $msg /*, ... */ ) {
var $settings, $output;
/**
- * MediaWiki configuration globals that will eventually be passed through
- * to LocalSettings.php. The names only are given here, the defaults
+ * MediaWiki configuration globals that will eventually be passed through
+ * to LocalSettings.php. The names only are given here, the defaults
* typically come from DefaultSettings.php.
*/
protected $defaultVarNames = array(
'wgSitename',
'wgPasswordSender',
- 'wgLanguageCode',
+ 'wgLanguageCode',
'wgRightsIcon',
'wgRightsText',
'wgRightsUrl',
);
/**
- * Variables that are stored alongside globals, and are used for any
- * configuration of the installation process aside from the MediaWiki
+ * Variables that are stored alongside globals, and are used for any
+ * configuration of the installation process aside from the MediaWiki
* configuration. Map of names to defaults.
*/
protected $internalDefaults = array(
* Known database types. These correspond to the class names <type>Installer,
* and are also MediaWiki database types valid for $wgDBtype.
*
- * To add a new type, create a <type>Installer class and a Database<type>
+ * To add a new type, create a <type>Installer class and a Database<type>
* class, and add a config-type-<type> message to MessagesEn.php.
*/
private $dbTypes = array(
private $dbInstallers = array();
/**
- * A list of environment check methods called by doEnvironmentChecks().
- * These may output warnings using showMessage(), and/or abort the
+ * A list of environment check methods called by doEnvironmentChecks().
+ * These may output warnings using showMessage(), and/or abort the
* installation process by returning false.
*/
protected $envChecks = array(
'*' => array( 'edit' => false )
),
'fishbowl' => array(
- '*' => array(
+ '*' => array(
'createaccount' => false,
'edit' => false,
),
),
'cc-choose' => array(
// details will be filled in by the selector
- 'url' => '',
+ 'url' => '',
'icon' => '',
'text' => '',
),
/**
* UI interface for displaying a short message
* The parameters are like parameters to wfMsg().
- * The messages will be in wikitext format, which will be converted to an
+ * The messages will be in wikitext format, which will be converted to an
* output format such as HTML or text before being sent to the user.
*/
abstract function showMessage( $msg /*, ... */ );
}
/**
- * Do initial checks of the PHP environment. Set variables according to
+ * Do initial checks of the PHP environment. Set variables according to
* the observed environment.
*
* It's possible that this may be called under the CLI SAPI, not the SAPI
* that the wiki will primarily run under. In that case, the subclass should
* initialise variables such as wgScriptPath, before calling this function.
*
- * Under the web subclass, it can already be assumed that PHP 5+ is in use
+ * Under the web subclass, it can already be assumed that PHP 5+ is in use
* and that sessions are working.
*/
function doEnvironmentChecks() {
}
/**
- * Set a variable which stores a password, except if the new value is a
+ * Set a variable which stores a password, except if the new value is a
* fake password in which case leave it as it is.
*/
function setPassword( $name, $value ) {
$this->setVar( $name, $value );
}
}
-
+
/** Check if we're installing the latest version */
function envLatestVersion() {
global $wgVersion;
}
if( version_compare( $wgVersion, $currentVersion, '<' ) ) {
$this->showMessage( 'config-env-latest-old' );
- $this->showHelpBox( 'config-env-latest-help', $wgVersion, $currentVersion );
+ $this->showHelpBox( 'config-env-latest-help', $wgVersion, $currentVersion );
} elseif( version_compare( $wgVersion, $currentVersion, '>' ) ) {
$this->showMessage( 'config-env-latest-new' );
}
}
/**
- * Search a path for any of the given executable names. Returns the
- * executable name if found. Also checks the version string returned
+ * Search a path for any of the given executable names. Returns the
+ * executable name if found. Also checks the version string returned
* by each executable
*
* @param $path String: path to search
* @param $names Array of executable names
* @param $versionInfo Boolean false or array with two members:
- * 0 => Command to run for version check, with $1 for the path
- * 1 => String to compare the output with
+ * 0 => Command to run for version check, with $1 for the path
+ * 1 => String to compare the output with
*
- * If $versionInfo is not false, only executables with a version
+ * If $versionInfo is not false, only executables with a version
* matching $versionInfo[1] will be returned.
*/
function locateExecutable( $path, $names, $versionInfo = false ) {
$file = str_replace( '$1', $command, $versionInfo[0] );
# Should maybe be wfShellExec( $file), but runs into a ulimit, see
- # http://www.mediawiki.org/w/index.php?title=New-installer_issues&diff=prev&oldid=335456
+ # http://www.mediawiki.org/w/index.php?title=New-installer_issues&diff=prev&oldid=335456
if ( strstr( `$file`, $versionInfo[1]) !== false )
return $command;
}
# Give up
return true;
}
-
+
function envCheckUploadsDirectory() {
global $IP, $wgServer;
$dir = $IP . '/images/';
* Convert wikitext $text to HTML.
*
* This is potentially error prone since many parser features require a complete
- * installed MW database. The solution is to just not use those features when you
+ * installed MW database. The solution is to just not use those features when you
* write your messages. This appears to work well enough. Basic formatting and
* external links work just fine.
*
- * But in case a translator decides to throw in a #ifexist or internal link or
- * whatever, this function is guarded to catch attempted DB access and to present
+ * But in case a translator decides to throw in a #ifexist or internal link or
+ * whatever, this function is guarded to catch attempted DB access and to present
* some fallback text.
*
* @param $text String
*/
function docLink( $linkText, $attribs, $parser ) {
$url = $this->getDocUrl( $attribs['href'] );
- return '<a href="' . htmlspecialchars( $url ) . '">' .
- htmlspecialchars( $linkText ) .
+ return '<a href="' . htmlspecialchars( $url ) . '">' .
+ htmlspecialchars( $linkText ) .
'</a>';
}
wfSuppressWarnings();
$ls = file_exists( "$IP/LocalSettings.php" );
wfRestoreWarnings();
-
+
if( $ls ) {
if( $this->getDBInstaller()->needsUpgrade() ) {
$status->warning( 'config-localsettings-upgrade' );
}
/**
- * Add an installation step following the given step.
+ * Add an installation step following the given step.
* @param $findStep String the step to find. Use NULL to put the step at the beginning.
* @param $callback array
*/