本文整理汇总了PHP中abort_all_db_transactions函数的典型用法代码示例。如果您正苦于以下问题:PHP abort_all_db_transactions函数的具体用法?PHP abort_all_db_transactions怎么用?PHP abort_all_db_transactions使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了abort_all_db_transactions函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: default_exception_handler
/**
* Default exception handler, uncaught exceptions are equivalent to error() in 1.9 and earlier
*
* @param Exception $ex
* @return void -does not return. Terminates execution!
*/
function default_exception_handler($ex)
{
global $CFG, $DB, $OUTPUT, $USER, $FULLME, $SESSION, $PAGE;
// detect active db transactions, rollback and log as error
abort_all_db_transactions();
if ($ex instanceof required_capability_exception && !CLI_SCRIPT && !AJAX_SCRIPT && !empty($CFG->autologinguests) && !empty($USER->autologinguest)) {
$SESSION->wantsurl = qualified_me();
redirect(get_login_url());
}
$info = get_exception_info($ex);
if (debugging('', DEBUG_MINIMAL)) {
$logerrmsg = "Default exception handler: " . $info->message . ' Debug: ' . $info->debuginfo . "\n" . format_backtrace($info->backtrace, true);
error_log($logerrmsg);
}
if (is_early_init($info->backtrace)) {
echo bootstrap_renderer::early_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo, $info->errorcode);
} else {
try {
if ($DB) {
// If you enable db debugging and exception is thrown, the print footer prints a lot of rubbish
$DB->set_debug(0);
}
echo $OUTPUT->fatal_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo);
} catch (Exception $out_ex) {
// default exception handler MUST not throw any exceptions!!
// the problem here is we do not know if page already started or not, we only know that somebody messed up in outputlib or theme
// so we just print at least something instead of "Exception thrown without a stack frame in Unknown on line 0":-(
if (CLI_SCRIPT or AJAX_SCRIPT) {
// just ignore the error and send something back using the safest method
echo bootstrap_renderer::early_error($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo, $info->errorcode);
} else {
echo bootstrap_renderer::early_error_content($info->message, $info->moreinfourl, $info->link, $info->backtrace, $info->debuginfo);
$outinfo = get_exception_info($out_ex);
echo bootstrap_renderer::early_error_content($outinfo->message, $outinfo->moreinfourl, $outinfo->link, $outinfo->backtrace, $outinfo->debuginfo);
}
}
}
exit(1);
// General error code
}
示例2: upgrade_handle_exception
/**
* upgrade logging functions
*/
function upgrade_handle_exception($ex, $plugin = null) {
global $CFG;
// rollback everything, we need to log all upgrade problems
abort_all_db_transactions();
$info = get_exception_info($ex);
// First log upgrade error
upgrade_log(UPGRADE_LOG_ERROR, $plugin, 'Exception: ' . get_class($ex), $info->message, $info->backtrace);
// Always turn on debugging - admins need to know what is going on
set_debugging(DEBUG_DEVELOPER, true);
default_exception_handler($ex, true, $plugin);
}
示例3: exception_handler
/**
* Specialised exception handler, we can not use the standard one because
* it can not just print html to output.
*
* @param exception $ex
* $uses exit
*/
public function exception_handler($ex)
{
// detect active db transactions, rollback and log as error
abort_all_db_transactions();
// some hacks might need a cleanup hook
$this->session_cleanup($ex);
// now let the plugin send the exception to client
$this->send_error($ex);
// not much else we can do now, add some logging later
exit(1);
}
示例4: RWSEHdlr
function RWSEHdlr($r_ex)
{
abort_all_db_transactions();
$r_inf = get_exception_info($r_ex);
$r_msg = "\r\n-- Exception occurred --";
$r_msg .= "\r\nmessage: {$r_inf->message}";
$r_msg .= "\r\nerrorcode: {$r_inf->errorcode}";
$r_msg .= "\r\nfile: " . $r_ex->getFile();
$r_msg .= "\r\nline: " . $r_ex->getLine();
$r_msg .= "\r\nlink: {$r_inf->link}";
$r_msg .= "\r\nmoreinfourl: {$r_inf->moreinfourl}";
$r_msg .= "\r\na: {$r_inf->a}";
$r_msg .= "\r\ndebuginfo: {$r_inf->debuginfo}\r\n";
RWSELog($r_msg);
RWSELog("\r\nstacktrace: " . $r_ex->getTraceAsString());
RWSSErr("2112,{$r_inf->errorcode}");
}
示例5: deploy_ingredients
/**
* Adds and upgrades the selected plugins
*
* @param array $ingredients
* @param string $path Path to the ingredient type file system
* @param SimpleXMLElement $xml
* @return array Problems during the ingredients deployment
*/
public function deploy_ingredients($ingredients, $path, SimpleXMLElement $xml)
{
// Using the $ingredients array keys to maintain coherence with the main deployment method
$problems = array();
$pluginman = plugin_manager::instance();
$plugintypespaths = get_plugin_types();
$this->get_flavour_info($xml);
foreach ($ingredients as $selection) {
// [0] => ingredienttype, [1] => ingredientname
$ingredientdata = explode('/', $selection);
$type = $ingredientdata[0];
$ingredient = $ingredientdata[1];
if (empty($this->branches[$type]->branches[$ingredient])) {
$problems[$selection]['pluginnotfound'] = $selection;
continue;
}
$ingredientdata = $this->branches[$type]->branches[$ingredient];
// Adapter to the restrictions array
if (!empty($ingredientdata->restrictions)) {
$problems[$selection] = $ingredientdata->restrictions;
continue;
}
if (empty($xml->{$type}) || empty($xml->{$type}->{$ingredient})) {
$problems[$selection]['pluginnotfound'] = $selection;
continue;
}
// Deploy then
$ingredientpath = $plugintypespaths[$type] . '/' . $ingredient;
// Remove old dir if present
if (file_exists($ingredientpath)) {
// Report if the old plugin directory can't be removed
if (!$this->unlink($ingredientpath)) {
$problems[$selection]['plugincantremove'] = $selection;
continue;
}
}
// Copy the new contents where the flavour says
$tmppath = $path . '/' . $xml->{$type}->{$ingredient}->path;
if (!$this->copy($tmppath, $ingredientpath)) {
debugging('From : ' . $tmppath . ' To: ' . $ingredientpath);
$problems[$selection]['plugincopyerror'] = $selection;
}
}
// Execute the moodle upgrade process
try {
foreach ($plugintypespaths as $type => $location) {
upgrade_plugins($type, 'flavours_print_upgrade_void', 'flavours_print_upgrade_void', false);
}
} catch (Exception $ex) {
abort_all_db_transactions();
$info = get_exception_info($ex);
upgrade_log(UPGRADE_LOG_ERROR, $ex->module, 'Exception: ' . get_class($ex), $info->message, $info->backtrace);
}
return $problems;
}
示例6: lockdownbrowser_MonitorExceptionHandler
function lockdownbrowser_MonitorExceptionHandler($ex)
{
abort_all_db_transactions();
$info = get_exception_info($ex);
$msg = "\r\n-- Exception occurred --" . "\r\nmessage: {$info->message}" . "\r\nerrorcode: {$info->errorcode}" . "\r\nbacktrace: {$info->backtrace}" . "\r\nlink: {$info->link}" . "\r\nmoreinfourl: {$info->moreinfourl}" . "\r\na: {$info->a}" . "\r\ndebuginfo: {$info->debuginfo}\r\n";
lockdownbrowser_MonitorLog($msg);
lockdownbrowser_MonitorLog("\r\nstacktrace: " . $ex->getTraceAsString());
lockdownbrowser_MonitorServiceError(2003, "A Moodle or PHP server exception occurred: {$info->errorcode}");
}