* remove bogus outputFooter call
authorMark A. Hershberger <mah@users.mediawiki.org>
Tue, 29 Jun 2010 02:46:11 +0000 (02:46 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Tue, 29 Jun 2010 02:46:11 +0000 (02:46 +0000)
* strip tags + de-code entities before outputing messages to CLI (need an un-wiki call)
* Make LocalSettings::writeLocalSettings return a Status object instead of true/false so we can use the text in out cli output.

includes/installer/CliInstallerOutput.php
includes/installer/Installer.i18n.php
includes/installer/Installer.php
includes/installer/LocalSettingsGenerator.php

index 55c239c..40cfe03 100644 (file)
@@ -45,14 +45,13 @@ class CliInstallerOutput {
 
        function output() {
                $this->flush();
-               $this->outputFooter();
        }
 
        function useShortHeader( $use = true ) {
        }
 
        function flush() {
-               echo $this->contents;
+               echo html_entity_decode( strip_tags( $this->contents ), ENT_QUOTES );
                flush();
                $this->contents = '';
        }
@@ -77,7 +76,4 @@ class CliInstallerOutput {
                $this->addHTML( $this->warnings );
                $this->warnings = '';
        }
-
-       function outputFooter() {}
-
 }
index 4ea47d8..d624532 100644 (file)
@@ -430,7 +430,11 @@ Consider changing it manually.",
        '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.
 
index 38ecde1..613c304 100644 (file)
@@ -908,15 +908,7 @@ abstract class Installer {
 
        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();
        }
 
        /**
index ce41160..aae9aad 100644 (file)
@@ -15,7 +15,7 @@ class LocalSettingsGenerator {
                $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',
@@ -58,11 +58,11 @@ class LocalSettingsGenerator {
        }
 
        /**
-        * 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";
@@ -70,18 +70,30 @@ class LocalSettingsGenerator {
                                $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 ) {