/**
  * Renames the node
  *
  * @param string $name The new name
  * @return void
  */
 public function setName($name)
 {
     list($parentPath, ) = Sabre_DAV_URLUtil::splitPath($this->path);
     list(, $newName) = Sabre_DAV_URLUtil::splitPath($name);
     $newPath = $parentPath . '/' . $newName;
     $oldPath = $this->path;
     OC_Filesystem::rename($this->path, $newPath);
     $this->path = $newPath;
     $query = OC_DB::prepare('UPDATE *PREFIX*properties SET propertypath = ? WHERE userid = ? AND propertypath = ?');
     $query->execute(array($newPath, OC_User::getUser(), $oldPath));
 }
예제 #2
0
 /**
  * move a file or folder
  *
  * @param dir  $sourceDir
  * @param file $source
  * @param dir  $targetDir
  * @param file $target
  */
 public static function move($sourceDir, $source, $targetDir, $target)
 {
     if (OC_User::isLoggedIn() && ($sourceDir != '' || $source != 'Shared')) {
         $targetFile = self::normalizePath($targetDir . '/' . $target);
         $sourceFile = self::normalizePath($sourceDir . '/' . $source);
         return OC_Filesystem::rename($sourceFile, $targetFile);
     }
 }
 /**
  * move a file or folder
  *
  * @param dir  $sourceDir
  * @param file $source
  * @param dir  $targetDir
  * @param file $target
  */
 public static function move($sourceDir, $source, $targetDir, $target)
 {
     if (OC_User::isLoggedIn()) {
         $targetFile = $targetDir . '/' . $target;
         $sourceFile = $sourceDir . '/' . $source;
         return OC_Filesystem::rename($sourceFile, $targetFile);
     }
 }