[Pkg-owncloud-commits] [owncloud] 72/394: some more checks if file is a shared file
David Prévot
taffit at alioth.debian.org
Fri Nov 8 23:11:30 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 5f7d053c3a3690b41f6bf86b452cde035bfa62fa
Author: Björn Schießle <schiessle at owncloud.com>
Date: Tue Nov 6 16:39:58 2012 +0100
some more checks if file is a shared file
---
lib/connector/sabre/directory.php | 10 +++++++---
lib/connector/sabre/node.php | 13 +++++++------
2 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php
index 413efef..56c17da 100644
--- a/lib/connector/sabre/directory.php
+++ b/lib/connector/sabre/directory.php
@@ -117,16 +117,20 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
*/
public function getChildren() {
+ $source = $this->getFileSource($this->path);
+ $path = $source['path'];
+ $user = $source['user'];
+
$folder_content = OC_Files::getDirectoryContent($this->path);
$paths = array();
foreach($folder_content as $info) {
- $paths[] = $this->path.'/'.$info['name'];
+ $paths[] = $path.'/'.$info['name'];
}
$properties = array_fill_keys($paths, array());
if(count($paths)>0) {
$placeholders = join(',', array_fill(0, count($paths), '?'));
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ?' . ' AND `propertypath` IN ('.$placeholders.')' );
- array_unshift($paths, OC_User::getUser()); // prepend userid
+ array_unshift($paths, $user); // prepend userid
$result = $query->execute( $paths );
while($row = $result->fetchRow()) {
$propertypath = $row['propertypath'];
@@ -139,7 +143,7 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
$nodes = array();
foreach($folder_content as $info) {
$node = $this->getChild($info['name'], $info);
- $node->setPropertyCache($properties[$this->path.'/'.$info['name']]);
+ $node->setPropertyCache($properties[$path.'/'.$info['name']]);
$nodes[] = $node;
}
return $nodes;
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index a740fe6..b116f01 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -191,17 +191,19 @@ 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)) {
+
+ $source = self::getFileSource($this->path);
+
+ if (is_null($this->property_cache) || empty($this->property_cache)) {
$query = OC_DB::prepare( 'SELECT * FROM `*PREFIX*properties` WHERE `userid` = ? AND `propertypath` = ?' );
- $result = $query->execute( array( OC_User::getUser(), $this->path ));
+ $result = $query->execute( array( $source['user'], $source['path'] ));
$this->property_cache = array();
while( $row = $result->fetchRow()) {
$this->property_cache[$row['propertyname']] = $row['propertyvalue'];
}
}
-
+
// if the array was empty, we need to return everything
if(count($properties) == 0) {
return $this->property_cache;
@@ -253,7 +255,6 @@ 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
-
$source = self::getFileSource($path);
$path = $source['path'];
@@ -276,7 +277,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
$query->execute(array_merge( $vals, $paths ));
}
- private function getFileSource($path) {
+ protected function getFileSource($path) {
if ( OC_App::isEnabled('files_sharing') && !strncmp($path, '/Shared/', 8)) {
$source = OC_Files_Sharing_Util::getSourcePath(str_replace('/Shared/', '', $path));
$parts = explode('/', $source, 4);
--
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