deleteFile() public static method

Delete a file using the current Gollem session settings.
public static deleteFile ( string $dir, string $name )
$dir string The directory name.
$name string The filename to delete.
Ejemplo n.º 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);
 }
Ejemplo n.º 2
0
                     $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 {
                     try {
                         Gollem::deleteFile($old_dir, $item);
                         Gollem::expireCache($old_dir);
                         $notification->push(_("File deleted: ") . $item, 'horde.success');
                     } catch (Gollem_Exception $e) {
                         $notification->push(sprintf(_("Unable to delete file %s: %s"), $item, $e->getMessage()), 'horde.error');
                     }
                 }
             }
         }
     }
     break;
 case 'upload_file':
     if ($edit_perms) {
         for ($i = 1, $l = count($_FILES); $i <= $l; ++$i) {
             $val = 'file_upload_' . $i;
             if (isset($_FILES[$val]) && $_FILES[$val]['error'] != 4) {