当前位置: 首页>>代码示例>>PHP>>正文


PHP bootstrap_renderer::early_error_content方法代码示例

本文整理汇总了PHP中bootstrap_renderer::early_error_content方法的典型用法代码示例。如果您正苦于以下问题:PHP bootstrap_renderer::early_error_content方法的具体用法?PHP bootstrap_renderer::early_error_content怎么用?PHP bootstrap_renderer::early_error_content使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bootstrap_renderer的用法示例。


在下文中一共展示了bootstrap_renderer::early_error_content方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: enable_cli_maintenance_mode

/**
 * Enables CLI maintenance mode by creating new dataroot/climaintenance.html file.
 */
function enable_cli_maintenance_mode()
{
    global $CFG;
    if (file_exists("{$CFG->dataroot}/climaintenance.html")) {
        unlink("{$CFG->dataroot}/climaintenance.html");
    }
    if (isset($CFG->maintenance_message) and !html_is_blank($CFG->maintenance_message)) {
        $data = $CFG->maintenance_message;
        $data = bootstrap_renderer::early_error_content($data, null, null, null);
        $data = bootstrap_renderer::plain_page(get_string('sitemaintenance', 'admin'), $data);
    } else {
        if (file_exists("{$CFG->dataroot}/climaintenance.template.html")) {
            $data = file_get_contents("{$CFG->dataroot}/climaintenance.template.html");
        } else {
            $data = get_string('sitemaintenance', 'admin');
            $data = bootstrap_renderer::early_error_content($data, null, null, null);
            $data = bootstrap_renderer::plain_page(get_string('sitemaintenance', 'admin'), $data);
        }
    }
    file_put_contents("{$CFG->dataroot}/climaintenance.html", $data);
    chmod("{$CFG->dataroot}/climaintenance.html", $CFG->filepermissions);
}
开发者ID:Alexbado,项目名称:moodle2,代码行数:25,代码来源:adminlib.php

示例2: 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
}
开发者ID:vinoth4891,项目名称:clinique,代码行数:46,代码来源:setuplib.php

示例3: tool_dbtransfer_create_maintenance_file

/**
 * Create CLI maintenance file to prevent all access.
 */
function tool_dbtransfer_create_maintenance_file()
{
    global $CFG;
    register_shutdown_function('tool_dbtransfer_maintenance_callback');
    $options = new stdClass();
    $options->trusted = false;
    $options->noclean = false;
    $options->smiley = false;
    $options->filter = false;
    $options->para = true;
    $options->newlines = false;
    $message = format_text(get_string('climigrationnotice', 'tool_dbtransfer'), FORMAT_MARKDOWN, $options);
    $message = bootstrap_renderer::early_error_content($message, '', '', array());
    $html = <<<OET
<!DOCTYPE html>
<html>
<header><meta http-equiv="Content-Type" content="text/html; charset=utf-8" /><header/>
<body>{$message}</body>
</html>
OET;
    file_put_contents("{$CFG->dataroot}/climaintenance.html", $html);
    @chmod("{$CFG->dataroot}/climaintenance.html", $CFG->filepermissions);
}
开发者ID:JP-Git,项目名称:moodle,代码行数:26,代码来源:locallib.php


注:本文中的bootstrap_renderer::early_error_content方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。