diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-07-26 17:56:32 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-07-26 17:56:32 +0200 |
commit | d26f87e738314db7820f39f74f42865ff20f7bd7 (patch) | |
tree | 6bcf58c0b4f374f504eddbe197d83e7aa176c5db /lib | |
parent | 3725cd079b96dff489d60aadfbd585045af033f8 (diff) | |
download | nextcloud-server-d26f87e738314db7820f39f74f42865ff20f7bd7.tar.gz nextcloud-server-d26f87e738314db7820f39f74f42865ff20f7bd7.zip |
Smarter remove of etag properties for path
Diffstat (limited to 'lib')
-rw-r--r-- | lib/connector/sabre/node.php | 20 | ||||
-rw-r--r-- | lib/filesystem.php | 1 |
2 files changed, 18 insertions, 3 deletions
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php index 22506f27cf6..f268f8b57c4 100644 --- a/lib/connector/sabre/node.php +++ b/lib/connector/sabre/node.php @@ -233,7 +233,23 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr * @param string $path Path of the file */ static public function removeETagPropertyForPath($path) { - $query = OC_DB::prepare( 'DELETE FROM *PREFIX*properties WHERE userid = ? AND propertypath = ? AND propertyname = ?' ); - $query->execute( array( OC_User::getUser(), $path, self::GETETAG_PROPERTYNAME )); + // remove tags from this and parent paths + $paths = array(); + while ($path != '/' && $path != '') { + $paths[] = $path; + $path = dirname($path); + } + if (empty($paths)) { + return; + } + $paths[] = $path; + $path_placeholders = join(',', array_fill(0, count($paths), '?')); + $query = OC_DB::prepare( 'DELETE FROM *PREFIX*properties' + .' WHERE userid = ?' + .' AND propertyname = ?' + .' AND propertypath IN ('.$path_placeholders.')' + ); + $vals = array( OC_User::getUser(), self::GETETAG_PROPERTYNAME ); + $query->execute(array_merge( $vals, $paths )); } } diff --git a/lib/filesystem.php b/lib/filesystem.php index 530d50139b4..47626c05ae2 100644 --- a/lib/filesystem.php +++ b/lib/filesystem.php @@ -480,7 +480,6 @@ class OC_Filesystem{ $path=$params['oldpath']; } OC_Connector_Sabre_Node::removeETagPropertyForPath($path); - OC_Connector_Sabre_Node::removeETagPropertyForPath(dirname($path)); } } OC_Hook::connect('OC_Filesystem','post_write', 'OC_Filesystem','removeETagHook'); |