Smarter remove of etag properties for path

remotes/origin/stable45
Bart Visscher 14 years ago
parent 3725cd079b
commit d26f87e738
  1. 20
      lib/connector/sabre/node.php
  2. 1
      lib/filesystem.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 ));
}
}

@ -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');

Loading…
Cancel
Save