aboutsummaryrefslogtreecommitdiffstats
path: root/lib/connector/sabre/node.php
diff options
context:
space:
mode:
authorGeorg Ehrke <dev@georgswebsite.de>2012-06-15 20:48:37 +0200
committerGeorg Ehrke <dev@georgswebsite.de>2012-06-15 20:48:37 +0200
commit2c8a61ae9c1437ded36ecba6eba5e1bc9d7e7948 (patch)
tree00815e65a25a6243289902d77137f84a3433d9c2 /lib/connector/sabre/node.php
parent9f82edc157b28b501dec8bf29e63c5e7e05b01e1 (diff)
parentf06c08a63742de9adea4a146a4480b71ad254f20 (diff)
downloadnextcloud-server-2c8a61ae9c1437ded36ecba6eba5e1bc9d7e7948.tar.gz
nextcloud-server-2c8a61ae9c1437ded36ecba6eba5e1bc9d7e7948.zip
Merge branch 'master' into oc_error
Diffstat (limited to 'lib/connector/sabre/node.php')
-rw-r--r--lib/connector/sabre/node.php22
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/connector/sabre/node.php b/lib/connector/sabre/node.php
index e7bcea3171d..e5c059f0c8a 100644
--- a/lib/connector/sabre/node.php
+++ b/lib/connector/sabre/node.php
@@ -33,7 +33,7 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* file stat cache
* @var array
*/
- protected $stat_cache;
+ protected $fileinfo_cache;
/**
* Sets up the node, expects a full path name
@@ -41,8 +41,11 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* @param string $path
* @return void
*/
- public function __construct($path) {
+ public function __construct($path, $fileinfo_cache = null) {
$this->path = $path;
+ if ($fileinfo_cache) {
+ $this->fileinfo_cache = $fileinfo_cache;
+ }
}
@@ -85,9 +88,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);
+ protected function getFileinfoCache() {
+ if (!isset($this->fileinfo_cache)) {
+ if ($fileinfo_cache = OC_FileCache::get($this->path)) {
+ } else {
+ $fileinfo_cache = OC_Filesystem::stat($this->path);
+ }
+
+ $this->fileinfo_cache = $fileinfo_cache;
}
}
@@ -97,8 +105,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
* @return int
*/
public function getLastModified() {
- $this->stat();
- return $this->stat_cache['mtime'];
+ $this->getFileinfoCache();
+ return $this->fileinfo_cache['mtime'];
}