class MWException extends Exception
{
function useOutputPage() {
- return !empty( $GLOBALS['wgFullyInitialised'] );
+ return !empty( $GLOBALS['wgFullyInitialised'] ) &&
+ !empty( $GLOBALS['wgArticle'] ) && !empty( $GLOBALS['wgTitle'] );
}
function useMessageCache() {
}
}
+ function getLogMessage() {
+ $file = $this->getFile();
+ $line = $this->getLine();
+ $message = $this->getMessage();
+ return "{$_SERVER['REQUEST_URI']} Exception from line $line of $file: $message";
+ }
+
function reportHTML() {
global $wgOut;
if ( $this->useOutputPage() ) {
if ( $wgCommandLineMode ) {
$this->reportText();
} else {
+ $log = $this->getLogMessage();
+ if ( $log ) {
+ wfDebugLog( 'exception', $log );
+ }
$this->reportHTML();
}
}
function htmlFooter() {
echo "</body></html>";
}
+
}
/**
// Final cleanup, similar to wfErrorExit()
if ( $wgFullyInitialised ) {
try {
- wfProfileClose();
- logProfilingData(); // uses $wgRequest, hence the $wgFullyInitialised condition
+ wfLogProfilingData(); // uses $wgRequest, hence the $wgFullyInitialised condition
} catch ( Exception $e ) {}
}