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


PHP Piwik_Common::getCacheGeneral方法代码示例

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


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

示例1: runScheduledTasks

 /**
  * Tracker requests will automatically trigger the Scheduled tasks.
  * This is useful for users who don't setup the cron,
  * but still want daily/weekly/monthly PDF reports emailed automatically.
  *
  * This is similar to calling the API CoreAdminHome.runScheduledTasks (see misc/cron/archive.sh)
  *
  * @param int  $now  Current timestamp
  */
 public static function runScheduledTasks($now)
 {
     // Currently, there is no hourly tasks. When there are some,
     // this could be too agressive minimum interval (some hours would be skipped in case of low traffic)
     $minimumInterval = Piwik_Config::getInstance()->Tracker['scheduled_tasks_min_interval'];
     // If the user disabled browser archiving, he has already setup a cron
     // To avoid parallel requests triggering the Scheduled Tasks,
     // Get last time tasks started executing
     $cache = Piwik_Common::getCacheGeneral();
     if ($minimumInterval <= 0 || empty($cache['isBrowserTriggerArchivingEnabled'])) {
         printDebug("-> Scheduled tasks not running in Tracker: Browser archiving is disabled.");
         return;
     }
     $nextRunTime = $cache['lastTrackerCronRun'] + $minimumInterval;
     if (isset($GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS']) && $GLOBALS['PIWIK_TRACKER_DEBUG_FORCE_SCHEDULED_TASKS'] || $cache['lastTrackerCronRun'] === false || $nextRunTime < $now) {
         $cache['lastTrackerCronRun'] = $now;
         Piwik_Common::setCacheGeneral($cache);
         Piwik_Common::initCorePiwikInTrackerMode();
         Piwik_SetOption('lastTrackerCronRun', $cache['lastTrackerCronRun']);
         printDebug('-> Scheduled Tasks: Starting...');
         // save current user privilege and temporarily assume super user privilege
         $isSuperUser = Piwik::isUserIsSuperUser();
         // Scheduled tasks assume Super User is running
         Piwik::setUserIsSuperUser();
         // While each plugins should ensure that necessary languages are loaded,
         // we ensure English translations at least are loaded
         Piwik_Translate::getInstance()->loadEnglishTranslation();
         $resultTasks = Piwik_TaskScheduler::runTasks();
         // restore original user privilege
         Piwik::setUserIsSuperUser($isSuperUser);
         printDebug($resultTasks);
         printDebug('Finished Scheduled Tasks.');
     } else {
         printDebug("-> Scheduled tasks not triggered.");
     }
     printDebug("Next run will be from: " . date('Y-m-d H:i:s', $nextRunTime) . ' UTC');
 }
开发者ID:nomoto-ubicast,项目名称:piwik,代码行数:46,代码来源:Common.php


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