本文整理汇总了PHP中newrelic_disable_autorum函数的典型用法代码示例。如果您正苦于以下问题:PHP newrelic_disable_autorum函数的具体用法?PHP newrelic_disable_autorum怎么用?PHP newrelic_disable_autorum使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了newrelic_disable_autorum函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: __invoke
/**
* @param \Nette\Application\Application $application
* @param \Nette\Application\Request $request
*/
public function __invoke(Application $application, Request $request)
{
if (PHP_SAPI === 'cli') {
newrelic_background_job(TRUE);
}
$params = $request->getParameters();
$action = $request->getPresenterName();
if (isset($params[$this->actionKey])) {
$action = sprintf('%s:%s', $action, $params[$this->actionKey]);
}
if (!empty($this->map)) {
foreach ($this->map as $pattern => $appName) {
if ($pattern === '*') {
continue;
}
if (Strings::endsWith($pattern, '*')) {
$pattern = Strings::substring($pattern, 0, -1);
}
if (Strings::startsWith($pattern, ':')) {
$pattern = Strings::substring($pattern, 1);
}
if (Strings::startsWith($action, $pattern)) {
\VrtakCZ\NewRelic\Tracy\Bootstrap::setup($appName, $this->license);
break;
}
}
}
newrelic_name_transaction($action);
newrelic_disable_autorum();
}
示例2: performAction
/** Pass the request to our internal function.
* BEWARE! Data are passed as they have been supplied by the user,
* they should be carefully handled in the function processing the
* request.
*/
function performAction()
{
global $wgAjaxExportList, $wgOut, $wgUser;
if (empty($this->mode)) {
return;
}
/*
* Wikia Change - begin
*/
Transaction::setEntryPoint(Transaction::ENTRY_POINT_AJAX);
Transaction::setAttribute(Transaction::PARAM_FUNCTION, $this->func_name);
if (function_exists('newrelic_disable_autorum')) {
newrelic_disable_autorum();
}
/*
* Wikia Change - end
*/
wfProfileIn(__METHOD__);
if (!in_array($this->func_name, $wgAjaxExportList)) {
wfDebug(__METHOD__ . ' Bad Request for unknown function ' . $this->func_name . "\n");
wfHttpError(400, 'Bad Request', "unknown function " . (string) $this->func_name);
} elseif (!in_array('read', User::getGroupPermissions(array('*')), true) && !$wgUser->isAllowed('read')) {
wfHttpError(403, 'Forbidden', 'You must log in to view pages.');
} else {
wfDebug(__METHOD__ . ' dispatching ' . $this->func_name . "\n");
if (strpos($this->func_name, '::') !== false) {
$func = explode('::', $this->func_name, 2);
} else {
$func = $this->func_name;
}
try {
$result = call_user_func_array($func, $this->args);
if ($result === false || $result === null) {
wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . "no data returned\n");
/* Wikia changes start */
//let's avoid falling back to Iowa (500, 503) in this case,
//probably someone is asking for a non-existing dynamic method name
wfHttpError(501, 'Not Implemented', "{$this->func_name} returned no data");
} else {
if (is_string($result)) {
$result = new AjaxResponse($result);
}
$result->sendHeaders();
$result->printText();
wfDebug(__METHOD__ . ' dispatch complete for ' . $this->func_name . "\n");
}
} catch (Exception $e) {
wfDebug(__METHOD__ . ' ERROR while dispatching ' . $this->func_name . "(" . var_export($this->args, true) . "): " . get_class($e) . ": " . $e->getMessage() . "\n");
if (!headers_sent()) {
wfHttpError(500, 'Internal Error', $e->getMessage());
} else {
print $e->getMessage();
}
}
}
$wgOut = null;
wfProfileOut(__METHOD__);
}
示例3: __construct
/**
* Constructor method.
* Sets defaults -- no writing to memache, and a default search indexer instance
*/
public function __construct()
{
parent::__construct();
$this->service = new MediaWikiService();
$this->service->setGlobal('AllowMemcacheWrites', false)->setGlobal('AppStripsHtml', true);
if (function_exists('newrelic_disable_autorum')) {
newrelic_disable_autorum();
}
if (function_exists('newrelic_background_job')) {
newrelic_background_job(true);
}
}
示例4: handleRequest
public static function handleRequest()
{
if (extension_loaded('newrelic')) {
newrelic_disable_autorum();
}
// retrieve authentication attempt
if ($GLOBALS['Session']->hasAccountLevel('Developer')) {
$User = $GLOBALS['Session']->Person;
} else {
$authEngine = new \Sabre\HTTP\BasicAuth();
$authEngine->setRealm('Develop ' . \Site::$title);
$authUserPass = $authEngine->getUserPass();
// try to get user
$userClass = \User::$defaultClass;
$User = $userClass::getByLogin($authUserPass[0], $authUserPass[1]);
// send auth request if login is inadiquate
if (!$User || !$User->hasAccountLevel('Developer')) {
$authEngine->requireLogin();
die("You must login using a " . \Site::getConfig('primary_hostname') . " account with Developer access\n");
}
}
// store login to session
if (isset($GLOBALS['Session'])) {
$GLOBALS['Session'] = $GLOBALS['Session']->changeClass('UserSession', array('PersonID' => $User->ID));
}
// detect base path
$basePath = array_slice(\Site::$requestPath, 0, count(\Site::$resolvedPath));
// switch to JSON response mode
if (static::peekPath() == 'json') {
$basePath[] = static::$responseMode = static::shiftPath();
}
// handle /develop request
if ($_SERVER['REQUEST_METHOD'] == 'GET' && static::getResponseMode() == 'html' && !static::peekPath()) {
\RequestHandler::respond('app/ext', array('App' => \Sencha_App::getByName('EmergenceEditor'), 'mode' => 'production', 'title' => 'EmergenceEditor'));
}
// initial and configure SabreDAV
$server = new \Sabre\DAV\Server(new RootCollection());
$server->setBaseUri('/' . join('/', $basePath));
// The lock manager is reponsible for making sure users don't overwrite each others changes. Change 'data' to a different
// directory, if you're storing your data somewhere else.
# $lockBackend = new Sabre_DAV_Locks_Backend_FS('/tmp/dav-lock');
# $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend);
# $server->addPlugin($lockPlugin);
// filter temporary files
$server->addPlugin(new \Sabre\DAV\TemporaryFileFilterPlugin('/tmp/dav-tmp'));
// ?mount support
$server->addPlugin(new \Sabre\DAV\Mount\Plugin());
// emergence :)
$server->addPlugin(new \Emergence\DAV\ServerPlugin());
// All we need to do now, is to fire up the server
$server->exec();
}
示例5: respond
public static function respond($data, $exit = true)
{
if (extension_loaded('newrelic')) {
newrelic_disable_autorum();
}
$text = json_encode($data);
if ($text === false) {
throw new Exception('Failed to encode json data, json_last_error=' . json_last_error());
}
header('Content-type: application/json', true);
print $text;
Site::finishRequest($exit);
}
示例6: init
function init()
{
if (defined('DOING_CRON') && DOING_CRON == true) {
if ($this->settingsobj->get_setting('ignore_cron')) {
newrelic_ignore_transaction();
}
}
if (defined('DOING_AJAX') && DOING_AJAX == true) {
newrelic_disable_autorum();
}
if ($this->settingsobj->get_setting('application_id')) {
newrelic_set_appname($this->settingsobj->get_setting('application_id'));
}
if ($this->settingsobj->get_setting('enable_newrelic_errors')) {
}
}
示例7: __construct
public function __construct($go_newrelic)
{
// get the calling object
$this->go_newrelic = $go_newrelic;
// can't lazy load the config, we need
$this->config = $this->go_newrelic->config();
// the license key is typically set elsewhere during the daemon/module installation,
// but this allows some potential future where the license key is set in the WP dashboard
if (!empty($this->config['license'])) {
ini_set('newrelic.license', $this->config['license']);
}
// END if
// set the app name
newrelic_set_appname($this->go_newrelic->get_appname());
// basic settings
// make sure the config isn't empty or invalid for any of these
// ...sanity and validation intentionally skipped for performance reasons
ini_set('newrelic.framework', 'wordpress');
ini_set('newrelic.transaction_tracer.detail', $this->config['transaction-tracer-detail']);
ini_set('newrelic.error_collector.enabled', $this->config['error-collector-enabled']);
if (isset($this->config['capture-params']) && $this->config['capture-params']) {
newrelic_capture_params();
}
// END if
ini_set('newrelic.ignored_params', $this->go_newrelic->config('ignored-params'));
// set logging parameters based on request context
// ajax responses _cannot_ have RUM in them, for example
if (is_admin()) {
if (defined('DOING_AJAX') && DOING_AJAX) {
newrelic_disable_autorum();
}
// END if
} elseif (defined('DOING_CRON') && DOING_CRON) {
newrelic_disable_autorum();
} else {
// add more tracking of the template pieces
add_action('template_include', array($this, 'template_include'));
}
// END else
// track the user info
add_action('init', array($this, 'init'));
}
示例8: handleRequest
public static function handleRequest()
{
if (extension_loaded('newrelic')) {
newrelic_disable_autorum();
}
if (!Site::getConfig('inheritance_key')) {
Site::respondUnauthorized('Remote emergence access is disabled');
} elseif (empty($_REQUEST['accessKey']) || $_REQUEST['accessKey'] != Site::getConfig('inheritance_key')) {
// attempt to authenticate via developer session
if (!UserSession::getFromRequest()->hasAccountLevel('Developer')) {
Site::respondUnauthorized('Remote emergence access denied');
}
}
if ($_REQUEST['remote'] == 'parent') {
set_time_limit(1800);
$remoteParams = array();
if (!empty($_REQUEST['exclude'])) {
$remoteParams['exclude'] = $_REQUEST['exclude'];
}
HttpProxy::relayRequest(array('url' => static::buildUrl(Site::$pathStack, $remoteParams), 'autoAppend' => false, 'autoQuery' => false, 'timeout' => 500));
}
if (empty(Site::$pathStack[0])) {
return static::handleTreeRequest();
} elseif ($node = Site::resolvePath(Site::$pathStack)) {
if (method_exists($node, 'outputAsResponse')) {
$node->outputAsResponse(true);
} elseif (is_a($node, 'SiteCollection')) {
return static::handleTreeRequest($node);
} else {
Site::respondBadRequest();
}
} else {
header('HTTP/1.0 404 Not Found');
die('File not found');
}
}
示例9: newrelic_disable_autorum
<?php
/**
* @package XML_Sitemaps
*/
// This is to prevent issues with New Relics stupid auto injection of code. It's ugly but I don't want
// to deal with support requests for other people's wrong code...
if (extension_loaded('newrelic') && function_exists('newrelic_disable_autorum')) {
newrelic_disable_autorum();
}
$xsl = '<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="2.0"
xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns:image="http://www.google.com/schemas/sitemap-image/1.1"
xmlns:sitemap="http://www.sitemaps.org/schemas/sitemap/0.9"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html" version="1.0" encoding="UTF-8" indent="yes"/>
<xsl:template match="/">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XML Sitemap</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
body {
font-family: Helvetica, Arial, sans-serif;
font-size: 13px;
color: #545353;
}
table {
border: none;
border-collapse: collapse;
示例10: disable_autorum
/**
* Prevent the New Relic PHP extension from inserting its JavaScript
* for this transaction
*
* @access public
* @return void
*/
public function disable_autorum()
{
newrelic_disable_autorum();
}
示例11: wpcom_vip_disable_new_relic_js
/**
* Disable New Relic's browser metrics
*
* Removes NR's JavaScript for tracking browser metrics, including page load times, Apdex score, and more.
*
* Must be called at or before the `template_redirect` action.
*/
function wpcom_vip_disable_new_relic_js()
{
if (did_action('template_redirect') && !doing_action('template_redirect')) {
_doing_it_wrong(__FUNCTION__, 'New Relic’s browser tracking can only be disabled at or before the `template_redirect` action.', '1.0');
return;
}
if (function_exists('newrelic_disable_autorum')) {
newrelic_disable_autorum();
}
}
示例12: outputAsResponse
public function outputAsResponse($includeAuthor = false)
{
if (extension_loaded('newrelic')) {
newrelic_disable_autorum();
}
if (array_key_exists($this->MIMEType, static::$additionalHeaders)) {
$headers = static::$additionalHeaders[$this->MIMEType];
// if value is a string, it's an alias to another headers list
if (is_string($headers)) {
$headers = static::$additionalHeaders[$headers];
}
foreach ($headers as $header) {
header($header);
}
}
// use SHA1 for ETag and manifest-based caching
header('ETag: ' . $this->SHA1);
if (!empty($_GET['_sha1']) && $_GET['_sha1'] == $this->SHA1) {
$expires = 60 * 60 * 24 * 365;
header('Cache-Control: public, max-age=' . $expires);
header('Expires: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', time() + $expires));
header('Pragma: public');
}
// send 304 and exit if current version matches HTTP_IF_* check
if (!empty($_SERVER['HTTP_IF_NONE_MATCH']) && $_SERVER['HTTP_IF_NONE_MATCH'] == $this->SHA1) {
header('HTTP/1.0 304 Not Modified');
exit;
} elseif (!empty($_SERVER['HTTP_IF_MODIFIED_SINCE']) && strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']) >= $this->Timestamp) {
header('HTTP/1.0 304 Not Modified');
exit;
}
header('Content-Type: ' . $this->MIMEType);
header('Content-Length: ' . $this->Size);
header('Last-Modified: ' . gmdate('D, d M Y H:i:s \\G\\M\\T', $this->Timestamp));
if ($includeAuthor && $this->Author) {
header('Author: ' . $this->Author->EmailRecipient);
}
readfile($this->RealPath);
exit;
}
示例13: removeRumCode
public function removeRumCode($observer) {
if (extension_loaded('newrelic')) {
newrelic_disable_autorum();
}
}
示例14: ampforwp_disable_new_relic_scripts
function ampforwp_disable_new_relic_scripts($data)
{
if (!function_exists('newrelic_disable_autorum')) {
return $data;
}
if (function_exists('is_amp_endpoint') && is_amp_endpoint()) {
newrelic_disable_autorum();
}
return $data;
}
示例15: disableAutorum
/**
* Prevents output filter from attempting to insert RUM Javascript.
*/
public function disableAutorum()
{
if ($this->skip()) {
return;
}
newrelic_disable_autorum();
}