Index: trunk/phase3/includes/installer/Installer.php |
— | — | @@ -296,6 +296,11 @@ |
297 | 297 | public abstract function showMessage( $msg /*, ... */ ); |
298 | 298 | |
299 | 299 | /** |
| 300 | + * Same as showMessage(), but for displaying errors |
| 301 | + */ |
| 302 | + public abstract function showError( $msg /*, ... */ ); |
| 303 | + |
| 304 | + /** |
300 | 305 | * Show a message to the installing user by using a Status object |
301 | 306 | * @param $status Status |
302 | 307 | */ |
— | — | @@ -617,7 +622,7 @@ |
618 | 623 | $this->setVar( '_CompiledDBs', $compiledDBs ); |
619 | 624 | |
620 | 625 | if ( !$compiledDBs ) { |
621 | | - $this->showMessage( 'config-no-db' ); |
| 626 | + $this->showError( 'config-no-db' ); |
622 | 627 | // FIXME: this only works for the web installer! |
623 | 628 | $this->showHelpBox( 'config-no-db-help', $wgLang->commaList( $allNames ) ); |
624 | 629 | return false; |
— | — | @@ -647,7 +652,7 @@ |
648 | 653 | protected function envCheckBrokenXML() { |
649 | 654 | $test = new PhpXmlBugTester(); |
650 | 655 | if ( !$test->ok ) { |
651 | | - $this->showMessage( 'config-brokenlibxml' ); |
| 656 | + $this->showError( 'config-brokenlibxml' ); |
652 | 657 | return false; |
653 | 658 | } |
654 | 659 | } |
— | — | @@ -660,7 +665,7 @@ |
661 | 666 | $test = new PhpRefCallBugTester; |
662 | 667 | $test->execute(); |
663 | 668 | if ( !$test->ok ) { |
664 | | - $this->showMessage( 'config-using531', phpversion() ); |
| 669 | + $this->showError( 'config-using531', phpversion() ); |
665 | 670 | return false; |
666 | 671 | } |
667 | 672 | } |
— | — | @@ -670,7 +675,7 @@ |
671 | 676 | */ |
672 | 677 | protected function envCheckMagicQuotes() { |
673 | 678 | if( wfIniGetBool( "magic_quotes_runtime" ) ) { |
674 | | - $this->showMessage( 'config-magic-quotes-runtime' ); |
| 679 | + $this->showError( 'config-magic-quotes-runtime' ); |
675 | 680 | return false; |
676 | 681 | } |
677 | 682 | } |
— | — | @@ -680,7 +685,7 @@ |
681 | 686 | */ |
682 | 687 | protected function envCheckMagicSybase() { |
683 | 688 | if ( wfIniGetBool( 'magic_quotes_sybase' ) ) { |
684 | | - $this->showMessage( 'config-magic-quotes-sybase' ); |
| 689 | + $this->showError( 'config-magic-quotes-sybase' ); |
685 | 690 | return false; |
686 | 691 | } |
687 | 692 | } |
— | — | @@ -690,7 +695,7 @@ |
691 | 696 | */ |
692 | 697 | protected function envCheckMbstring() { |
693 | 698 | if ( wfIniGetBool( 'mbstring.func_overload' ) ) { |
694 | | - $this->showMessage( 'config-mbstring' ); |
| 699 | + $this->showError( 'config-mbstring' ); |
695 | 700 | return false; |
696 | 701 | } |
697 | 702 | } |
— | — | @@ -700,7 +705,7 @@ |
701 | 706 | */ |
702 | 707 | protected function envCheckZE1() { |
703 | 708 | if ( wfIniGetBool( 'zend.ze1_compatibility_mode' ) ) { |
704 | | - $this->showMessage( 'config-ze1' ); |
| 709 | + $this->showError( 'config-ze1' ); |
705 | 710 | return false; |
706 | 711 | } |
707 | 712 | } |
— | — | @@ -720,7 +725,7 @@ |
721 | 726 | */ |
722 | 727 | protected function envCheckXML() { |
723 | 728 | if ( !function_exists( "utf8_encode" ) ) { |
724 | | - $this->showMessage( 'config-xml-bad' ); |
| 729 | + $this->showError( 'config-xml-bad' ); |
725 | 730 | return false; |
726 | 731 | } |
727 | 732 | } |
— | — | @@ -730,14 +735,14 @@ |
731 | 736 | */ |
732 | 737 | protected function envCheckPCRE() { |
733 | 738 | if ( !function_exists( 'preg_match' ) ) { |
734 | | - $this->showMessage( 'config-pcre' ); |
| 739 | + $this->showError( 'config-pcre' ); |
735 | 740 | return false; |
736 | 741 | } |
737 | 742 | wfSuppressWarnings(); |
738 | 743 | $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' ); |
739 | 744 | wfRestoreWarnings(); |
740 | 745 | if ( $regexd != '--' ) { |
741 | | - $this->showMessage( 'config-pcre-no-utf8' ); |
| 746 | + $this->showError( 'config-pcre-no-utf8' ); |
742 | 747 | return false; |
743 | 748 | } |
744 | 749 | } |
— | — | @@ -843,7 +848,7 @@ |
844 | 849 | // Some kind soul has set it for us already (e.g. debconf) |
845 | 850 | return true; |
846 | 851 | } else { |
847 | | - $this->showMessage( 'config-no-uri' ); |
| 852 | + $this->showError( 'config-no-uri' ); |
848 | 853 | return false; |
849 | 854 | } |
850 | 855 | |
Index: trunk/phase3/includes/installer/CliInstaller.php |
— | — | @@ -121,16 +121,33 @@ |
122 | 122 | } |
123 | 123 | |
124 | 124 | public function showMessage( $msg /*, ... */ ) { |
125 | | - $params = func_get_args(); |
126 | | - array_shift( $params ); |
| 125 | + echo $this->getMessageText( func_get_args() ) . "\n"; |
| 126 | + flush(); |
| 127 | + } |
127 | 128 | |
| 129 | + public function showError( $msg /*, ... */ ) { |
| 130 | + echo "***{$this->getMessageText( func_get_args() )}***\n"; |
| 131 | + flush(); |
| 132 | + } |
| 133 | + |
| 134 | + /** |
| 135 | + * @return string |
| 136 | + */ |
| 137 | + protected function getMessageText( $params ) { |
| 138 | + $msg = array_shift( $params ); |
| 139 | + |
128 | 140 | $text = wfMsgExt( $msg, array( 'parseinline' ), $params ); |
129 | 141 | |
130 | 142 | $text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 <$1>', $text ); |
131 | | - echo html_entity_decode( strip_tags( $text ), ENT_QUOTES ) . "\n"; |
132 | | - flush(); |
| 143 | + return html_entity_decode( strip_tags( $text ), ENT_QUOTES ); |
133 | 144 | } |
134 | 145 | |
| 146 | + /** |
| 147 | + * Dummy |
| 148 | + */ |
| 149 | + public function showHelpBox( $msg /*, ... */ ) { |
| 150 | + } |
| 151 | + |
135 | 152 | public function showStatusMessage( Status $status ) { |
136 | 153 | $warnings = array_merge( $status->getWarningsArray(), |
137 | 154 | $status->getErrorsArray() ); |