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


PHP CApp::getRequestUID方法代码示例

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


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

示例1: elseif

$long_request_log_level = false;
if ($bot && $bot_long_request_level) {
    $long_request_log_level = $bot_long_request_level;
} elseif (!$bot && $human_long_request_level) {
    $long_request_log_level = $human_long_request_level;
}
if (!$long_request_log_level) {
    return;
}
// If request is too slow
if ($duration > $long_request_log_level) {
    // We store it
    $long_request_log = new CLongRequestLog();
    $long_request_log->datetime = CMbDT::format(null, "%Y-%m-%d %H:%M:00");
    $long_request_log->duration = $duration;
    $long_request_log->server_addr = get_server_var('SERVER_ADDR');
    $long_request_log->user_id = CAppUI::$user->_id;
    // GET and POST params
    $long_request_log->_query_params_get = $_GET;
    $long_request_log->_query_params_post = $_POST;
    $session = $_SESSION;
    unset($session['AppUI']);
    unset($session['dPcompteRendu']['templateManager']);
    // SESSION params
    $long_request_log->_session_data = $session;
    // Unique Request ID
    $long_request_log->requestUID = CApp::getRequestUID();
    if ($msg = $long_request_log->store()) {
        trigger_error($msg, E_USER_WARNING);
    }
}
开发者ID:fbone,项目名称:mediboard4,代码行数:31,代码来源:long_request_log.php

示例2: writeHeader

 /**
  * Write HTTP header containing profiling data
  *
  * @return void
  */
 static function writeHeader()
 {
     if (!self::isProfiling()) {
         return;
     }
     if (headers_sent()) {
         return;
     }
     global $m, $action, $dosql;
     $req = "{$m}|" . (empty($dosql) ? $action : $dosql);
     header("X-Mb-Timing: " . json_encode(self::out()));
     header("X-Mb-Req: {$req}");
     header("X-Mb-RequestUID: " . CApp::getRequestUID());
 }
开发者ID:fbone,项目名称:mediboard4,代码行数:19,代码来源:CMbPerformance.class.php

示例3: exceptionHandler

/**
 * Custom exception handler with backtrace
 * 
 * @param exception $exception Thrown exception
 * 
 * @return void
 */
function exceptionHandler($exception)
{
    global $dPconfig;
    $time = date("Y-m-d H:i:s");
    // User information
    $user_id = null;
    $user_view = "";
    if (class_exists("CAppUI", false) && CAppUI::$user) {
        $user = CAppUI::$user;
        if ($user->_id) {
            $user_id = $user->_id;
            $user_view = $user->_view;
        }
    }
    // Server IP
    $server_ip = isset($_SERVER["SERVER_ADDR"]) ? $_SERVER["SERVER_ADDR"] : null;
    $file = mbRelativePath($exception->getFile());
    $line = $exception->getLine();
    $type = "exception";
    $text = $exception->getMessage();
    // Stacktrace
    $contexts = $exception->getTrace();
    foreach ($contexts as &$ctx) {
        unset($ctx['args']);
    }
    // Might noy be ready at the time error is thrown
    $session = isset($_SESSION) ? $_SESSION : array();
    unset($session['AppUI']);
    unset($session['dPcompteRendu']['templateManager']);
    $_all_params = array("GET" => $_GET, "POST" => $_POST, "SESSION" => $session);
    filterInput($_all_params);
    // CApp might not be ready yet as of early error handling
    $request_uid = null;
    if (class_exists("CApp", false)) {
        $request_uid = CApp::getRequestUID();
        CApp::$performance[CError::$_categories["exception"]]++;
    }
    $build_output = ini_get("display_errors");
    $save_to_file = false;
    $data = array("stacktrace" => $contexts, "param_GET" => $_all_params["GET"], "param_POST" => $_all_params["POST"], "session_data" => $_all_params["SESSION"]);
    if (@$dPconfig["error_logs_in_db"] && class_exists("CErrorLog")) {
        try {
            CErrorLog::insert($user_id, $server_ip, $time, $request_uid, $type, $text, $file, $line, $data);
        } catch (Exception $e) {
            $build_output = true;
            $save_to_file = true;
        }
    } else {
        $build_output = true;
        $save_to_file = true;
    }
    if ($build_output) {
        $hash = md5(serialize($contexts));
        $html_class = "big-warning";
        $log = "\n\n<div class='{$html_class}' title='{$hash}'>";
        if ($user_id) {
            $log .= "\n<strong>User: </strong>{$user_view} ({$user_id})";
        }
        $file = CError::openInIDE($file, $line);
        $log .= <<<HTML
  <strong>Time: </strong>{$time}
  <strong>Type: </strong>{$type}
  <strong>Text: </strong>{$text}
  <strong>File: </strong>{$file}
  <strong>Line: </strong>{$line}
HTML;
        foreach ($_all_params as $_type => $_params) {
            $log .= print_infos($_all_params[$_type], $_type);
        }
        foreach ($contexts as $context) {
            $function = isset($context["class"]) ? $context["class"] . ":" : "";
            $function .= $context["function"] . "()";
            $log .= "\n<strong>Function: </strong> {$function}";
            if (isset($context["file"])) {
                $log .= "\n<strong>File: </strong>" . CError::openInIDE($context["file"], isset($context["line"]) ? $context["line"] : null);
            }
            if (isset($context["line"])) {
                $log .= "\n<strong>Line: </strong>" . $context["line"];
            }
            $log .= "<br />";
        }
        $log .= "</div>";
        if ($save_to_file) {
            file_put_contents(LOG_PATH, $log, FILE_APPEND);
        }
        if (ini_get("display_errors")) {
            echo $log;
        }
    }
}
开发者ID:OpenXtrem,项目名称:mediboard-test,代码行数:97,代码来源:errors.php


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