/**
 * @param $clusters
 * @param $options
 * @return void
 */
function generateCache($clusters, $options) {
    $cli = eZCLI::instance();

    foreach ( $clusters as $clusterPath )
    {
        $clusterIdentifier = basename( $clusterPath );

        $configurations = MMRssGenerator::createConfigurationsForCluster( $clusterIdentifier );
        foreach ( $configurations as $type => $configType )
        {
            foreach ( $configType as $frequency => $config )
            {
                $cli->output( "$clusterIdentifier - $type - $frequency" );
                $params = array(
                    'type' => $type,
                    'frequency' => $frequency,
                );

                //set date to daily, weekly and monthly
                if(isset($options['begin' . ucfirst($frequency)]) && !empty($options['begin' . ucfirst($frequency)])) {
                    //test if end frequence is set
                    if(!isset($options['end' . ucfirst($frequency)])) {
                        $options['end' . ucfirst($frequency)] = '*';
                    }

                    if(empty($options['end' . ucfirst($frequency)])) {
                        $options['end' . ucfirst($frequency)] = '*';
                    }

                    //add frequence date parameters
                    $params['beginDate'] = $options['begin' . ucfirst($frequency)];
                    $params['endDate'] = $options['end' . ucfirst($frequency)];

                    //if date params set, use different path
                    $params['path'] = "/rssManualCache/";
                }

                $rssGenerator = new MMRssGenerator( $params, $clusterIdentifier );
                $rssGenerator->getXML( true );
            }
        }
    }
}
<?php

/* @type $cli eZCli */

ini_set('display_errors', '1');
error_reporting( E_ALL );

$clusters = array_keys( eZINI::instance('merck.ini')->variable('DomainMappingSettings', 'ClusterDomains') );
foreach ( $clusters as $clusterPath )
{
    $clusterIdentifier = basename( $clusterPath );
    
    $configurations = MMRssGenerator::createConfigurationsForCluster( $clusterIdentifier );
    foreach ( $configurations as $type => $configType )
    {
        foreach ( $configType as $frequency => $config )
        {
            $cli->output( "$clusterIdentifier - $type - $frequency" );
            $params = array(
                'type' => $type,
                'frequency' => $frequency
            );
            $rssGenerator = new MMRssGenerator( $params, $clusterIdentifier );
            $rssGenerator->getXML( true );
        }
    }
}