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


PHP wfIsDebugRawPage函数代码示例

本文整理汇总了PHP中wfIsDebugRawPage函数的典型用法代码示例。如果您正苦于以下问题:PHP wfIsDebugRawPage函数的具体用法?PHP wfIsDebugRawPage怎么用?PHP wfIsDebugRawPage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: wfLogProfilingData

/**
 * @todo document
 */
function wfLogProfilingData()
{
    global $wgDebugLogGroups, $wgDebugRawPage;
    $context = RequestContext::getMain();
    $request = $context->getRequest();
    $profiler = Profiler::instance();
    $profiler->setContext($context);
    $profiler->logData();
    $config = $context->getConfig();
    if ($config->get('StatsdServer')) {
        $statsdServer = explode(':', $config->get('StatsdServer'));
        $statsdHost = $statsdServer[0];
        $statsdPort = isset($statsdServer[1]) ? $statsdServer[1] : 8125;
        $statsdSender = new SocketSender($statsdHost, $statsdPort);
        $statsdClient = new StatsdClient($statsdSender);
        $statsdClient->send($context->getStats()->getBuffer());
    }
    # Profiling must actually be enabled...
    if ($profiler instanceof ProfilerStub) {
        return;
    }
    if (isset($wgDebugLogGroups['profileoutput']) && $wgDebugLogGroups['profileoutput'] === false) {
        // Explicitly disabled
        return;
    }
    if (!$wgDebugRawPage && wfIsDebugRawPage()) {
        return;
    }
    $ctx = array('elapsed' => $request->getElapsedTime());
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $ctx['forwarded_for'] = $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $ctx['client_ip'] = $_SERVER['HTTP_CLIENT_IP'];
    }
    if (!empty($_SERVER['HTTP_FROM'])) {
        $ctx['from'] = $_SERVER['HTTP_FROM'];
    }
    if (isset($ctx['forwarded_for']) || isset($ctx['client_ip']) || isset($ctx['from'])) {
        $ctx['proxy'] = $_SERVER['REMOTE_ADDR'];
    }
    // Don't load $wgUser at this late stage just for statistics purposes
    // @todo FIXME: We can detect some anons even if it is not loaded.
    // See User::getId()
    $user = $context->getUser();
    $ctx['anon'] = $user->isItemLoaded('id') && $user->isAnon();
    // Command line script uses a FauxRequest object which does not have
    // any knowledge about an URL and throw an exception instead.
    try {
        $ctx['url'] = urldecode($request->getRequestURL());
    } catch (Exception $ignored) {
        // no-op
    }
    $ctx['output'] = $profiler->getOutput();
    $log = LoggerFactory::getInstance('profileoutput');
    $log->info("Elapsed: {elapsed}; URL: <{url}>\n{output}", $ctx);
}
开发者ID:D66Ha,项目名称:mediawiki,代码行数:60,代码来源:GlobalFunctions.php

示例2: wfLogProfilingData

/**
 * @todo document
 */
function wfLogProfilingData()
{
    global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest;
    global $wgProfileLimit, $wgUser;
    $profiler = Profiler::instance();
    # Profiling must actually be enabled...
    if ($profiler->isStub()) {
        return;
    }
    // Get total page request time and only show pages that longer than
    // $wgProfileLimit time (default is 0)
    $now = wfTime();
    $elapsed = $now - $wgRequestTime;
    if ($elapsed <= $wgProfileLimit) {
        return;
    }
    $profiler->logData();
    // Check whether this should be logged in the debug file.
    if ($wgDebugLogFile == '' || !$wgDebugRawPage && wfIsDebugRawPage()) {
        return;
    }
    $forward = '';
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP'];
    }
    if (!empty($_SERVER['HTTP_FROM'])) {
        $forward .= ' from ' . $_SERVER['HTTP_FROM'];
    }
    if ($forward) {
        $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})";
    }
    // Don't load $wgUser at this late stage just for statistics purposes
    // @todo FIXME: We can detect some anons even if it is not loaded. See User::getId()
    if ($wgUser->isItemLoaded('id') && $wgUser->isAnon()) {
        $forward .= ' anon';
    }
    $log = sprintf("%s\t%04.3f\t%s\n", gmdate('YmdHis'), $elapsed, urldecode($wgRequest->getRequestURL() . $forward));
    wfErrorLog($log . $profiler->getOutput(), $wgDebugLogFile);
}
开发者ID:natalieschauser,项目名称:csp_media_wiki,代码行数:45,代码来源:GlobalFunctions.php

示例3: wfLogProfilingData

