/** * Throw a UsageException, which will (if uncaught) call the main module's * error handler and die with an error message. * * @param $description string One-line human-readable description of the * error condition, e.g., "The API requires a valid action parameter" * @param $errorCode string Brief, arbitrary, stable string to allow easy * automated identification of the error, e.g., 'unknown_action' * @param $httpRespCode int HTTP response code * @param $extradata array Data to add to the <error> element; array in ApiResult format */ public function dieUsage($description, $errorCode, $httpRespCode = 0, $extradata = null) { wfProfileClose(); throw new UsageException($description, $this->encodeParamName($errorCode), $httpRespCode, $extradata); }
/** * Ends this task peacefully */ function restInPeace(&$loadBalancer) { wfProfileClose(); logProfilingData(); $loadBalancer->closeAll(); wfDebug("Request ended normally\n"); }
function outputPage(&$out) { global $wgDebugComments; wfProfileIn('Skin::outputPage'); $this->initPage($out); $out->out($out->headElement()); $out->out("\n<body"); $ops = $this->getBodyOptions(); foreach ($ops as $name => $val) { $out->out(" {$name}='{$val}'"); } $out->out(">\n"); if ($wgDebugComments) { $out->out("<!-- Wiki debugging output:\n" . $out->mDebugtext . "-->\n"); } $out->out($this->beforeContent()); $out->out($out->mBodytext . "\n"); $out->out($this->afterContent()); wfProfileClose(); $out->out($out->reportTime()); $out->out("\n</body></html>"); }
/** * 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); }