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


PHP Profiler::instance方法代码示例

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


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

示例1: wfProfileOut

/**
 * Stop profiling of a function
 * @param $functionname String: name of the function we have profiled
 */
function wfProfileOut($functionname = 'missing')
{
    global $wgProfiler;
    if ($wgProfiler instanceof Profiler || isset($wgProfiler['class'])) {
        Profiler::instance()->profileOut($functionname);
    }
}
开发者ID:seedbank,项目名称:old-repo,代码行数:11,代码来源:Profiler.php

示例2: __construct

 /**
  * Override the default Symphony constructor to initialise the Log, Config
  * and Database objects for installation/update. This allows us to use the
  * normal accessors.
  */
 protected function __construct()
 {
     self::$Profiler = Profiler::instance();
     self::$Profiler->sample('Engine Initialisation');
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     // Include the default Config for installation.
     include INSTALL . '/includes/config_default.php';
     static::initialiseConfiguration($settings);
     // Initialize date/time
     define_safe('__SYM_DATE_FORMAT__', self::Configuration()->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::Configuration()->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::Configuration()->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     DateTimeObj::setSettings(self::Configuration()->get('region'));
     // Initialize Language, Logs and Database
     static::initialiseLang();
     static::initialiseLog(INSTALL_LOGS . '/install');
     static::initialiseDatabase();
     // Initialize error handlers
     GenericExceptionHandler::initialise(Symphony::Log());
     GenericErrorHandler::initialise(Symphony::Log());
 }
开发者ID:roshinebagha,项目名称:Symphony-Test,代码行数:31,代码来源:class.installer.php

示例3: show

 /**
  * purge is slightly weird because it can be either formed or formless depending
  * on user permissions
  */
 public function show()
 {
     $this->setHeaders();
     // This will throw exceptions if there's a problem
     $this->checkCanExecute($this->getUser());
     $user = $this->getUser();
     if ($user->pingLimiter('purge')) {
         // TODO: Display actionthrottledtext
         return;
     }
     if ($user->isAllowed('purge')) {
         // This will update the database immediately, even on HTTP GET.
         // Lots of uses may exist for this feature, so just ignore warnings.
         Profiler::instance()->getTransactionProfiler()->resetExpectations();
         $this->redirectParams = wfArrayToCgi(array_diff_key($this->getRequest()->getQueryValues(), ['title' => null, 'action' => null]));
         if ($this->onSubmit([])) {
             $this->onSuccess();
         }
     } else {
         $this->redirectParams = $this->getRequest()->getVal('redirectparams', '');
         $form = $this->getForm();
         if ($form->show()) {
             $this->onSuccess();
         }
     }
 }
开发者ID:claudinec,项目名称:galan-wiki,代码行数:30,代码来源:PurgeAction.php

示例4: execute

 /**
  * Main execution point
  *
  * @param null|string $code Confirmation code passed to the page
  * @throws PermissionsError
  * @throws ReadOnlyError
  * @throws UserNotLoggedIn
  */
 function execute($code)
 {
     // Ignore things like master queries/connections on GET requests.
     // It's very convenient to just allow formless link usage.
     $trxProfiler = Profiler::instance()->getTransactionProfiler();
     $this->setHeaders();
     $this->checkReadOnly();
     $this->checkPermissions();
     // This could also let someone check the current email address, so
     // require both permissions.
     if (!$this->getUser()->isAllowed('viewmyprivateinfo')) {
         throw new PermissionsError('viewmyprivateinfo');
     }
     if ($code === null || $code === '') {
         $this->requireLogin('confirmemail_needlogin');
         if (Sanitizer::validateEmail($this->getUser()->getEmail())) {
             $this->showRequestForm();
         } else {
             $this->getOutput()->addWikiMsg('confirmemail_noemail');
         }
     } else {
         $old = $trxProfiler->setSilenced(true);
         $this->attemptConfirm($code);
         $trxProfiler->setSilenced($old);
     }
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:34,代码来源:SpecialConfirmemail.php

示例5: getInstance

 /**
  * Get singleton instance
  * @return Profiler
  */
 public static function getInstance()
 {
     if (!isset(self::$instance)) {
         self::$instance = new Profiler();
     }
     return self::$instance;
 }
开发者ID:unruthless,项目名称:ThinkUp,代码行数:11,代码来源:class.Profiler.php

示例6: __construct

 /**
  * The Symphony constructor initialises the class variables of Symphony.
  * It will set the DateTime settings, define new date constants and initialise
  * the correct Language for the currently logged in Author. If magic quotes
  * are enabled, Symphony will sanitize the `$_SERVER`, `$_COOKIE`,
  * `$_GET` and `$_POST` arrays. The constructor loads in
  * the initial Configuration values from the `CONFIG` file
  */
 protected function __construct()
 {
     self::$Profiler = Profiler::instance();
     if (get_magic_quotes_gpc()) {
         General::cleanArray($_SERVER);
         General::cleanArray($_COOKIE);
         General::cleanArray($_GET);
         General::cleanArray($_POST);
     }
     // Set date format throughout the system
     define_safe('__SYM_DATE_FORMAT__', self::Configuration()->get('date_format', 'region'));
     define_safe('__SYM_TIME_FORMAT__', self::Configuration()->get('time_format', 'region'));
     define_safe('__SYM_DATETIME_FORMAT__', __SYM_DATE_FORMAT__ . self::Configuration()->get('datetime_separator', 'region') . __SYM_TIME_FORMAT__);
     DateTimeObj::setSettings(self::Configuration()->get('region'));
     self::initialiseErrorHandler();
     // Initialize language management
     Lang::initialize();
     Lang::set(self::$Configuration->get('lang', 'symphony'));
     self::initialiseCookie();
     // If the user is not a logged in Author, turn off the verbose error messages.
     if (!self::isLoggedIn() && is_null(self::$Author)) {
         GenericExceptionHandler::$enabled = false;
     }
     // Engine is ready.
     self::$Profiler->sample('Engine Initialisation');
 }
开发者ID:jurajkapsz,项目名称:symphony-2,代码行数:34,代码来源:class.symphony.php

示例7: __construct

 /**
  * Construct a factory based on a configuration array (typically from $wgLBFactoryConf)
  * @param array $conf
  */
 public function __construct(array $conf)
 {
     if (isset($conf['readOnlyReason']) && is_string($conf['readOnlyReason'])) {
         $this->readOnlyReason = $conf['readOnlyReason'];
     }
     $this->chronProt = $this->newChronologyProtector();
     $this->trxProfiler = Profiler::instance()->getTransactionProfiler();
 }
开发者ID:Gomyul,项目名称:mediawiki,代码行数:12,代码来源:LBFactory.php

示例8: __construct

	/**
	 * Begin profiling of a function and return an object that ends profiling of
	 * the function when that object leaves scope. As long as the object is not
	 * specifically linked to other objects, it will fall out of scope at the same
	 * moment that the function to be profiled terminates.
	 *
	 * This is typically called like:
	 * <code>$section = new ProfileSection( __METHOD__ );</code>
	 *
	 * @param string $name Name of the function to profile
	 */
	public function __construct( $name ) {
		$this->name = $name;
		if ( Profiler::$__instance === null ) { // use this directly to reduce overhead
			Profiler::instance();
		}
		if ( !( Profiler::$__instance instanceof ProfilerStub ) ) {
			$this->enabled = true;
			Profiler::$__instance->profileIn( $this->name );
		}
	}
开发者ID:nahoj,项目名称:mediawiki_ynh,代码行数:21,代码来源:Profiler.php

示例9: execute

 function execute($code)
 {
     // Ignore things like master queries/connections on GET requests.
     // It's very convenient to just allow formless link usage.
     Profiler::instance()->getTransactionProfiler()->resetExpectations();
     $this->setHeaders();
     $this->checkReadOnly();
     $this->checkPermissions();
     $this->attemptInvalidate($code);
 }
开发者ID:Kaph-Noir,项目名称:mediawiki,代码行数:10,代码来源:SpecialEmailInvalidate.php

示例10: applyDefaultConfig

 /**
  * @param array $lbConf Config for LBFactory::__construct()
  * @param Config $mainConfig Main config object from MediaWikiServices
  * @return array
  */
 public static function applyDefaultConfig(array $lbConf, Config $mainConfig)
 {
     global $wgCommandLineMode;
     $lbConf += ['localDomain' => new DatabaseDomain($mainConfig->get('DBname'), null, $mainConfig->get('DBprefix')), 'profiler' => Profiler::instance(), 'trxProfiler' => Profiler::instance()->getTransactionProfiler(), 'replLogger' => LoggerFactory::getInstance('DBReplication'), 'queryLogger' => LoggerFactory::getInstance('DBQuery'), 'connLogger' => LoggerFactory::getInstance('DBConnection'), 'perfLogger' => LoggerFactory::getInstance('DBPerformance'), 'errorLogger' => [MWExceptionHandler::class, 'logException'], 'cliMode' => $wgCommandLineMode, 'hostname' => wfHostname(), 'readOnlyReason' => wfConfiguredReadOnlyReason()];
     if ($lbConf['class'] === 'LBFactorySimple') {
         if (isset($lbConf['servers'])) {
             // Server array is already explicitly configured; leave alone
         } elseif (is_array($mainConfig->get('DBservers'))) {
             foreach ($mainConfig->get('DBservers') as $i => $server) {
                 if ($server['type'] === 'sqlite') {
                     $server += ['dbDirectory' => $mainConfig->get('SQLiteDataDir')];
                 } elseif ($server['type'] === 'postgres') {
                     $server += ['port' => $mainConfig->get('DBport')];
                 }
                 $lbConf['servers'][$i] = $server + ['schema' => $mainConfig->get('DBmwschema'), 'tablePrefix' => $mainConfig->get('DBprefix'), 'flags' => DBO_DEFAULT, 'sqlMode' => $mainConfig->get('SQLMode'), 'utf8Mode' => $mainConfig->get('DBmysql5')];
             }
         } else {
             $flags = DBO_DEFAULT;
             $flags |= $mainConfig->get('DebugDumpSql') ? DBO_DEBUG : 0;
             $flags |= $mainConfig->get('DBssl') ? DBO_SSL : 0;
             $flags |= $mainConfig->get('DBcompress') ? DBO_COMPRESS : 0;
             $server = ['host' => $mainConfig->get('DBserver'), 'user' => $mainConfig->get('DBuser'), 'password' => $mainConfig->get('DBpassword'), 'dbname' => $mainConfig->get('DBname'), 'schema' => $mainConfig->get('DBmwschema'), 'tablePrefix' => $mainConfig->get('DBprefix'), 'type' => $mainConfig->get('DBtype'), 'load' => 1, 'flags' => $flags, 'sqlMode' => $mainConfig->get('SQLMode'), 'utf8Mode' => $mainConfig->get('DBmysql5')];
             if ($server['type'] === 'sqlite') {
                 $server['dbDirectory'] = $mainConfig->get('SQLiteDataDir');
             } elseif ($server['type'] === 'postgres') {
                 $server['port'] = $mainConfig->get('DBport');
             }
             $lbConf['servers'] = [$server];
         }
         if (!isset($lbConf['externalClusters'])) {
             $lbConf['externalClusters'] = $mainConfig->get('ExternalServers');
         }
     } elseif ($lbConf['class'] === 'LBFactoryMulti') {
         if (isset($lbConf['serverTemplate'])) {
             $lbConf['serverTemplate']['schema'] = $mainConfig->get('DBmwschema');
             $lbConf['serverTemplate']['sqlMode'] = $mainConfig->get('SQLMode');
             $lbConf['serverTemplate']['utf8Mode'] = $mainConfig->get('DBmysql5');
         }
     }
     // Use APC/memcached style caching, but avoids loops with CACHE_DB (T141804)
     $sCache = MediaWikiServices::getInstance()->getLocalServerObjectCache();
     if ($sCache->getQoS($sCache::ATTR_EMULATION) > $sCache::QOS_EMULATION_SQL) {
         $lbConf['srvCache'] = $sCache;
     }
     $cCache = ObjectCache::getLocalClusterInstance();
     if ($cCache->getQoS($cCache::ATTR_EMULATION) > $cCache::QOS_EMULATION_SQL) {
         $lbConf['memCache'] = $cCache;
     }
     $wCache = MediaWikiServices::getInstance()->getMainWANObjectCache();
     if ($wCache->getQoS($wCache::ATTR_EMULATION) > $wCache::QOS_EMULATION_SQL) {
         $lbConf['wanCache'] = $wCache;
     }
     return $lbConf;
 }
开发者ID:paladox,项目名称:mediawiki,代码行数:59,代码来源:MWLBFactory.php

示例11: execute

 public function execute()
 {
     $backend = FileBackendGroup::singleton()->get($this->getOption('b1'));
     $this->doPerfTest($backend);
     if ($this->getOption('b2')) {
         $backend = FileBackendGroup::singleton()->get($this->getOption('b2'));
         $this->doPerfTest($backend);
     }
     $profiler = Profiler::instance();
     $profiler->setTemplated(true);
     //NOTE: as of MW1.21, $profiler->logData() is called implicitly by doMaintenance.php.
 }
开发者ID:mangowi,项目名称:mediawiki,代码行数:12,代码来源:fileOpPerfTest.php

示例12: wfProfileOut

/**
 * Stop profiling of a function
 * @param $functionname String: name of the function we have profiled
 */
function wfProfileOut($functionname = 'missing')
{
    global $wgProfiler;
    // Wikia change - @author: wladek - 2x faster
    if ($wgProfiler instanceof Profiler) {
        if (!$wgProfiler instanceof ProfilerStub) {
            $wgProfiler->profileOut($functionname);
        }
    } elseif (isset($wgProfiler['class'])) {
        Profiler::instance()->profileOut($functionname);
    }
}
开发者ID:Tjorriemorrie,项目名称:app,代码行数:16,代码来源:Profiler.php

示例13: getInstance

 /**
  * Return a \Profiler instance
  *
  * @note Profiler::$__instance only made public in 1.22 therefore
  * we use our own static to keep overhead at a minimum
  *
  * @see $wgProfiler
  * @see http://www.mediawiki.org/wiki/Profiling#Profiling
  *
  * @since 1.9
  *
  * @return \Profiler|null
  */
 public static function getInstance()
 {
     // Nothing we can do to avoid the global state here until we have
     // public access to Profiler::$__instance
     $profiler = isset($GLOBALS['wgProfiler']['class']);
     if (self::$instance === null && $profiler) {
         self::$instance = \Profiler::instance();
     }
     if (!$profiler) {
         self::reset();
     }
     return self::$instance;
 }
开发者ID:whysasse,项目名称:kmwiki,代码行数:26,代码来源:Profiler.php

示例14: execute

 public function execute()
 {
     $backend = FileBackendGroup::singleton()->get($this->getOption('b1'));
     $this->doPerfTest($backend);
     if ($this->getOption('b2')) {
         $backend = FileBackendGroup::singleton()->get($this->getOption('b2'));
         $this->doPerfTest($backend);
     }
     $profiler = Profiler::instance();
     $profiler->setTemplated(true);
     $profiler->logData();
     // prints
 }
开发者ID:seedbank,项目名称:old-repo,代码行数:13,代码来源:fileOpPerfTest.php

示例15: outputPage

 /**
  * Overridden to make changes to resource loader
  *
  * @param null|OutputPage $out
  */
 function outputPage(OutputPage $out = null)
 {
     global $wgScript, $wgMobileFrontend2Logo;
     $out = $this->getOutput();
     $request = $this->getRequest();
     $user = $this->getUser();
     $title = $this->getTitle();
     // We need to disable all the default RL modules, do that like this
     $out->clearAllModules();
     // Add the mobile js
     $out->addModules('ext.mobileFrontend2');
     // TODO: Hook for adding modules
     Profiler::instance()->setTemplated(true);
     $this->initPage($out);
     $tpl = $this->setupTemplate($this->template, 'skins');
     // Give the skin (us) to the template
     $tpl->setRef('skin', $this);
     // Language stuff
     $lang = $this->getLanguage();
     $userlang = $lang->getHtmlCode();
     $userdir = $lang->getDir();
     $tpl->set('lang', $userlang);
     $tpl->set('dir', $userdir);
     // Title
     $tpl->set('title', $out->getPageTitle());
     $tpl->set('pagetitle', $out->getHTMLTitle());
     // Scriptpath (Used for search and forms)
     $tpl->setRef('wgScript', $wgScript);
     // Mobile stuff
     $tpl->setRef('mobilelogopath', $wgMobileFrontend2Logo);
     # Add a <div class="mw-content-ltr/rtl"> around the body text
     # not for special pages or file pages AND only when viewing AND if the page exists
     # (or is in MW namespace, because that has default content)
     if (!in_array($title->getNamespace(), array(NS_SPECIAL, NS_FILE)) && in_array($request->getVal('action', 'view'), array('view', 'historysubmit')) && ($title->exists() || $title->getNamespace() == NS_MEDIAWIKI)) {
         $pageLang = $title->getPageLanguage();
         $realBodyAttribs = array('lang' => $pageLang->getHtmlCode(), 'dir' => $pageLang->getDir(), 'class' => 'mw-content-' . $pageLang->getDir());
         $out->mBodytext = Html::rawElement('div', $realBodyAttribs, $out->mBodytext);
     }
     $tpl->setRef('bodycontent', MobileFrontend2_PostParse::mangle($out->mBodytext));
     // CSS & JS
     // Make these last
     $tpl->set('headscripts', $this->getHeadScripts($out));
     $tpl->set('csslinks', $out->buildCssLinks());
     $tpl->set('bottomscripts', $this->bottomScripts());
     // Debug comments and stuff
     $tpl->set('debughtml', $this->generateDebugHTML());
     // Output
     $res = $tpl->execute();
     // result may be an error
     $this->printOrError($res);
 }
开发者ID:schwarer2006,项目名称:wikia,代码行数:56,代码来源:Mobile.php


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