Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- From 37e94480d4ebd94057d37ed1a043c482cb140d51 Mon Sep 17 00:00:00 2001
- From: Olivier Goffart <ogoffart@woboq.com>
- Date: Thu, 22 Nov 2012 14:24:14 +0100
- Subject: [PATCH] Hack to get moving works from one directory to another
- this enable DAV to call rename even when moving between directory
- WARNING: does need the backend to support it
- ---
- 3rdparty/Sabre/DAV/Tree.php | 11 +++++++----
- lib/connector/sabre/node.php | 12 ++++++++++++
- 2 files changed, 19 insertions(+), 4 deletions(-)
- diff --git a/3rdparty/Sabre/DAV/Tree.php b/3rdparty/Sabre/DAV/Tree.php
- index 5021639..1b04726 100755
- --- a/3rdparty/Sabre/DAV/Tree.php
- +++ b/3rdparty/Sabre/DAV/Tree.php
- @@ -78,12 +78,15 @@ abstract class Sabre_DAV_Tree {
- list($sourceDir, $sourceName) = Sabre_DAV_URLUtil::splitPath($sourcePath);
- list($destinationDir, $destinationName) = Sabre_DAV_URLUtil::splitPath($destinationPath);
- + $renameable = $this->getNodeForPath($sourcePath);
- +
- if ($sourceDir===$destinationDir) {
- - $renameable = $this->getNodeForPath($sourcePath);
- - $renameable->setName($destinationName);
- - } else {
- + $renameable->setName($destinationPath);
- + } else if ($renameable instanceof OC_Connector_Sabre_Node) {
- + $renameable->move($destinationPath);
- + } else {
- $this->copy($sourcePath,$destinationPath);
- - $this->getNodeForPath($sourcePath)->delete();
- + $renameable->delete();
- }
- $this->markDirty($sourceDir);
- $this->markDirty($destinationDir);
- diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
- index ba1788c..1ae3176 100644
- --- a/lib/connector/sabre/node.php
- +++ b/lib/connector/sabre/node.php
- @@ -97,6 +97,18 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
- }
- + public function move($newPath) {
- + $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 ));
- +
- + }
- +
- public function setFileinfoCache($fileinfo_cache)
- {
- $this->fileinfo_cache = $fileinfo_cache;
- --
- 1.7.12.1
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement