From: Mr. E23 Date: Wed, 10 Dec 2003 14:58:17 +0000 (+0000) Subject: Added wfAbruptExit() function, to replace exit() calls with. X-Git-Tag: 1.3.0beta1~1266 X-Git-Url: http://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/operations/?a=commitdiff_plain;h=ea5c70a473e67fbdf7eea53421d2ae180e301dfd;p=lhc%2Fweb%2Fwiklou.git Added wfAbruptExit() function, to replace exit() calls with. --- diff --git a/includes/GlobalFunctions.php b/includes/GlobalFunctions.php index 40effcc321..f0641a1add 100644 --- a/includes/GlobalFunctions.php +++ b/includes/GlobalFunctions.php @@ -339,7 +339,7 @@ function wfSpecialPage() $par = NULL; list($t, $par) = split( "/", $wgTitle->getDBkey(), 2 ); - + if ( array_key_exists( $t, $validSP ) || ( $wgUser->isSysop() && array_key_exists( $t, $sysopSP ) ) || ( $wgUser->isDeveloper() && array_key_exists( $t, $devSP ) ) ) { @@ -373,6 +373,24 @@ function wfGo( $s ) $se->goResult(); } +/* private */ $wgAbruptExitCalled = false; + +# Just like exit() but makes a note of it. +function wfAbruptExit(){ + // Safety to avoid infinite recursion in case of (unlikely) bugs somewhere + global $wgAbruptExitCalled; + if ( $wgAbruptExitCalled ){ + exit(); + } + $wgAbruptExitCalled = true; + + $bt = debug_backtrace(); + $file = $bt[0]["file"]; + $line = $bt[0]["line"]; + wfDebug("WARNING: Abrupt exit in $file at line $line\n"); + exit(); +} + function wfNumberOfArticles() { global $wgNumberOfArticles;