'config-install-sysop' => 'Creating administrator user account',
'config-install-localsettings' => 'Creating LocalSettings.php',
'config-install-localsettings-unwritable' => 'Warning: Could not write <code>LocalSettings.php</code>.
-Create it yourself, using the following text:',
+Create it yourself, using the following text:
+<textarea name="LocalSettings" id="LocalSettings" cols="80" rows="25" readonly="readonly">
+$1
+</textarea>
+',
'config-install-done' => "'''Congratulations!'''
You have successfully installed MediaWiki.
public function installLocalsettings() {
$localSettings = new LocalSettingsGenerator( $this );
- $ok = $localSettings->writeLocalSettings();
-
- # TODO: Make writeLocalSettings() itself not warn, but instead return
- # a Status object to us to pass along.
- if ( $ok ) {
- return Status::newGood();
- } else {
- return Status::newFatal();
- }
+ return $localSettings->writeLocalSettings();
}
/**
$this->configPath = $installer->getVar( 'IP' ) . '/config';
$this->extensions = $installer->getVar( '_Extensions' );
$db = $installer->getDBInstaller( $installer->getVar( 'wgDBtype' ) );
-
+
$confItems = array_merge( array( 'wgScriptPath', 'wgScriptExtension',
'wgPasswordSender', 'wgImageMagickConvertCommand', 'wgShellLocale',
'wgLanguageCode', 'wgEnableEmail', 'wgEnableUserEmail', 'wgDiff3',
}
/**
- * Write the file
- * @param $secretKey String A random string to
- * @return boolean On successful file write
+ * Return the full text of the generated LocalSettings.php file,
+ * including the extensions
+ * @returns String
*/
- public function writeLocalSettings() {
+ public function getText() {
$localSettings = $this->getDefaultText();
if( count( $this->extensions ) ) {
$localSettings .= "\n# The following extensions were automatically enabled:\n";
$localSettings .= "require( 'extensions/$ext/$ext.php' );\n";
}
}
+
+ return $localSettings;
+ }
+
+ /**
+ * Write the file
+ * @param $secretKey String A random string to
+ * @return boolean On successful file write
+ */
+ public function writeLocalSettings() {
+ $localSettings = $this->getText();
wfSuppressWarnings();
$ret = file_put_contents( $this->configPath . '/LocalSettings.php', $localSettings );
wfRestoreWarnings();
+
+ $status = Status::newGood();
+
if ( !$ret ) {
- $warn = wfMsg( 'config-install-localsettings-unwritable' ) . '
-<textarea name="LocalSettings" id="LocalSettings" cols="80" rows="25" readonly="readonly">'
- . htmlspecialchars( $localSettings ) . '</textarea>';
- $this->installer->output->addWarning( $warn );
+ $status->fatal( 'config-install-localsettings-unwritable', $localSettings );
}
- return $ret;
+
+ return $status;
}
-
+
private function buildMemcachedServerList() {
$servers = $this->values['_MemCachedServers'];
if( !$servers ) {