Example #1
0
 /**
  * Set the cache file which will be used for this process
  *
  * @return boolean
  * @author Anthony Short
  */
 public static function cache_set($path)
 {
     $checksum = "";
     $cached_mod_time = 0;
     # Make sure the files/folders are writeable
     if (!is_dir($path)) {
         throw new Scaffold_Exception("Cache path does not exist.");
     }
     if (!is_writable($path)) {
         throw new Scaffold_Exception("Cache path is not writable.");
     }
     if (self::$flags != null) {
         $checksum = "-" . implode("_", array_keys(self::$flags));
     }
     # Determine the name of the cache file
     self::$cached_file = join_path($path, preg_replace('#(.+)(\\.css)$#i', "\$1{$checksum}\$2", self::config('core.request.relative_file')));
     if (file_exists(self::$cached_file)) {
         # When was the cache last modified
         $cached_mod_time = (int) filemtime(self::$cached_file);
     }
     self::config_set('core.cache.mod_time', $cached_mod_time);
 }