summaryrefslogtreecommitdiffstats
path: root/lib/connector/sabre/node.php
diff options
context:
space:
mode:
Diffstat (limited to 'lib/connector/sabre/node.php')
-rw-r--r--lib/connector/sabre/node.php24
1 files changed, 19 insertions, 5 deletions
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index a7d1de8b953..e7bcea3171d 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -29,6 +29,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* @var string
*/
protected $path;
+ /**
+ * file stat cache
+ * @var array
+ */
+ protected $stat_cache;
/**
* Sets up the node, expects a full path name
@@ -77,7 +82,14 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
}
-
+ /**
+ * Set the stat cache
+ */
+ protected function stat() {
+ if (!isset($this->stat_cache)) {
+ $this->stat_cache = OC_Filesystem::stat($this->path);
+ }
+ }
/**
* Returns the last modification time, as a unix timestamp
@@ -85,8 +97,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* @return int
*/
public function getLastModified() {
-
- return OC_Filesystem::filemtime($this->path);
+ $this->stat();
+ return $this->stat_cache['mtime'];
}
@@ -137,7 +149,9 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
/**
* Returns a list of properties for this nodes.;
*
- * The properties list is a list of propertynames the client requested, encoded as xmlnamespace#tagName, for example: http://www.example.org/namespace#author
+ * The properties list is a list of propertynames the client requested,
+ * encoded as xmlnamespace#tagName, for example:
+ * http://www.example.org/namespace#author
* If the array is empty, all properties should be returned
*
* @param array $properties
@@ -153,11 +167,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
$existing[$row['propertyname']] = $row['propertyvalue'];
}
+ // if the array was empty, we need to return everything
if(count($properties) == 0){
return $existing;
}
- // if the array was empty, we need to return everything
$props = array();
foreach($properties as $property) {
if (isset($existing[$property])) $props[$property] = $existing[$property];