<?php
QUnit_Global::includeClass('QCore_Bl_Job');

class Affiliate_Scripts_Bl_CacheClean extends QCore_Bl_Job
{
    function process()
    {
        $filenames = glob(CACHE_PATH."*.xml");
        
        if (is_array($filenames) && count($filenames) > 0) {
            foreach ($filenames as $filename) {
                if ((time() - filemtime($filename)) > 2*3600) {
                    unlink($filename);
                }
                
                if ($this->interrupt()) return;
            }
        }
        
        $this->finish();        
    }
}
?>
