Gollem::expireCache PHP Method

expireCache() public static method

Expire a folder cache entry.
public static expireCache ( string $dir )
$dir string The directory name.
    public static function expireCache($dir)
    {
        global $conf;
        if (!empty($conf['foldercache']['use_cache']) && !empty($conf['cache']['driver']) && $conf['cache']['driver'] != 'none') {
            $cache = $GLOBALS['injector']->getInstance('Horde_Cache');
            $cache->expire(self::_getCacheID($dir));
        }
    }

Usage Example

Esempio n. 1
0
 case 'clear_items':
 case 'paste_items':
     if ($edit_perms && is_array($vars->items) && count($vars->items)) {
         foreach ($vars->items as $val) {
             if (isset($clipboard[$val])) {
                 $file = $clipboard[$val];
                 if ($vars->actionID == 'paste_items') {
                     try {
                         if ($file['action'] == 'cut') {
                             Gollem::moveFile($file['backend'], $file['path'], $file['name'], $backkey, $old_dir);
                         } else {
                             Gollem::copyFile($file['backend'], $file['path'], $file['name'], $backkey, $old_dir);
                         }
                         Gollem::expireCache($old_dir);
                         if ($file['action'] == 'cut') {
                             Gollem::expireCache($file['path']);
                         }
                         $notification->push(sprintf(_("%s was successfully pasted."), $file['name'], $old_dir), 'horde.success');
                     } catch (Horde_Vfs_Exception $e) {
                         $notification->push(sprintf(_("Cannot paste \"%s\" (file cleared from clipboard): %s"), $file['name'], $e->getMessage()), 'horde.error');
                     }
                 }
                 unset($clipboard[$val]);
             }
         }
         $session->set('gollem', 'clipboard', array_values($clipboard));
     }
     break;
 case 'change_sortby':
     if (isset($vars->sortby)) {
         $prefs->setValue('sortby', $vars->sortby);