/**
 * @todo document
 */
function wfLogProfilingData()
{
    global $wgRequestTime, $wgDebugLogFile, $wgDebugLogGroups, $wgDebugRawPage;
    global $wgProfileLimit, $wgUser, $wgRequest;
    StatCounter::singleton()->flush();
    $profiler = Profiler::instance();
    # Profiling must actually be enabled...
    if ($profiler->isStub()) {
        return;
    }
    // Get total page request time and only show pages that longer than
    // $wgProfileLimit time (default is 0)
    $elapsed = microtime(true) - $wgRequestTime;
    if ($elapsed <= $wgProfileLimit) {
        return;
    }
    $profiler->logData();
    // Check whether this should be logged in the debug file.
    if (isset($wgDebugLogGroups['profileoutput']) && $wgDebugLogGroups['profileoutput'] === false) {
        // Explicitely disabled
        return;
    }
    if (!isset($wgDebugLogGroups['profileoutput']) && $wgDebugLogFile == '') {
        // Logging not enabled; no point going further
        return;
    }
    if (!$wgDebugRawPage && wfIsDebugRawPage()) {
        return;
    }
    $forward = '';
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP'];
    }
    if (!empty($_SERVER['HTTP_FROM'])) {
        $forward .= ' from ' . $_SERVER['HTTP_FROM'];
    }
    if ($forward) {
        $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})";
    }
    // Don't load $wgUser at this late stage just for statistics purposes
    // @todo FIXME: We can detect some anons even if it is not loaded. See User::getId()
    if ($wgUser->isItemLoaded('id') && $wgUser->isAnon()) {
        $forward .= ' anon';
    }
    // Command line script uses a FauxRequest object which does not have
    // any knowledge about an URL and throw an exception instead.
    try {
        $requestUrl = $wgRequest->getRequestURL();
    } catch (MWException $e) {
        $requestUrl = 'n/a';
    }
    $log = sprintf("%s\t%04.3f\t%s\n", gmdate('YmdHis'), $elapsed, urldecode($requestUrl . $forward));
    wfDebugLog('profileoutput', $log . $profiler->getOutput());
}
开发者ID:whysasse,项目名称:kmwiki,代码行数:60,代码来源:GlobalFunctions.php

示例4: wfLogProfilingData

/**
 * @todo document
 */
function wfLogProfilingData()
{
    global $wgRequestTime, $wgDebugLogFile, $wgDebugRawPage, $wgRequest;
    global $wgProfileLimit, $wgUser, $wgProfilingDataLogged;
    $wgProfilingDataLogged = true;
    $profiler = Profiler::instance();
    # Profiling must actually be enabled...
    if ($profiler->isStub()) {
        return;
    }
    // Get total page request time and only show pages that longer than
    // $wgProfileLimit time (default is 0)
    $elapsed = microtime(true) - $wgRequestTime;
    if ($elapsed <= $wgProfileLimit) {
        return;
    }
    $profiler->logData();
    // Check whether this should be logged in the debug file.
    if ($wgDebugLogFile == '' || !$wgDebugRawPage && wfIsDebugRawPage()) {
        return;
    }
    $forward = '';
    if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
        $forward = ' forwarded for ' . $_SERVER['HTTP_X_FORWARDED_FOR'];
    }
    if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
        $forward .= ' client IP ' . $_SERVER['HTTP_CLIENT_IP'];
    }
    if (!empty($_SERVER['HTTP_FROM'])) {
        $forward .= ' from ' . $_SERVER['HTTP_FROM'];
    }
    if ($forward) {
        $forward = "\t(proxied via {$_SERVER['REMOTE_ADDR']}{$forward})";
    }
    // Don't load $wgUser at this late stage just for statistics purposes
    // @todo FIXME: We can detect some anons even if it is not loaded. See User::getId()
    if ($wgUser->isItemLoaded('id') && $wgUser->isAnon()) {
        $forward .= ' anon';
    }
    // Wikia change - begin - FauxRequest::getRequestURL() is not implemented and throws exception
    // in maintenance scripts
    try {
        $log = sprintf("%s\t%04.3f\t%s\n", gmdate('YmdHis'), $elapsed, urldecode($wgRequest->getRequestURL() . $forward));
        wfErrorLog($log . $profiler->getOutput(), $wgDebugLogFile);
    } catch (MWException $e) {
        // double-check it is the case
        if ($e->getMessage() !== "FauxRequest::getRequestURL() not implemented") {
            throw $e;
        }
    }
    // Wikia change - end
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:55,代码来源:GlobalFunctions.php


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