diff options
author | Bart Visscher <bartv@thisnet.nl> | 2012-06-15 16:04:01 +0200 |
---|---|---|
committer | Bart Visscher <bartv@thisnet.nl> | 2012-06-15 16:04:07 +0200 |
commit | 400769ab400f8c57b95d762420ff2b8da62738a3 (patch) | |
tree | d92aca54a7aa75e92a7837b6ff49bba0e697da15 /lib/connector/sabre/directory.php | |
parent | 8f6121ffa8dfd5ee85ba70569587e2b1878084cd (diff) | |
download | nextcloud-server-400769ab400f8c57b95d762420ff2b8da62738a3.tar.gz nextcloud-server-400769ab400f8c57b95d762420ff2b8da62738a3.zip |
Optimize WebDav access using OC_FileCache
Diffstat (limited to 'lib/connector/sabre/directory.php')
-rw-r--r-- | lib/connector/sabre/directory.php | 25 |
1 files changed, 11 insertions, 14 deletions
diff --git a/lib/connector/sabre/directory.php b/lib/connector/sabre/directory.php index e74d832cb00..5aa70392d76 100644 --- a/lib/connector/sabre/directory.php +++ b/lib/connector/sabre/directory.php @@ -59,19 +59,22 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa * @throws Sabre_DAV_Exception_FileNotFound * @return Sabre_DAV_INode */ - public function getChild($name) { + public function getChild($name, $info = null) { $path = $this->path . '/' . $name; + if (is_null($info)) { + $info = OC_FileCache::get($path); + } - if (!OC_Filesystem::file_exists($path)) throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located'); + if (!$info) throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located'); - if (OC_Filesystem::is_dir($path)) { + if ($info['mimetype'] == 'httpd/unix-directory') { - return new OC_Connector_Sabre_Directory($path); + return new OC_Connector_Sabre_Directory($path, $info); } else { - return new OC_Connector_Sabre_File($path); + return new OC_Connector_Sabre_File($path, $info); } @@ -85,17 +88,11 @@ class OC_Connector_Sabre_Directory extends OC_Connector_Sabre_Node implements Sa public function getChildren() { $nodes = array(); - // foreach(scandir($this->path) as $node) if($node!='.' && $node!='..') $nodes[] = $this->getChild($node); - if( OC_Filesystem::is_dir($this->path . '/')){ - $dh = OC_Filesystem::opendir($this->path . '/'); - while(( $node = readdir($dh)) !== false ){ - if($node!='.' && $node!='..'){ - $nodes[] = $this->getChild($node); - } - } + $folder_content = OC_FileCache::getFolderContent($this->path); + foreach($folder_content as $info) { + $nodes[] = $this->getChild($info['name'], $info); } return $nodes; - } /** |