本文整理汇总了PHP中MWExceptionHandler::handleException方法的典型用法代码示例。如果您正苦于以下问题:PHP MWExceptionHandler::handleException方法的具体用法?PHP MWExceptionHandler::handleException怎么用?PHP MWExceptionHandler::handleException使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MWExceptionHandler
的用法示例。
在下文中一共展示了MWExceptionHandler::handleException方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: doPostOutputShutdown
/**
* This function does work that can be done *after* the
* user gets the HTTP response so they don't block on it
*
* This manages deferred updates, job insertion,
* final commit, and the logging of profiling data
*
* @param string $mode Use 'fast' to always skip job running
* @since 1.26
*/
public function doPostOutputShutdown($mode = 'normal')
{
$timing = $this->context->getTiming();
$timing->mark('requestShutdown');
// Show visible profiling data if enabled (which cannot be post-send)
Profiler::instance()->logDataPageOutputOnly();
$callback = function () use($mode) {
try {
$this->restInPeace($mode);
} catch (Exception $e) {
MWExceptionHandler::handleException($e);
}
};
// Defer everything else...
if (function_exists('register_postsend_function')) {
// https://github.com/facebook/hhvm/issues/1230
register_postsend_function($callback);
} else {
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} else {
// Either all DB and deferred updates should happen or none.
// The latter should not be cancelled due to client disconnect.
ignore_user_abort(true);
}
$callback();
}
}
示例2: die
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
* http://www.gnu.org/copyleft/gpl.html
*
* @file
* @author Aaron Schulz
*/
if (!in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '0:0:0:0:0:0:0:1', '::1'), true)) {
die("Only loopback requests are allowed.\n");
} elseif ($_SERVER['REQUEST_METHOD'] !== 'POST') {
die("Request must use POST.\n");
}
require_once __DIR__ . '/../multiversion/MWVersion.php';
$wiki = isset($_GET['wiki']) ? $_GET['wiki'] : '';
require getMediaWiki('includes/WebStart.php', $wiki);
error_reporting(E_ERROR);
// fatals but not random I/O warnings
ini_set('display_errors', 1);
$wgShowExceptionDetails = true;
if (method_exists('LBFactory', 'disableChronologyProtection')) {
// This is not helpful here and will slow things down in some cases
wfGetLBFactory()->disableChronologyProtection();
}
try {
$mediawiki = new MediaWiki();
$runner = new JobRunner();
$response = $runner->run(array('type' => isset($_GET['type']) ? $_GET['type'] : false, 'maxJobs' => isset($_GET['maxjobs']) ? $_GET['maxjobs'] : false, 'maxTime' => isset($_GET['maxtime']) ? $_GET['maxtime'] : 30));
print json_encode($response, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE);
$mediawiki->restInPeace();
} catch (Exception $e) {
MWExceptionHandler::handleException($e);
}
示例3: doPostOutputShutdown
/**
* This function does work that can be done *after* the
* user gets the HTTP response so they don't block on it
*
* @param string $mode Use 'fast' to always skip job running
* @since 1.26
*/
public function doPostOutputShutdown($mode = 'normal')
{
// Show profiling data if enabled
Profiler::instance()->logDataPageOutputOnly();
$that = $this;
$callback = function () use($that, $mode) {
try {
// Assure deferred updates are not in the main transaction
wfGetLBFactory()->commitMasterChanges();
// Run jobs occasionally, if enabled
if ($mode === 'normal') {
$that->triggerJobs();
}
// Do deferred updates and job insertion and final commit
$that->restInPeace();
} catch (Exception $e) {
MWExceptionHandler::handleException($e);
}
};
if (function_exists('register_postsend_function')) {
// https://github.com/facebook/hhvm/issues/1230
register_postsend_function($callback);
} else {
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
} else {
// Either all DB and deferred updates should happen or none.
// The later should not be cancelled due to client disconnect.
ignore_user_abort(true);
}
$callback();
}
}
示例4: run
/**
* Run the current MediaWiki instance
* index.php just calls this
*/
public function run()
{
try {
$this->checkMaxLag();
try {
$this->main();
} catch (ErrorPageError $e) {
// Bug 62091: while exceptions are convenient to bubble up GUI errors,
// they are not internal application faults. As with normal requests, this
// should commit, print the output, do deferred updates, jobs, and profiling.
wfGetLBFactory()->commitMasterChanges();
$e->report();
// display the GUI error
}
if (function_exists('fastcgi_finish_request')) {
fastcgi_finish_request();
}
$this->triggerJobs();
$this->restInPeace();
} catch (Exception $e) {
MWExceptionHandler::handleException($e);
}
}