]> source.dussan.org Git - nextcloud-server.git/commitdiff
Use setter for FileinfoCache
authorBart Visscher <bartv@thisnet.nl>
Fri, 15 Jun 2012 15:04:37 +0000 (17:04 +0200)
committerBart Visscher <bartv@thisnet.nl>
Fri, 15 Jun 2012 19:21:42 +0000 (21:21 +0200)
lib/connector/sabre/directory.php
lib/connector/sabre/node.php

index 5aa70392d767079cff83c13eba7f652893ddfa6f..6af4dd36562e3d5725adf88a701cdced9787af34 100644 (file)
@@ -69,15 +69,13 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa
                if (!$info) throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
 
                if ($info['mimetype'] == 'httpd/unix-directory') {
-
-                       return new OC_Connector_Sabre_Directory($path, $info);
-
+                       $node = new OC_Connector_Sabre_Directory($path);
                } else {
-
-                       return new OC_Connector_Sabre_File($path, $info);
-
+                       $node = new OC_Connector_Sabre_File($path);
                }
 
+               $node->setFileinfoCache($info);
+               return $node;
        }
 
        /**
index e5c059f0c8a3ea15eeff3ff997693247906271de..8a860242f2897c27aa44ec5df5945d6ca6bd4161 100644 (file)
@@ -41,11 +41,8 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
         * @param string $path
         * @return void
         */
-       public function __construct($path, $fileinfo_cache = null) {
+       public function __construct($path) {
                $this->path = $path;
-               if ($fileinfo_cache) {
-                       $this->fileinfo_cache = $fileinfo_cache;
-               }
        }
 
 
@@ -85,8 +82,13 @@ abstract class OC_Connector_Sabre_Node implements Sabre_DAV_INode, Sabre_DAV_IPr
 
        }
 
+       public function setFileinfoCache($fileinfo_cache)
+       {
+               $this->fileinfo_cache = $fileinfo_cache;
+       }
+
        /**
-        * Set the stat cache
+        * Make sure the fileinfo cache is filled. Uses OC_FileCache or a direct stat
         */
        protected function getFileinfoCache() {
                if (!isset($this->fileinfo_cache)) {