/**
     * @param string $siteAccess
     * @return array
     */
    public static function getMappingSiteAccess($siteAccess = null)
    {
        if(!$siteAccess)
            $siteAccessList = eZSiteAccess::siteAccessList();
        else
            $siteAccessList = array($siteAccess);

        $ClusterSiteAccess = array();
        foreach($siteAccessList as $siteAccess)
        {
            $activeExtensions = eZINI::getSiteAccessIni($siteAccess["name"], "site.ini")->variable("ExtensionSettings", "ActiveAccessExtensions");
            foreach($activeExtensions as $extension)
            {
                if(strpos($extension, 'cluster', 0) === 0)
                {
                    $cluster = $extension;
                    break;
                }
            }

            if($cluster)
                $ClusterSiteAccess[$cluster] = $siteAccess["name"];
        }

        return $ClusterSiteAccess;
    }
 /**
  * Checks if $siteAccessName matches a configured siteaccess
  * @param $siteAccessName
  * @return bool
  */
 public static function exists($siteAccessName)
 {
     foreach (eZSiteAccess::siteAccessList() as $siteaccessListItem) {
         if ($siteaccessListItem['name'] == $siteAccessName) {
             return true;
         }
     }
     return false;
 }
{
    $cli->error('Time has to be an int');
    $script->shutdown(1);
}

/* @var $db eZDB */
$db = class_exists('eZXDB')
    ? eZXDB::instance()
    : eZDB::instance();

$locales = fetchLocales($db, $time);

if ( !empty($locales) )
{
    $currentSiteAccess = eZSiteAccess::current();
    $siteAccessList = eZSiteAccess::siteAccessList();
    $locale2siteAccess = array();

    foreach ( $siteAccessList as $siteAccess )
    {
        eZSiteAccess::load($siteAccess);
        $ini = eZINI::instance();
        $locale = $ini->variable( 'RegionalSettings', 'Locale' );
        if ( !isset($locale2siteAccess[$locale]) )
        {
            $locale2siteAccess[$locale] = array();
        }
        $locale2siteAccess[$locale][] = $siteAccess;
    }

    foreach ($locales as $locale)