http://www.mediawiki.org/wiki/Special:Code/MediaWiki/90993

Revision: 90993
Author:   demon
Date:     2011-06-28 19:46:23 +0000 (Tue, 28 Jun 2011)
Log Message:
-----------
* Remove Exception.php's reliance on wfDie(), as well as the awful constant 
MEDIAWIKI_INSTALL (holdover from old installer)
* Rm checking for MEDIAWIKI_INSTALL in wfOut(), no codepath leads here from the 
installer anymore

Modified Paths:
--------------
    trunk/phase3/includes/Exception.php
    trunk/phase3/includes/GlobalFunctions.php

Modified: trunk/phase3/includes/Exception.php
===================================================================
--- trunk/phase3/includes/Exception.php 2011-06-28 19:41:00 UTC (rev 90992)
+++ trunk/phase3/includes/Exception.php 2011-06-28 19:46:23 UTC (rev 90993)
@@ -187,12 +187,8 @@
                                die( $hookResult );
                        }
 
-                       $html = $this->getHTML();
-                       if ( defined( 'MEDIAWIKI_INSTALL' ) ) {
-                               echo $html;
-                       } else {
-                               wfDie( $html );
-                       }
+                       echo $this->getHTML();
+                       die(1);
                }
        }
 
@@ -215,7 +211,7 @@
        }
 
        static function isCommandLine() {
-               return !empty( $GLOBALS['wgCommandLineMode'] ) && !defined( 
'MEDIAWIKI_INSTALL' );
+               return !empty( $GLOBALS['wgCommandLineMode'] );
        }
 }
 
@@ -431,7 +427,7 @@
                                if ( $cmdLine ) {
                                        self::printError( $message );
                                } else {
-                                       wfDie( nl2br( htmlspecialchars( 
$message ) ) ) . "\n";
+                                       self::escapeEchoAndDie( $message );
                                }
                        }
                } else {
@@ -445,7 +441,7 @@
                        if ( $cmdLine ) {
                                self::printError( $message );
                        } else {
-                               wfDie( nl2br( htmlspecialchars( $message ) ) ) 
. "\n";
+                               self::escapeEchoAndDie( $message );
                        }
                }
        }
@@ -453,6 +449,7 @@
        /**
         * Print a message, if possible to STDERR.
         * Use this in command line mode only (see isCommandLine)
+        * @param $message String Failure text
         */
        public static function printError( $message ) {
                # NOTE: STDERR may not be available, especially if php-cgi is 
used from the command line (bug #15602).
@@ -465,6 +462,16 @@
        }
 
        /**
+        * Print a message after escaping it and converting newlines to <br>
+        * Use this for non-command line failures
+        * @param $message String Failure text
+        */
+       private static function escapeEchoAndDie( $message ) {
+               echo nl2br( htmlspecialchars( $message ) ) . "\n";
+               die(1);
+       }
+
+       /**
         * Exception handler which simulates the appropriate catch() handling:
         *
         *   try {

Modified: trunk/phase3/includes/GlobalFunctions.php
===================================================================
--- trunk/phase3/includes/GlobalFunctions.php   2011-06-28 19:41:00 UTC (rev 
90992)
+++ trunk/phase3/includes/GlobalFunctions.php   2011-06-28 19:46:23 UTC (rev 
90993)
@@ -3350,7 +3350,7 @@
 function wfOut( $s ) {
        wfDeprecated( __METHOD__ );
        global $wgCommandLineMode;
-       if ( $wgCommandLineMode && !defined( 'MEDIAWIKI_INSTALL' ) ) {
+       if ( $wgCommandLineMode ) {
                echo $s;
        } else {
                echo htmlspecialchars( $s );


_______________________________________________
MediaWiki-CVS mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-cvs

Reply via email to