Gollem::changePermissions PHP Method

changePermissions() public static method

Change permissions on files using the current Gollem session settings.
public static changePermissions ( string $dir, string $name, string $permission )
$dir string The directory name.
$name string The filename to change permissions on.
$permission string The permission mode to set.
    public static function changePermissions($dir, $name, $permission)
    {
        if (!self::verifyDir($dir)) {
            throw new Gollem_Exception(sprintf(_("Access denied to folder \"%s\"."), $dir));
        }
        try {
            $GLOBALS['injector']->getInstance('Gollem_Vfs')->changePermissions($dir, $name, $permission);
        } catch (Horde_Vfs_Exception $e) {
            throw new Gollem_Exception($e);
        }
    }

Usage Example

Ejemplo n.º 1
0
                     $notification->push(sprintf(_("\"%s\" renamed to \"%s\""), $old[$i], $new[$i]), 'horde.success');
                 } catch (Gollem_Exception $e) {
                     $notification->push($e, 'horde.error');
                 }
             }
             Gollem::expireCache($old_dir);
         }
     }
     break;
 case 'chmod_modify':
 case 'delete_items':
     if ($delete_perms && is_array($vars->items) && count($vars->items)) {
         foreach ($vars->items as $item) {
             if ($vars->actionID == 'chmod_modify' && $vars->chmod) {
                 try {
                     Gollem::changePermissions(Gollem::$backend['dir'], $item, $vars->chmod);
                     Gollem::expireCache($old_dir);
                     $notification->push(_("Chmod done: ") . $item, 'horde.success');
                 } catch (Gollem_Exception $e) {
                     $notification->push(sprintf(_("Cannot chmod %s: %s"), $item, $e->getMessage()), 'horde.error');
                 }
             } elseif ($vars->actionID == 'delete_items') {
                 if ($gollem_vfs->isFolder($old_dir, $item)) {
                     try {
                         Gollem::deleteFolder($old_dir, $item);
                         Gollem::expireCache($old_dir);
                         $notification->push(_("Folder removed: ") . $item, 'horde.success');
                     } catch (Gollem_Exception $e) {
                         $notification->push(sprintf(_("Unable to delete folder %s: %s"), $item, $e->getMessage()), 'horde.error');
                     }
                 } else {