Пример #1
0
 /**
  * Moves the node
  *
  * @param string $name The new name
  * @return void
  */
 public function move($newPath)
 {
     \GO::debug("FSD::move({$newPath})");
     if (!is_dir(dirname($newPath))) {
         throw new \Exception('Invalid move!');
     }
     $folder = $this->_getFolder();
     if (!$folder->checkPermissionLevel(\GO\Base\Model\Acl::WRITE_PERMISSION)) {
         throw new Sabre\DAV\Exception\Forbidden();
     }
     $destFsFolder = new \GO\Base\Fs\Folder($newPath);
     //\GO::debug("Dest folder: ".$destFsFolder->stripFileStoragePath());
     $destFolder = \GO\Files\Model\Folder::model()->findByPath($destFsFolder->parent()->stripFileStoragePath());
     $folder->parent_id = $destFolder->id;
     $folder->name = $destFsFolder->name();
     $folder->save();
     $this->relpath = $folder->path;
     $this->path = \GO::config()->file_storage_path . $this->relpath;
 }