Gollem::deleteFolder PHP Метод

deleteFolder() публичный статический Метод

Delete a folder using the current Gollem session settings.
public static deleteFolder ( string $dir, string $name )
$dir string The subdirectory name.
$name string The folder name to delete.
    public static function deleteFolder($dir, $name)
    {
        if (!self::verifyDir($dir)) {
            throw new Gollem_Exception(sprintf(_("Access denied to folder \"%s\"."), $dir));
        }
        try {
            $GLOBALS['injector']->getInstance('Gollem_Vfs')->deleteFolder($dir, $name, $GLOBALS['prefs']->getValue('recursive_deletes') != 'disabled');
        } catch (Horde_Vfs_Exception $e) {
            throw new Gollem_Exception($e);
        }
        $shares = $GLOBALS['injector']->getInstance('Gollem_Shares');
        try {
            $share = $shares->getShare($GLOBALS['session']->get('gollem', 'backend_key') . '|' . $dir . '/' . $name);
            $shares->removeShare($share);
        } catch (Horde_Exception_NotFound $e) {
        } catch (Horde_Share_Exception $e) {
            throw new Gollem_Exception($e);
        }
    }

Usage Example

Пример #1
0
 /**
  * Removes a file or folder from the VFS
  *
  * @param string $path  Path of file or folder to delete
  */
 public function path_delete($path)
 {
     // Clean off the irrelevant portions of the path
     $path = Gollem::stripAPIPath($path);
     if ($path == '') {
         // We are at the root of gollem.  Any writes at this level are
         // disallowed.
         throw new Gollem_Exception(_("The application folder can not be deleted."));
     }
     $backend_key = $this->_getBackend($path);
     throw new Gollem_Exception('Permssion checks not implemented yet.');
     // Trim off the backend_key (and '/') to get the VFS relative path
     $fullpath = substr($path, strlen($backend_key) + 1);
     // Get the VFS-standard $name,$path pair
     list($name, $path) = Gollem::getVFSPath($fullpath);
     // Apparently Gollem::verifyDir() (called by deleteF* next) needs to
     // see a path with a leading '/'
     $path = $backends[$backend_key]['root'] . $path;
     $GLOBALS['injector']->getInstance('Gollem_Vfs')->isFolder($path, $name) ? Gollem::deleteFolder($path, $name) : Gollem::deleteFile($path, $name);
 }
All Usage Examples Of Gollem::deleteFolder