Index: C:/www/39/kernel/classes/ezstaticcache.php =================================================================== --- C:/www/39/kernel/classes/ezstaticcache.php (revision 18955) +++ C:/www/39/kernel/classes/ezstaticcache.php (working copy) @@ -430,6 +427,15 @@ } $fileContentCache = array(); + $doneDestList = array(); + $ini =& eZINI::instance( 'staticcache.ini'); + $clearByCronjob = ($ini->variable( 'CacheSettings', 'CronjobCacheClear' ) == 'enabled'); + + if ( $clearByCronjob ) + { + include_once( "lib/ezdb/classes/ezdb.php" ); + $db =& eZDB::instance(); + } foreach ( $GLOBALS['eZStaticCache-ActionList'] as $action ) { @@ -438,17 +444,31 @@ switch( $action ) { case 'store': list( $destination, $source ) = $parameters; - if ( ! isset( $fileContentCache[$source] ) ) - { - $fileContentCache[$source] = @file_get_contents( $source ); - } - if ( $fileContentCache[$source] === false ) + + if ( isset( $doneDestList[$destination] ) ) + continue 2; + + if ( $clearByCronjob ) { - eZDebug::writeNotice( 'Could not grab content, is the hostname correct and Apache running?', 'Static Cache' ); + $param = $db->escapeString( $destination . ',' . $source ); + $db->query( 'INSERT INTO ezpending_actions( action, param ) VALUES ( \'static_store\', \''. $param . '\' )' ); + $doneDestList[$destination] = 1; } else - { - eZStaticCache::storeCachedFile( $destination, $fileContentCache[$source] ); + { + if ( ! isset( $fileContentCache[$source] ) ) + { + $fileContentCache[$source] = @file_get_contents( $source ); + } + if ( $fileContentCache[$source] === false ) + { + eZDebug::writeNotice( 'Could not grab content, is the hostname correct and Apache running?', 'Static Cache' ); + } + else + { + eZStaticCache::storeCachedFile( $destination, $fileContentCache[$source] ); + $doneDestList[$destination] = 1; + } } break; }