Beispiel #1
0
 public function clearInMemoryCaches()
 {
     Archive::clearStaticCache();
     DataTableManager::getInstance()->deleteAll();
     Option::clearCache();
     Site::clearCache();
     Cache::deleteTrackerCache();
     PiwikCache::getTransientCache()->flushAll();
     PiwikCache::getEagerCache()->flushAll();
     PiwikCache::getLazyCache()->flushAll();
     ArchiveTableCreator::clear();
     \Piwik\Plugins\ScheduledReports\API::$cache = array();
     Singleton::clearAll();
     PluginsArchiver::$archivers = array();
     $_GET = $_REQUEST = array();
     Translate::reset();
     self::getConfig()->Plugins;
     // make sure Plugins exists in a config object for next tests that use Plugin\Manager
     // since Plugin\Manager uses getFromGlobalConfig which doesn't init the config object
 }
Beispiel #2
0
 protected function prepareAllPluginsArchive($visits, $visitsConverted)
 {
     $pluginsArchiver = new PluginsArchiver($this->params, $this->isArchiveTemporary());
     if ($this->mustProcessVisitCount($visits) || $this->doesRequestedPluginIncludeVisitsSummary()) {
         $metrics = $pluginsArchiver->callAggregateCoreMetrics();
         $visits = $metrics['nb_visits'];
         $visitsConverted = $metrics['nb_visits_converted'];
     }
     if ($this->isThereSomeVisits($visits)) {
         $pluginsArchiver->callAggregateAllPlugins($visits, $visitsConverted);
     }
     $idArchive = $pluginsArchiver->finalizeArchive();
     if (!$this->params->isSingleSiteDayArchive() && $visits) {
         ArchiveSelector::purgeOutdatedArchives($this->params->getPeriod()->getDateStart());
     }
     return array($idArchive, $visits);
 }
 /**
  * @expectedException \Piwik\Tracker\Db\DbException
  * @expectedExceptionMessage Failed query foo bar - caused by plugin MyPluginName
  * @expectedExceptionCode 42
  */
 public function test_purgeOutdatedArchives_PurgesCorrectTemporaryArchives_WhileKeepingNewerTemporaryArchives_WithBrowserTriggeringEnabled()
 {
     $this->pluginsArchiver->callAggregateAllPlugins(1, 1);
 }
Beispiel #4
0
 protected function prepareAllPluginsArchive($visits, $visitsConverted)
 {
     $pluginsArchiver = new PluginsArchiver($this->params, $this->isArchiveTemporary());
     if ($this->mustProcessVisitCount($visits) || $this->doesRequestedPluginIncludeVisitsSummary()) {
         $metrics = $pluginsArchiver->callAggregateCoreMetrics();
         $visits = $metrics['nb_visits'];
         $visitsConverted = $metrics['nb_visits_converted'];
     }
     if ($this->isThereSomeVisits($visits)) {
         $pluginsArchiver->callAggregateAllPlugins($visits, $visitsConverted);
     }
     $idArchive = $pluginsArchiver->finalizeArchive();
     return array($idArchive, $visits);
 }