Index: branches/new-installer/phase3/includes/installer/WebInstaller.php |
— | — | @@ -1570,8 +1570,12 @@ |
1571 | 1571 | foreach( $this->parent->getInstallSteps() as $step ) { |
1572 | 1572 | $this->startStage( "config-install-$step" ); |
1573 | 1573 | $func = 'install' . ucfirst( $step ); |
1574 | | - $success = $this->parent->{$func}(); |
1575 | | - $this->endStage( $success ); |
| 1574 | + $status = $this->parent->{$func}(); |
| 1575 | + $ok = $status->isGood(); |
| 1576 | + if ( !$ok ) { |
| 1577 | + $this->parent->showStatusErrorBox( $status ); |
| 1578 | + } |
| 1579 | + $this->endStage( $ok ); |
1576 | 1580 | } |
1577 | 1581 | $this->addHTML("</ul>"); |
1578 | 1582 | $this->endForm(); |
Index: branches/new-installer/phase3/includes/installer/Installer.php |
— | — | @@ -828,16 +828,13 @@ |
829 | 829 | foreach( $exts as $e ) { |
830 | 830 | require( "$path/$e/$e.php" ); |
831 | 831 | } |
832 | | - return true; |
| 832 | + return Status::newGood(); |
833 | 833 | } |
834 | 834 | |
835 | 835 | public function installDatabase() { |
836 | 836 | $installer = $this->getDBInstaller( $this->getVar( 'wgDBtype' ) ); |
837 | | - $db = $installer->setupDatabase(); |
838 | | - if( !$db ) { |
839 | | - return false; |
840 | | - } |
841 | | - return true; |
| 837 | + $status = $installer->setupDatabase(); |
| 838 | + return $status; |
842 | 839 | } |
843 | 840 | |
844 | 841 | public function installTables() { |
— | — | @@ -845,10 +842,8 @@ |
846 | 843 | $status = $installer->createTables(); |
847 | 844 | if( $status->isGood() ) { |
848 | 845 | LBFactory::enableBackend(); |
849 | | - return true; |
850 | | - } else { |
851 | | - return false; |
852 | 846 | } |
| 847 | + return $status; |
853 | 848 | } |
854 | 849 | |
855 | 850 | public function installSecretKey() { |
— | — | @@ -864,7 +859,7 @@ |
865 | 860 | $this->output->addWarningMsg( 'config-insecure-secretkey' ); |
866 | 861 | } |
867 | 862 | $this->setVar( 'wgSecretKey', $secretKey ); |
868 | | - return true; |
| 863 | + return Status::newGood(); |
869 | 864 | } |
870 | 865 | |
871 | 866 | public function installSysop() { |
— | — | @@ -872,27 +867,33 @@ |
873 | 868 | $user = User::newFromName( $name ); |
874 | 869 | if ( !$user ) { |
875 | 870 | // we should've validated this earlier anyway! |
876 | | - $this->output->addWarningMsg( 'config-admin-error-user', $name ); |
877 | | - return false; |
| 871 | + return Status::newFatal( 'config-admin-error-user', $name ); |
878 | 872 | } |
879 | 873 | if ( $user->idForName() == 0 ) { |
880 | 874 | $user->addToDatabase(); |
881 | 875 | try { |
882 | 876 | $user->setPassword( $this->getVar( '_AdminPassword' ) ); |
883 | 877 | } catch( PasswordError $pwe ) { |
884 | | - $this->output->addWarningMsg( 'config-admin-error-password', $name, $pwe->getMessage() ); |
885 | | - return false; |
| 878 | + return Status::newFatal( 'config-admin-error-password', $name, $pwe->getMessage() ); |
886 | 879 | } |
887 | 880 | $user->saveSettings(); |
888 | 881 | $user->addGroup( 'sysop' ); |
889 | 882 | $user->addGroup( 'bureaucrat' ); |
890 | 883 | } |
891 | | - return true; |
| 884 | + return Status::newGood(); |
892 | 885 | } |
893 | 886 | |
894 | 887 | public function installLocalsettings() { |
895 | 888 | $localSettings = new LocalSettingsGenerator( $this ); |
896 | | - return $localSettings->writeLocalSettings(); |
| 889 | + $ok = $localSettings->writeLocalSettings(); |
| 890 | + |
| 891 | + # TODO: Make writeLocalSettings() itself not warn, but instead return |
| 892 | + # a Status object to us to pass along. |
| 893 | + if ( $ok ) { |
| 894 | + return Status::newGood(); |
| 895 | + } else { |
| 896 | + return Status::newFatal(); |
| 897 | + } |
897 | 898 | } |
898 | 899 | |
899 | 900 | /* |