/** * Ends this task peacefully */ function restInPeace(&$loadBalancer) { wfProfileClose(); logProfilingData(); $loadBalancer->closeAll(); wfDebug("Request ended normally\n"); }
if (wfRunHooks('UnknownAction', array($action, $wgArticle))) { $wgOut->errorpage('nosuchaction', 'nosuchactiontext'); } } } } } } } } wfProfileOut('main-action'); # Deferred updates aren't really deferred anymore. It's important to report errors to the # user, and that means doing this before OutputPage::output(). Note that for page saves, # the client will wait until the script exits anyway before following the redirect. wfProfileIn('main-updates'); foreach ($wgDeferredUpdateList as $up) { $up->doUpdate(); } wfProfileOut('main-updates'); wfProfileIn('main-cleanup'); $wgLoadBalancer->saveMasterPos(); # Now commit any transactions, so that unreported errors after output() don't roll back the whole thing $wgLoadBalancer->commitAll(); $wgOut->output(); foreach ($wgPostCommitUpdateList as $up) { $up->doUpdate(); } wfProfileOut('main-cleanup'); logProfilingData(); $wgLoadBalancer->closeAll(); wfDebug("Request ended normally\n");
/** * Just like exit() but makes a note of it. * Commits open transactions except if the error parameter is set * * @obsolete Please return control to the caller or throw an exception */ function wfAbruptExit($error = false) { global $wgLoadBalancer; static $called = false; if ($called) { exit(-1); } $called = true; if (function_exists('debug_backtrace')) { // PHP >= 4.3 $bt = debug_backtrace(); for ($i = 0; $i < count($bt); $i++) { $file = isset($bt[$i]['file']) ? $bt[$i]['file'] : "unknown"; $line = isset($bt[$i]['line']) ? $bt[$i]['line'] : "unknown"; wfDebug("WARNING: Abrupt exit in {$file} at line {$line}\n"); } } else { wfDebug('WARNING: Abrupt exit\\n'); } wfProfileClose(); logProfilingData(); if (!$error) { $wgLoadBalancer->closeAll(); } exit(-1); }