本文整理汇总了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);
}
示例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);
}
示例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());
}
示例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
}