Fix/hack ErrorPageError to work from non-UI contexts
[lhc/web/wiklou.git] / includes / exception / ErrorPageError.php
index 2bed87a..4b18126 100644 (file)
@@ -61,9 +61,12 @@ class ErrorPageError extends MWException implements ILocalizedException {
        }
 
        public function report() {
-               global $wgOut;
-
-               $wgOut->showErrorPage( $this->title, $this->msg, $this->params );
-               $wgOut->output();
+               if ( self::isCommandLine() || defined( 'MW_API' ) ) {
+                       parent::report();
+               } else {
+                       global $wgOut;
+                       $wgOut->showErrorPage( $this->title, $this->msg, $this->params );
+                       $wgOut->output();
+               }
        }
 }