[Pkg-owncloud-commits] [owncloud] 69/394: start implementing a solution to fix broken etags for shared files
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:11:29 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to annotated tag v4.5.10
in repository owncloud.
commit 166edb2cc14f9587bf95089149e0a4305b5d9832
Author: Björn Schießle <schiessle at owncloud.com>
Date: Tue Nov 6 13:28:42 2012 +0100
start implementing a solution to fix broken etags for shared files
---
lib/connector/sabre/node.php | 33 +++++++++++++++++++++++++++++----
1 file changed, 29 insertions(+), 4 deletions(-)
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index f87e9f9..01a4bd1 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -148,25 +148,38 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* @return bool|array
*/
public function updateProperties($properties) {
+ // get source path of shared files
+ if (!strncmp($this->path, '/Shared/', 8)) {
+ $source = OC_Filestorage_Shared::getSourcePath(str_replace('/Shared/', '', $this->path));
+ $parts = explode('/', $source, 4);
+ $user = $parts[1];
+ $path = '/'.$parts[3];
+ } else {
+ $user = OC_User::getUser();
+ $path = $this->path;
+ }
+
$existing = $this->getProperties(array());
foreach($properties as $propertyName => $propertyValue) {
// If it was null, we need to delete the property
if (is_null($propertyValue)) {
if(array_key_exists( $propertyName, $existing )) {
$query = OC_DB::prepare( 'DELETE FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?' );
- $query->execute( array( OC_User::getUser(), $this->path, $propertyName ));
+ $query->execute( array( $user, $path, $propertyName ));
}
}
else {
if( strcmp( $propertyName, self::LASTMODIFIED_PROPERTYNAME) === 0 ) {
+ error_log("propertyName: " . $propertyName);
$this->touch($propertyValue);
} else {
+ error_log("update/insert property: user: $user; path: $path");
if(!array_key_exists( $propertyName, $existing )) {
$query = OC_DB::prepare( 'INSERT INTO `*PREFIX*properties` (`userid`,`propertypath`,`propertyname`,`propertyvalue`) VALUES(?,?,?,?)' );
- $query->execute( array( OC_User::getUser(), $this->path, $propertyName,$propertyValue ));
+ $query->execute( array( $user, $path, $propertyName, $propertyValue ));
} else {
$query = OC_DB::prepare( 'UPDATE `*PREFIX*properties` SET `propertyvalue` = ? WHERE `userid` = ? AND `propertypath` = ? AND `propertyname` = ?' );
- $query->execute( array( $propertyValue,OC_User::getUser(), $this->path, $propertyName ));
+ $query->execute( array( $propertyValue, $user, $path, $propertyName ));
}
}
}
@@ -188,6 +201,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* @return array
*/
public function getProperties($properties) {
+ //TODO: Shared files?!?
if (is_null($this->property_cache)) {
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ?' );
$result = $query->execute( array( OC_User::getUser(), $this->path ));
@@ -234,9 +248,19 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
if (empty($tag)) {
return null;
}
+
+ if (!strncmp($path, '/Shared/', 8)) {
+ $source = OC_Filestorage_Shared::getSourcePath(str_replace('/Shared/', '', $path));
+ $parts = explode('/', $source, 4);
+ $user = $parts[1];
+ $path = '/'.$parts[3];
+ } else {
+ $user = OC_User::getUser();
+ }
+
$etag = '"'.$tag.'"';
$query = OC_DB::prepare( 'INSERT INTO `*PREFIX*properties` (`userid`,`propertypath`,`propertyname`,`propertyvalue`) VALUES(?,?,?,?)' );
- $query->execute( array( OC_User::getUser(), $path, self::GETETAG_PROPERTYNAME, $etag ));
+ $query->execute( array( $user, $path, self::GETETAG_PROPERTYNAME, $etag ));
return $etag;
}
@@ -246,6 +270,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
*/
static public function removeETagPropertyForPath($path) {
// remove tags from this and parent paths
+ //TODO Shared Files?!?
$paths = array();
while ($path != '/' && $path != '.' && $path != '' && $path != '\\') {
$paths[] = $path;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git
More information about the Pkg-owncloud-commits
mailing list