Turn getStatusErrorBox() into getStatusBox() so it can handle warnings too
[lhc/web/wiklou.git] / includes / installer / WebInstaller.php
index 7d81de9..bbdbb7f 100644 (file)
@@ -271,9 +271,8 @@ class WebInstaller extends Installer {
 
        /**
         * Clean up from execute()
-        * @private.
         */
-       function finish() {
+       private function finish() {
                $this->output->output();
                $this->session['happyPages'] = $this->happyPages;
                $this->session['skippedPages'] = $this->skippedPages;
@@ -732,14 +731,21 @@ class WebInstaller extends Installer {
        }
 
        /**
-        * Output an error box using a Status object
+        * Output an error or warning box using a Status object
         */
-       function showStatusErrorBox( $status ) {
-               $text = $status->getWikiText();
-               $this->output->addHTML( $this->getErrorBox( $text ) );
+       function showStatusBox( $status ) {
+               if( !$status->isGood() ) {
+                       $text = $status->getWikiText();
+                       if( $status->isOk() ) {
+                               $box = $this->getWarningBox( $text );
+                       } else {
+                               $box = $this->getErrorBox( $text );
+                       }
+                       $this->output->addHTML( $box );
+               }
        }
 
-       function showStatusError( $status ) {
+       function showStatusMessage( $status ) {
                $text = $status->getWikiText();
                $this->output->addWikiText(
                        "<div class=\"config-message\">\n" .
@@ -986,7 +992,7 @@ class WebInstaller_DBConnect extends WebInstallerPage {
                                $this->setVar( '_UpgradeDone', false );
                                return 'continue';
                        } else {
-                               $this->parent->showStatusErrorBox( $status );
+                               $this->parent->showStatusBox( $status );
                        }
                }
 
@@ -1113,7 +1119,7 @@ class WebInstaller_DBSettings extends WebInstallerPage {
                        } elseif ( $status->isGood() ) {
                                return 'continue';
                        } else {
-                               $this->parent->showStatusErrorBox( $status );
+                               $this->parent->showStatusBox( $status );
                        }
                }
 
@@ -1406,8 +1412,7 @@ class WebInstaller_Options extends WebInstallerPage {
                        $this->parent->getFieldsetEnd()
                );
 
-               $caches = array( 'none', 'anything', 'db' );
-               $selected = 'db';
+               $caches = array( 'none' );
                if( count( $this->getVar( '_Caches' ) ) ) {
                        $caches[] = 'accel';
                        $selected = 'accel';
@@ -1572,13 +1577,25 @@ class WebInstaller_Install extends WebInstallerPage {
                }
                $this->startForm();
                $this->addHTML("<ul>");
-               foreach( $this->parent->getInstallSteps() as $step ) {
+               foreach( $this->parent->getInstallSteps() as $stepObj ) {
+                       $step = is_array( $stepObj ) ? $stepObj['name'] : $stepObj;
                        $this->startStage( "config-install-$step" );
-                       $func = 'install' . ucfirst( $step );
-                       $status = $this->parent->{$func}();
+                       $status = null;
+
+                       # Call our working function
+                       if ( is_array( $step ) ) {
+                               # A custom callaback
+                               $callback = $stepObj['callback'];
+                               $status = call_user_func_array( $callback, array() );
+                       } else {
+                               # Boring implicitly named callback
+                               $func = 'install' . ucfirst( $step );
+                               $status = $this->parent->{$func}();
+                       }
+
                        $ok = $status->isGood();
                        if ( !$ok ) {
-                               $this->parent->showStatusErrorBox( $status );
+                               $this->parent->showStatusBox( $status );
                        }
                        $this->endStage( $ok );
                }