* Eliminate CLIInstallerOutput per r68645 since, yes, it wasn't needed.
authorMark A. Hershberger <mah@users.mediawiki.org>
Fri, 2 Jul 2010 21:15:13 +0000 (21:15 +0000)
committerMark A. Hershberger <mah@users.mediawiki.org>
Fri, 2 Jul 2010 21:15:13 +0000 (21:15 +0000)
* Make sure output only happens in the top-level Installer implementations.
* Differentiate Status warning messages from Status error messages in the Installer.
* Change abstract method from Install::showStatusError() to Install::showStatusMessage() since we'll use it to show warnings now, too.
* TODO Need a better way to extract/display Status warning messages since, from my look at the Status class, it looks like warnings are implemented, but not really used.

includes/AutoLoader.php
includes/installer/CliInstaller.php
includes/installer/Installer.php
includes/installer/SqliteInstaller.php
includes/installer/WebInstaller.php

index 6571c9e..b4ae511 100644 (file)
@@ -414,7 +414,6 @@ $wgAutoloadLocalClasses = array(
 
        # includes/installer
        'CliInstaller' => 'includes/installer/CliInstaller.php',
-       'CliInstallerOutput' => 'includes/installer/CliInstallerOutput.php',
        'Installer' => 'includes/installer/Installer.php',
        'InstallerDBType' => 'includes/installer/InstallerDBType.php',
        'LBFactory_InstallerFake' => 'includes/installer/Installer.php',
index 2e1ecd1..9952f46 100644 (file)
@@ -62,8 +62,6 @@ class CliInstaller extends Installer {
                if ( isset( $option['pass'] ) ) {
                        $this->setVar( '_AdminPassword', $option['pass'] );
                }
-
-               $this->output = new CliInstallerOutput( $this );
        }
 
        /**
@@ -74,22 +72,23 @@ class CliInstaller extends Installer {
                        $this->showMessage("Installing $step... ");
                        $func = 'install' . ucfirst( $step );
                        $status = $this->{$func}();
-                       $ok = $status->isGood();
-                       if ( !$ok ) {
-                               $this->showStatusError( $status );
+                       if ( !$status->isOk() ) {
+                               $this->showStatusMessage( $status );
                                exit;
+                       } elseif ( !$status->isGood() ) {
+                               $this->showStatusMessage( $status );
                        }
                        $this->showMessage("done\n");
                }
        }
 
        function showMessage( $msg /*, ... */ ) {
-               $this->output->addHTML($msg);
-               $this->output->output();
+               echo html_entity_decode( strip_tags( $msg ), ENT_QUOTES );
+               flush();
        }
 
-       function showStatusError( $status ) {
-               $this->output->addHTML($status->getWikiText()."\n");
-               $this->output->flush();
+       function showStatusMessage( $status ) {
+               $this->showMessage( $status->getWikiText() );
        }
+
 }
index 8a3ab4e..0380442 100644 (file)
@@ -260,7 +260,7 @@ abstract class Installer {
         */
        abstract function showMessage( $msg /*, ... */ );
 
-       abstract function showStatusError( $status );
+       abstract function showStatusMessage( $status );
 
        /**
         * Get a list of known DB types
@@ -869,7 +869,7 @@ abstract class Installer {
        public function installTables() {
                $installer = $this->getDBInstaller();
                $status = $installer->createTables();
-               if( $status->isGood() ) {
+               if( $status->isOK() ) {
                        LBFactory::enableBackend();
                }
                return $status;
@@ -888,6 +888,9 @@ abstract class Installer {
                        $file = fopen( "/dev/urandom", "r" );
                        wfRestoreWarnings();
                }
+
+               $status = Status::newGood();
+
                if ( $file ) {
                        $secretKey = bin2hex( fread( $file, 32 ) );
                        fclose( $file );
@@ -896,10 +899,11 @@ abstract class Installer {
                        for ( $i=0; $i<8; $i++ ) {
                                $secretKey .= dechex(mt_rand(0, 0x7fffffff));
                        }
-                       $this->output->addWarningMsg( 'config-insecure-secretkey' );
+                       $status->warning( 'config-insecure-secretkey' );
                }
                $this->setVar( 'wgSecretKey', $secretKey );
-               return Status::newGood();
+
+               return $status;
        }
 
        public function installSysop() {
index c6ac201..1f77906 100644 (file)
@@ -158,31 +158,27 @@ class SqliteInstaller extends InstallerDBType {
                        //@todo or...?
                        $this->db->reportQueryError( $err, 0, $sql, __FUNCTION__ );
                }
-               $this->setupSearchIndex();
-               // Create default interwikis
-               return Status::newGood();
+               return $this->setupSearchIndex();
        }
 
        function setupSearchIndex() {
                global $IP;
 
+               $status = Status::newGood();
+
                $module = $this->db->getFulltextSearchModule();
                $fts3tTable = $this->db->checkForEnabledSearch();
                if ( $fts3tTable &&  !$module ) {
-                       $this->parent->output->addHtml
-                               ( wfMsgHtml( 'word-separator' ) . wfMsgHtml( 'config-sqlite-fts3-downgrade' ) . wfMsgHtml( 'ellipsis' ) );
-                       $this->parent->output->flush();
+                       $status->warning( 'config-sqlite-fts3-downgrade' );
                        $this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-no-fts.sql" );
                } elseif ( !$fts3tTable && $module == 'FTS3' ) {
-                       $this->parent->output->addHtml
-                               ( wfMsgHtml( 'word-separator' ) . wfMsgHtml( 'config-sqlite-fts3-add' ) . wfMsg( 'ellipsis' ) );
-                       $this->parent->output->flush();
+                       $status->warning( 'config-sqlite-fts3-add' );
                        $this->db->sourceFile( "$IP/maintenance/sqlite/archives/searchindex-fts3.sql" );
                } else {
-                       $this->parent->output->addHtml
-                               ( wfMsgHtml( 'word-separator' ) . wfMsgHtml( 'config-sqlite-fts3-ok' ) . wfMsgHtml( 'ellipsis' ) );
-                       $this->parent->output->flush();
+                       $status->warning( 'config-sqlite-fts3-ok' );
                }
+
+               return $status;
        }
 
        function doUpgrade() {
index 5b17d0b..f5ada78 100644 (file)
@@ -739,7 +739,7 @@ class WebInstaller extends Installer {
                $this->output->addHTML( $this->getErrorBox( $text ) );
        }
 
-       function showStatusError( $status ) {
+       function showStatusMessage( $status ) {
                $text = $status->getWikiText();
                $this->output->addWikiText(
                        "<div class=\"config-message\">\n" .