r87027 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r87026‎ | r87027 | r87028 >
Date:18:22, 27 April 2011
Author:maxsem
Status:ok (Comments)
Tags:
Comment:
Bug 28039 - Boldface all fatals. Moved showError() from WebInstaller to base class, added its call to all env checks wherever appropriate. Also fixed a fatal in CLI installer when no DB drivers are present.
Modified paths:
  • /trunk/phase3/includes/installer/CliInstaller.php (modified) (history)
  • /trunk/phase3/includes/installer/Installer.php (modified) (history)

Diff [purge]

Index: trunk/phase3/includes/installer/Installer.php
@@ -296,6 +296,11 @@
297297 public abstract function showMessage( $msg /*, ... */ );
298298
299299 /**
 300+ * Same as showMessage(), but for displaying errors
 301+ */
 302+ public abstract function showError( $msg /*, ... */ );
 303+
 304+ /**
300305 * Show a message to the installing user by using a Status object
301306 * @param $status Status
302307 */
@@ -617,7 +622,7 @@
618623 $this->setVar( '_CompiledDBs', $compiledDBs );
619624
620625 if ( !$compiledDBs ) {
621 - $this->showMessage( 'config-no-db' );
 626+ $this->showError( 'config-no-db' );
622627 // FIXME: this only works for the web installer!
623628 $this->showHelpBox( 'config-no-db-help', $wgLang->commaList( $allNames ) );
624629 return false;
@@ -647,7 +652,7 @@
648653 protected function envCheckBrokenXML() {
649654 $test = new PhpXmlBugTester();
650655 if ( !$test->ok ) {
651 - $this->showMessage( 'config-brokenlibxml' );
 656+ $this->showError( 'config-brokenlibxml' );
652657 return false;
653658 }
654659 }
@@ -660,7 +665,7 @@
661666 $test = new PhpRefCallBugTester;
662667 $test->execute();
663668 if ( !$test->ok ) {
664 - $this->showMessage( 'config-using531', phpversion() );
 669+ $this->showError( 'config-using531', phpversion() );
665670 return false;
666671 }
667672 }
@@ -670,7 +675,7 @@
671676 */
672677 protected function envCheckMagicQuotes() {
673678 if( wfIniGetBool( "magic_quotes_runtime" ) ) {
674 - $this->showMessage( 'config-magic-quotes-runtime' );
 679+ $this->showError( 'config-magic-quotes-runtime' );
675680 return false;
676681 }
677682 }
@@ -680,7 +685,7 @@
681686 */
682687 protected function envCheckMagicSybase() {
683688 if ( wfIniGetBool( 'magic_quotes_sybase' ) ) {
684 - $this->showMessage( 'config-magic-quotes-sybase' );
 689+ $this->showError( 'config-magic-quotes-sybase' );
685690 return false;
686691 }
687692 }
@@ -690,7 +695,7 @@
691696 */
692697 protected function envCheckMbstring() {
693698 if ( wfIniGetBool( 'mbstring.func_overload' ) ) {
694 - $this->showMessage( 'config-mbstring' );
 699+ $this->showError( 'config-mbstring' );
695700 return false;
696701 }
697702 }
@@ -700,7 +705,7 @@
701706 */
702707 protected function envCheckZE1() {
703708 if ( wfIniGetBool( 'zend.ze1_compatibility_mode' ) ) {
704 - $this->showMessage( 'config-ze1' );
 709+ $this->showError( 'config-ze1' );
705710 return false;
706711 }
707712 }
@@ -720,7 +725,7 @@
721726 */
722727 protected function envCheckXML() {
723728 if ( !function_exists( "utf8_encode" ) ) {
724 - $this->showMessage( 'config-xml-bad' );
 729+ $this->showError( 'config-xml-bad' );
725730 return false;
726731 }
727732 }
@@ -730,14 +735,14 @@
731736 */
732737 protected function envCheckPCRE() {
733738 if ( !function_exists( 'preg_match' ) ) {
734 - $this->showMessage( 'config-pcre' );
 739+ $this->showError( 'config-pcre' );
735740 return false;
736741 }
737742 wfSuppressWarnings();
738743 $regexd = preg_replace( '/[\x{0430}-\x{04FF}]/iu', '', '-АБВГД-' );
739744 wfRestoreWarnings();
740745 if ( $regexd != '--' ) {
741 - $this->showMessage( 'config-pcre-no-utf8' );
 746+ $this->showError( 'config-pcre-no-utf8' );
742747 return false;
743748 }
744749 }
@@ -843,7 +848,7 @@
844849 // Some kind soul has set it for us already (e.g. debconf)
845850 return true;
846851 } else {
847 - $this->showMessage( 'config-no-uri' );
 852+ $this->showError( 'config-no-uri' );
848853 return false;
849854 }
850855
Index: trunk/phase3/includes/installer/CliInstaller.php
@@ -121,16 +121,33 @@
122122 }
123123
124124 public function showMessage( $msg /*, ... */ ) {
125 - $params = func_get_args();
126 - array_shift( $params );
 125+ echo $this->getMessageText( func_get_args() ) . "\n";
 126+ flush();
 127+ }
127128
 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+
128140 $text = wfMsgExt( $msg, array( 'parseinline' ), $params );
129141
130142 $text = preg_replace( '/<a href="(.*?)".*?>(.*?)<\/a>/', '$2 &lt;$1&gt;', $text );
131 - echo html_entity_decode( strip_tags( $text ), ENT_QUOTES ) . "\n";
132 - flush();
 143+ return html_entity_decode( strip_tags( $text ), ENT_QUOTES );
133144 }
134145
 146+ /**
 147+ * Dummy
 148+ */
 149+ public function showHelpBox( $msg /*, ... */ ) {
 150+ }
 151+
135152 public function showStatusMessage( Status $status ) {
136153 $warnings = array_merge( $status->getWarningsArray(),
137154 $status->getErrorsArray() );

Sign-offs

UserFlagDate
Catropeinspected16:40, 30 April 2011

Follow-up revisions

RevisionCommit summaryAuthorDate
r87221Mft r87027demon21:47, 1 May 2011

Comments

#Comment by Krinkle (talk | contribs)   23:21, 27 April 2011

"extends Installer" in /trunk/phase3. I guess those need these too ? (since it was declared abstract)

#Comment by MaxSem (talk | contribs)   06:27, 28 April 2011

It was already present in WebInstaller.

Status & tagging log