public static function getKnownSegmentsToArchiveForSite($idSite)
{
$cacheId = 'KnownSegmentsToArchiveForSite' . $idSite;
$cache = PiwikCache::getTransientCache();
if ($cache->contains($cacheId)) {
return $cache->fetch($cacheId);
}
$segments = array();
/**
* Triggered during the cron archiving process to collect segments that
* should be pre-processed for one specific site. The archiving process will be launched
* for each of these segments when archiving data for that one site.
*
* This event can be used to add segments to be pre-processed for one site.
*
* _Note: If you just want to add a segment that is managed by the user, you should use the
* SegmentEditor API._
*
* **Example**
*
* Piwik::addAction('Segments.getKnownSegmentsToArchiveForSite', function (&$segments, $idSite) {
* $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.
* @param int $idSite The ID of the site to get segments for.
*/
Piwik::postEvent('Segments.getKnownSegmentsToArchiveForSite', array(&$segments, $idSite));
$segments = array_unique($segments);
$cache->save($cacheId, $segments);
return $segments;
}