isBrowserTriggerEnabled() public static method

public static isBrowserTriggerEnabled ( )
Exemplo n.º 1
0
 private function oneClick_Copy()
 {
     /*
      * Make sure the execute bit is set for this shell script
      */
     if (!Rules::isBrowserTriggerEnabled()) {
         @chmod($this->pathRootExtractedPiwik . '/misc/cron/archive.sh', 0755);
     }
     $model = new Model();
     /*
      * Copy all files to PIWIK_INCLUDE_PATH.
      * These files are accessed through the dispatcher.
      */
     Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_INCLUDE_PATH);
     $model->removeGoneFiles($this->pathRootExtractedPiwik, PIWIK_INCLUDE_PATH);
     /*
      * These files are visible in the web root and are generally
      * served directly by the web server.  May be shared.
      */
     if (PIWIK_INCLUDE_PATH !== PIWIK_DOCUMENT_ROOT) {
         /*
          * Copy PHP files that expect to be in the document root
          */
         $specialCases = array('/index.php', '/piwik.php', '/js/index.php');
         foreach ($specialCases as $file) {
             Filesystem::copy($this->pathRootExtractedPiwik . $file, PIWIK_DOCUMENT_ROOT . $file);
         }
         /*
          * Copy the non-PHP files (e.g., images, css, javascript)
          */
         Filesystem::copyRecursive($this->pathRootExtractedPiwik, PIWIK_DOCUMENT_ROOT, true);
         $model->removeGoneFiles($this->pathRootExtractedPiwik, PIWIK_DOCUMENT_ROOT);
     }
     /*
      * Config files may be user (account) specific
      */
     if (PIWIK_INCLUDE_PATH !== PIWIK_USER_PATH) {
         Filesystem::copyRecursive($this->pathRootExtractedPiwik . '/config', PIWIK_USER_PATH . '/config');
     }
     Filesystem::unlinkRecursive($this->pathRootExtractedPiwik, true);
     Filesystem::clearPhpCaches();
 }
Exemplo n.º 2
0
 private function handleGeneralSettingsAdmin($view)
 {
     // Whether to display or not the general settings (cron, beta, smtp)
     $view->isGeneralSettingsAdminEnabled = self::isGeneralSettingsAdminEnabled();
     if ($view->isGeneralSettingsAdminEnabled) {
         $this->displayWarningIfConfigFileNotWritable();
     }
     $enableBrowserTriggerArchiving = Rules::isBrowserTriggerEnabled();
     $todayArchiveTimeToLive = Rules::getTodayArchiveTimeToLive();
     $showWarningCron = false;
     if (!$enableBrowserTriggerArchiving && $todayArchiveTimeToLive < 3600) {
         $showWarningCron = true;
     }
     $view->showWarningCron = $showWarningCron;
     $view->todayArchiveTimeToLive = $todayArchiveTimeToLive;
     $view->enableBrowserTriggerArchiving = $enableBrowserTriggerArchiving;
     $view->enableBetaReleaseCheck = Config::getInstance()->Debug['allow_upgrades_to_beta'];
     $view->mail = Config::getInstance()->mail;
     $pluginUpdateCommunication = new UpdateCommunication();
     $view->canUpdateCommunication = $pluginUpdateCommunication->canBeEnabled();
     $view->enableSendPluginUpdateCommunication = $pluginUpdateCommunication->isEnabled();
 }
Exemplo n.º 3
0
 /**
  * Returns a timestamp indicating outdated archives older than this timestamp (processed before) can be purged.
  *
  * @return int|bool  Outdated archives older than this timestamp should be purged
  */
 protected function getOldestTemporaryArchiveToKeepThreshold()
 {
     $temporaryArchivingTimeout = Rules::getTodayArchiveTimeToLive();
     if (Rules::isBrowserTriggerEnabled()) {
         // If Browser Archiving is enabled, it is likely there are many more temporary archives
         // We delete more often which is safe, since reports are re-processed on demand
         return Date::factory($this->now - 2 * $temporaryArchivingTimeout)->getDateTime();
     }
     // If cron core:archive command is building the reports, we should keep all temporary reports from today
     return $this->yesterday->getDateTime();
 }
