Exemple #1
0
 function getStatisticsImage($graph, $limit, $nntp, $language)
 {
     SpotTiming::start(__FUNCTION__);
     $spotStatistics = new SpotStatistics($this->_db);
     if (!array_key_exists($graph, $this->_spotImage->getValidStatisticsGraphs()) || !array_key_exists($limit, $this->_spotImage->getValidStatisticsLimits())) {
         $data = $this->_spotImage->createErrorImage(400);
         SpotTiming::stop(__FUNCTION__, array($graph, $limit, $nntp));
         return $data;
     }
     # if
     $lastUpdate = $this->_db->getLastUpdate($nntp['host']);
     $resourceid = $spotStatistics->getResourceid($graph, $limit, $language);
     $data = $this->_cache->getCache($resourceid, SpotCache::Statistics);
     if (!$data || $this->_activeRetriever || !$this->_settings->get('prepare_statistics') && (int) $data['stamp'] < $lastUpdate) {
         $data = $this->_spotImage->createStatistics($graph, $limit, $lastUpdate, $language);
         $this->_cache->saveCache($resourceid, SpotCache::Statistics, $data['metadata'], $data['content']);
     }
     # if
     $data['expire'] = true;
     SpotTiming::stop(__FUNCTION__, array($graph, $limit, $nntp));
     return $data;
 }