Remove various double empty newlines
[lhc/web/wiklou.git] / includes / exception / MWExceptionHandler.php
index d25f1a8..d653dd0 100644 (file)
@@ -143,7 +143,7 @@ class MWExceptionHandler {
                                self::getLogMessage( $e ),
                                self::getLogContext( $e )
                        );
-                       $factory->rollbackMasterChanges();
+                       $factory->rollbackMasterChanges( __METHOD__ );
                }
        }
 
@@ -197,6 +197,7 @@ class MWExceptionHandler {
         * @param string $message
         * @param string $file
         * @param int $line
+        * @return bool
         *
         * @see logError()
         */
@@ -245,7 +246,6 @@ class MWExceptionHandler {
                return false;
        }
 
-
        /**
         * Dual purpose callback used as both a set_error_handler() callback and
         * a registered shutdown function. Receive a callback from the interpreter
@@ -369,6 +369,7 @@ TXT;
        public static function prettyPrintTrace( array $trace, $pad = '' ) {
                $text = '';
 
+               $level = 0;
                foreach ( $trace as $level => $frame ) {
                        if ( isset( $frame['file'] ) && isset( $frame['line'] ) ) {
                                $text .= "{$pad}#{$level} {$frame['file']}({$frame['line']}): ";
@@ -380,10 +381,12 @@ TXT;
                                $text .= "{$pad}#{$level} [internal function]: ";
                        }
 
-                       if ( isset( $frame['class'] ) ) {
+                       if ( isset( $frame['class'] ) && isset( $frame['type'] ) && isset( $frame['function'] ) ) {
                                $text .= $frame['class'] . $frame['type'] . $frame['function'];
-                       } else {
+                       } elseif ( isset( $frame['function'] ) ) {
                                $text .= $frame['function'];
+                       } else {
+                               $text .= 'NO_FUNCTION_GIVEN';
                        }
 
                        if ( isset( $frame['args'] ) ) {
@@ -485,6 +488,14 @@ TXT;
                return "[$id] $url   $type from line $line of $file: $message";
        }
 
+       public static function getPublicLogMessage( Exception $e ) {
+               $logId = self::getLogId( $e );
+               $type = get_class( $e );
+               return '[' . $logId . '] '
+                       . gmdate( 'Y-m-d H:i:s' ) . ': '
+                       . 'Fatal exception of type ' . $type;
+       }
+
        /**
         * Get a PSR-3 log event context from an Exception.
         *