From 7458dc32d99e6dd569b1629762443d074b6a3c52 Mon Sep 17 00:00:00 2001 From: Legoktm Date: Mon, 21 Jul 2014 08:31:09 +0000 Subject: [PATCH] Revert "Generalize Installer::showStatusMessage()" We probably want to put errors on top in the web installer and warnings on top in the CLI installer due to differences in scrolling. This reverts commit 1c1e321af7977722073116fb6846f494502f6805. Change-Id: I247030f0a3da6dff44884f4a282e52e92657fd91 --- includes/installer/CliInstaller.php | 13 +++++++++---- includes/installer/Installer.php | 11 ++--------- includes/installer/WebInstaller.php | 10 ++++++++++ 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/includes/installer/CliInstaller.php b/includes/installer/CliInstaller.php index c6939a81d4..1c7762b836 100644 --- a/includes/installer/CliInstaller.php +++ b/includes/installer/CliInstaller.php @@ -179,11 +179,16 @@ class CliInstaller extends Installer { public function showHelpBox( $msg /*, ... */ ) { } - /** - * @param Status $status - */ public function showStatusMessage( Status $status ) { - parent::showStatusMessage( $status ); + $warnings = array_merge( $status->getWarningsArray(), + $status->getErrorsArray() ); + + if ( count( $warnings ) !== 0 ) { + foreach ( $warnings as $w ) { + call_user_func_array( array( $this, 'showMessage' ), $w ); + } + } + if ( !$status->isOk() ) { echo "\n"; exit( 1 ); diff --git a/includes/installer/Installer.php b/includes/installer/Installer.php index 0294c4281e..3372119a4d 100644 --- a/includes/installer/Installer.php +++ b/includes/installer/Installer.php @@ -352,17 +352,10 @@ abstract class Installer { abstract public function showError( $msg /*, ... */ ); /** - * Shows messages to the user through a Status object + * Show a message to the installing user by using a Status object * @param Status $status */ - public function showStatusMessage( Status $status ) { - $errors = array_merge( $status->getErrorsArray(), $status->getWarningsArray() ); - if ( $errors ) { - foreach ( $errors as $error ) { - call_user_func( 'showMessage', $error ); - } - } - } + abstract public function showStatusMessage( Status $status ); /** * Constructor, always call this from child classes. diff --git a/includes/installer/WebInstaller.php b/includes/installer/WebInstaller.php index 3515469dcb..a6e9e33c8e 100644 --- a/includes/installer/WebInstaller.php +++ b/includes/installer/WebInstaller.php @@ -729,6 +729,16 @@ class WebInstaller extends Installer { $this->output->addHTML( $html ); } + /** + * @param Status $status + */ + public function showStatusMessage( Status $status ) { + $errors = array_merge( $status->getErrorsArray(), $status->getWarningsArray() ); + foreach ( $errors as $error ) { + call_user_func_array( array( $this, 'showMessage' ), $error ); + } + } + /** * Label a control by wrapping a config-input div around it and putting a * label before it. -- 2.20.1