本文整理汇总了PHP中Piwik\Tracker::restoreTrackerPlugins方法的典型用法代码示例。如果您正苦于以下问题:PHP Tracker::restoreTrackerPlugins方法的具体用法?PHP Tracker::restoreTrackerPlugins怎么用?PHP Tracker::restoreTrackerPlugins使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik\Tracker
的用法示例。
在下文中一共展示了Tracker::restoreTrackerPlugins方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCacheGeneral
/**
* Returns contents of general (global) cache.
* If the cache file tmp/cache/tracker/general.php does not exist yet, create it
*
* @return array
*/
public static function getCacheGeneral()
{
$cache = self::getCache();
$cacheContent = $cache->fetch(self::$cacheIdGeneral);
if (false !== $cacheContent) {
return $cacheContent;
}
Tracker::initCorePiwikInTrackerMode();
$cacheContent = array('isBrowserTriggerEnabled' => Rules::isBrowserTriggerEnabled(), 'lastTrackerCronRun' => Option::get('lastTrackerCronRun'));
/**
* Triggered before the [general tracker cache](/guides/all-about-tracking#the-tracker-cache)
* is saved to disk. This event can be used to add extra content to the cache.
*
* Data that is used during tracking but is expensive to compute/query should be
* cached to keep tracking efficient. One example of such data are options
* that are stored in the piwik_option table. Querying data for each tracking
* request means an extra unnecessary database query for each visitor action. Using
* a cache solves this problem.
*
* **Example**
*
* public function setTrackerCacheGeneral(&$cacheContent)
* {
* $cacheContent['MyPlugin.myCacheKey'] = Option::get('MyPlugin_myOption');
* }
*
* @param array &$cacheContent Array of cached data. Each piece of data must be
* mapped by name.
*/
Piwik::postEvent('Tracker.setTrackerCacheGeneral', array(&$cacheContent));
self::setCacheGeneral($cacheContent);
Common::printDebug("General tracker cache was re-created.");
Tracker::restoreTrackerPlugins();
return $cacheContent;
}