Exemplo n.º 1
0
 /**
  * Constructor for RenderCache
  *
  * Sets up paths and gets the list of groups from file
  */
 public static function __static()
 {
     //Define the cache path and url
     self::$cache_path = HABARI_PATH . '/' . self::$rel_cache_path;
     self::$cache_url = Site::get_url('habari') . '/' . self::$rel_cache_path;
     //If the cache directory doesn't exist, make it
     if (!is_dir(self::$cache_path)) {
         mkdir(self::$cache_path, 0755);
     }
     //Enable only if the cache directory now exists and is writable
     self::$enabled = is_dir(self::$cache_path) && is_writeable(self::$cache_path);
     //Give an error if the cache directory is not writable
     if (!self::$enabled) {
         Session::error(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled. The user, or group, which your web server is running as, needs to have read, write, and execute permissions on this directory."), self::$cache_path), 'RenderCache');
         EventLog::log(sprintf(_t("The cache directory '%s' is not writable - the cache is disabled."), self::$cache_path), 'notice', 'RenderCache', 'habari');
         return;
     }
     //Get the list of group names
     $group_file = self::get_group_list_file();
     if (file_exists($group_file)) {
         self::$group_list = unserialize(file_get_contents($group_file));
     } else {
         self::$group_list = array();
     }
 }
Exemplo n.º 2
0
 public function clear_cache($ui)
 {
     Session::notice(_t('All rendered LaTeX images in the cache have been deleted.'));
     //Expire all cached images
     $group = 'jLaTeX';
     $name = '*';
     RenderCache::expire(array($group, $name), 'glob');
     return false;
 }