public static function getKnownSegmentsToArchive()
{
$cacheId = 'KnownSegmentsToArchive';
$cache = PiwikCache::getTransientCache();
if ($cache->contains($cacheId)) {
return $cache->fetch($cacheId);
}
$segments = Config::getInstance()->Segments;
$segmentsToProcess = isset($segments['Segments']) ? $segments['Segments'] : array();
/**
* Triggered during the cron archiving process to collect segments that
* should be pre-processed for all websites. The archiving process will be launched
* for each of these segments when archiving data.
*
* This event can be used to add segments to be pre-processed. If your plugin depends
* on data from a specific segment, this event could be used to provide enhanced
* performance.
*
* _Note: If you just want to add a segment that is managed by the user, use the
* SegmentEditor API._
*
* **Example**
*
* Piwik::addAction('Segments.getKnownSegmentsToArchiveAllSites', function (&$segments) {
* $segments[] = 'country=jp;city=Tokyo';
* });
*
* @param array &$segmentsToProcess List of segment definitions, eg,
*
* array(
* 'browserCode=ff;resolution=800x600',
* 'country=jp;city=Tokyo'
* )
*
* Add segments to this array in your event handler.
*/
Piwik::postEvent('Segments.getKnownSegmentsToArchiveAllSites', array(&$segmentsToProcess));
$segmentsToProcess = array_unique($segmentsToProcess);
$cache->save($cacheId, $segmentsToProcess);
return $segmentsToProcess;
}