/** * This method is use for check if you must launch the job * * @access public * @static */ public static function exec() { $cache_file = Config::getCacheFolder() . '/' . Config::getCacheFilename(); if (file_exists($cache_file) === false) { self::launch(); } else { $cache_mtime = filemtime($cache_file); $cache_regenerate = time() - Config::getCacheTime() * 60; if ($cache_mtime < $cache_regenerate) { self::launch(); } } }
/** * This function initialize, if neccesary, the filename with the configuration * * @access protected * @static */ protected static function init() { if (self::$filename === null) { self::$filename = Config::getCacheFolder() . '/' . Config::getCacheFilename(); } }
/** * Get the cache and return the Strip object cached * * @param string $file The filename of the strip (only the filename and not the path) * @access public * @static * @throws Exception If the cache doesn't exist, an exception is throwed * @return Strip The Strip object related with the cache */ public static function getCache($file) { $strip_tmp = new Strip($file); $cache_file = Config::getCacheFolder() . '/' . $strip_tmp->getFilename() . '.php'; if (file_exists($cache_file) === false) { throw new Exception('The cache for "' . $file . '" doesn\'t exist!'); } $strip = file_get_contents($cache_file); return unserialize($strip); }