Ejemplo n.º 1
0
 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // init vars
     $this->cachePath = BACKEND_CACHE_PATH . '/analytics';
     // get parameters
     $page = trim(SpoonFilter::getGetValue('page', null, ''));
     $pageId = trim(SpoonFilter::getGetValue('page_id', null, ''));
     $identifier = trim(SpoonFilter::getGetValue('identifier', null, ''));
     $startTimestamp = (int) trim(SpoonFilter::getGetValue('start_date', null, ''));
     $endTimestamp = (int) trim(SpoonFilter::getGetValue('end_date', null, ''));
     $force = trim(SpoonFilter::getGetValue('force', array('Y', 'N'), 'N')) == 'Y';
     $filename = null;
     // no parameters given? cronjob called
     if ($page == '' && $identifier == '' && $startTimestamp === 0 && $endTimestamp === 0) {
         // is everything still set?
         if (BackendAnalyticsHelper::getStatus() != 'UNAUTHORIZED') {
             // get interval
             $interval = BackendModel::getModuleSetting('analytics', 'interval', 'week');
             if ($interval == 'week') {
                 $interval .= ' -2 days';
             }
             // redefine vars
             $page = 'all';
             $startTimestamp = strtotime('-1' . $interval);
             $endTimestamp = time();
         }
     } elseif ($page != '' && $identifier != '' && $startTimestamp !== 0 && $endTimestamp !== 0) {
         // init vars
         $filename = $this->cachePath . '/' . $page . ($pageId != '' ? '_' . $pageId : '') . '_' . $identifier . '.txt';
         // is everything still set?
         if (BackendAnalyticsHelper::getStatus() != 'UNAUTHORIZED') {
             // create temporary file to indicate we're getting data
             SpoonFile::setContent($filename, 'busy1');
         } else {
             // set status in cache
             SpoonFile::setContent($filename, 'unauthorized');
             // stop here
             return;
         }
     } else {
         throw new SpoonException('Some parameters are missing.');
     }
     // get dashboard data
     $this->getDashboardData();
     // get data
     $this->getData($startTimestamp, $endTimestamp, $force, $page, $pageId, $filename);
     // cleanup cache
     $this->cleanupCache();
     // cleanup database
     $this->cleanupDatabase();
 }
Ejemplo n.º 2
0
 /**
  * Execute the action
  */
 public function execute()
 {
     parent::execute();
     // fork is no longer authorized to collect analytics data
     if (BackendAnalyticsHelper::getStatus() == 'UNAUTHORIZED') {
         // remove all parameters from the module settings
         BackendModel::setModuleSetting('analytics', 'session_token', null);
         BackendModel::setModuleSetting('analytics', 'account_name', null);
         BackendModel::setModuleSetting('analytics', 'table_id', null);
         BackendModel::setModuleSetting('analytics', 'profile_title', null);
         BackendAnalyticsModel::removeCacheFiles();
         BackendAnalyticsModel::clearTables();
         return;
     }
     $this->getData();
 }
Ejemplo n.º 3
0
 /**
  * Execute the action
  *
  * @return	void
  */
 public function execute()
 {
     // call parent, this will probably add some general CSS/JS or other required files
     parent::execute();
     // fork is no longer authorized to collect analytics data
     if (BackendAnalyticsHelper::getStatus() == 'UNAUTHORIZED') {
         // remove all parameters from the module settings
         BackendModel::setModuleSetting('analytics', 'session_token', null);
         BackendModel::setModuleSetting('analytics', 'account_name', null);
         BackendModel::setModuleSetting('analytics', 'table_id', null);
         BackendModel::setModuleSetting('analytics', 'profile_title', null);
         // remove cache files
         BackendAnalyticsModel::removeCacheFiles();
         // clear tables
         BackendAnalyticsModel::clearTables();
         // stop here
         return;
     }
     // get data
     $this->getData();
 }