Exemplo n.º 4
0
 private function logArchiveTimeoutInfo()
 {
     $this->logSection("NOTES");
     // Recommend to disable browser archiving when using this script
     if (Rules::isBrowserTriggerEnabled()) {
         $this->logger->info("- If you execute this script at least once per hour (or more often) in a crontab, you may disable 'Browser trigger archiving' in Piwik UI > Settings > General Settings.");
         $this->logger->info("  See the doc at: http://piwik.org/docs/setup-auto-archiving/");
     }
     $this->logger->info("- Reports for today will be processed at most every " . $this->todayArchiveTimeToLive . " seconds. You can change this value in Piwik UI > Settings > General Settings.");
     $this->logger->info("- Reports for the current week/month/year will be refreshed at most every " . $this->processPeriodsMaximumEverySeconds . " seconds.");
     // Try and not request older data we know is already archived
     if ($this->lastSuccessRunTimestamp !== false) {
         $dateLast = time() - $this->lastSuccessRunTimestamp;
         $this->logger->info("- Archiving was last executed without error " . $this->formatter->getPrettyTimeFromSeconds($dateLast, true) . " ago");
     }
 }
Exemplo n.º 5
0
 public static function isRequestAuthorizedToArchive()
 {
     return Rules::isBrowserTriggerEnabled() || SettingsServer::isArchivePhpTriggered();
 }
Exemplo n.º 6
0
 /**
  * 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;
 }
Exemplo n.º 7
0
 protected static function isRequestAuthorizedToArchive()
 {
     return !self::$archivingDisabledByTests && (Rules::isBrowserTriggerEnabled() || Common::isPhpCliMode() || Piwik::isUserIsSuperUser() && SettingsServer::isArchivePhpTriggered());
 }
Exemplo n.º 8
0
 private function handleGeneralSettingsAdmin($view)
 {
     // Whether to display or not the general settings (cron, beta, smtp)
     $view->isGeneralSettingsAdminEnabled = self::isGeneralSettingsAdminEnabled();
     if ($view->isGeneralSettingsAdminEnabled) {
         $this->displayWarningIfConfigFileNotWritable();
     }
     $enableBrowserTriggerArchiving = Rules::isBrowserTriggerEnabled();
     $todayArchiveTimeToLive = Rules::getTodayArchiveTimeToLive();
     $showWarningCron = false;
     if (!$enableBrowserTriggerArchiving && $todayArchiveTimeToLive < 3600) {
         $showWarningCron = true;
     }
     $view->showWarningCron = $showWarningCron;
     $view->todayArchiveTimeToLive = $todayArchiveTimeToLive;
     $view->todayArchiveTimeToLiveDefault = Rules::getTodayArchiveTimeToLiveDefault();
     $view->enableBrowserTriggerArchiving = $enableBrowserTriggerArchiving;
     $releaseChannels = $this->makeReleaseChannels();
     $activeChannelId = $releaseChannels->getActiveReleaseChannel()->getId();
     $allChannels = array();
     foreach ($releaseChannels->getAllReleaseChannels() as $channel) {
         $allChannels[] = array('id' => $channel->getId(), 'name' => $channel->getName(), 'description' => $channel->getDescription(), 'active' => $channel->getId() === $activeChannelId);
     }
     $view->releaseChannels = $allChannels;
     $view->mail = Config::getInstance()->mail;
     $pluginUpdateCommunication = new UpdateCommunication();
     $view->canUpdateCommunication = $pluginUpdateCommunication->canBeEnabled();
     $view->enableSendPluginUpdateCommunication = $pluginUpdateCommunication->isEnabled();
 }
Exemplo n.º 9
0
 private function handleGeneralSettingsAdmin($view)
 {
     // Whether to display or not the general settings (cron, beta, smtp)
     $view->isGeneralSettingsAdminEnabled = self::isGeneralSettingsAdminEnabled();
     if ($view->isGeneralSettingsAdminEnabled) {
         $this->displayWarningIfConfigFileNotWritable();
     }
     $enableBrowserTriggerArchiving = Rules::isBrowserTriggerEnabled();
     $todayArchiveTimeToLive = Rules::getTodayArchiveTimeToLive();
     $showWarningCron = false;
     if (!$enableBrowserTriggerArchiving && $todayArchiveTimeToLive < 3600) {
         $showWarningCron = true;
     }
     $view->showWarningCron = $showWarningCron;
     $view->todayArchiveTimeToLive = $todayArchiveTimeToLive;
     $view->todayArchiveTimeToLiveDefault = Rules::getTodayArchiveTimeToLiveDefault();
     $view->enableBrowserTriggerArchiving = $enableBrowserTriggerArchiving;
     $view->mail = Config::getInstance()->mail;
 }