Ejemplo n.º 1
0
 /**
  * Returns the INode object for the requested path
  *
  * @param string $path
  * @throws \Sabre_DAV_Exception_NotFound
  * @return \Sabre_DAV_INode
  */
 public function getNodeForPath($path)
 {
     $path = trim($path, '/');
     if (isset($this->cache[$path])) {
         return $this->cache[$path];
     }
     // Is it the root node?
     if (!strlen($path)) {
         return $this->rootNode;
     }
     if (pathinfo($path, PATHINFO_EXTENSION) === 'part') {
         // read from storage
         $absPath = $this->getFileView()->getAbsolutePath($path);
         list($storage, $internalPath) = Filesystem::resolvePath('/' . $absPath);
         if ($storage) {
             $scanner = $storage->getScanner($internalPath);
             // get data directly
             $info = $scanner->getData($internalPath);
         }
     } else {
         // read from cache
         $info = $this->getFileView()->getFileInfo($path);
     }
     if (!$info) {
         throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
     }
     if ($info['mimetype'] === 'httpd/unix-directory') {
         $node = new \OC_Connector_Sabre_Directory($path);
     } else {
         $node = new \OC_Connector_Sabre_File($path);
     }
     $node->setFileinfoCache($info);
     $this->cache[$path] = $node;
     return $node;
 }
Ejemplo n.º 2
0
 /**
  * Returns the INode object for the requested path
  *
  * @param string $path
  * @throws \Sabre_DAV_Exception_NotFound
  * @return \Sabre_DAV_INode
  */
 public function getNodeForPath($path)
 {
     $path = trim($path, '/');
     if (isset($this->cache[$path])) {
         return $this->cache[$path];
     }
     // Is it the root node?
     if (!strlen($path)) {
         return $this->rootNode;
     }
     $info = $this->getFileView()->getFileInfo($path);
     if (!$info) {
         throw new \Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
     }
     if ($info['mimetype'] === 'httpd/unix-directory') {
         $node = new \OC_Connector_Sabre_Directory($path);
     } else {
         $node = new \OC_Connector_Sabre_File($path);
     }
     $node->setFileinfoCache($info);
     $this->cache[$path] = $node;
     return $node;
 }
Ejemplo n.º 3
0
 /**
  * Returns a specific child node, referenced by its name
  *
  * @param string $name
  * @throws Sabre_DAV_Exception_FileNotFound
  * @return Sabre_DAV_INode
  */
 public function getChild($name, $info = null)
 {
     $path = $this->path . '/' . $name;
     if (is_null($info)) {
         $info = \OC\Files\Filesystem::getFileInfo($path);
     }
     if (!$info) {
         throw new Sabre_DAV_Exception_NotFound('File with name ' . $path . ' could not be located');
     }
     if ($info['mimetype'] == 'httpd/unix-directory') {
         $node = new OC_Connector_Sabre_Directory($path);
     } else {
         $node = new OC_Connector_Sabre_File($path);
     }
     $node->setFileinfoCache($info);
     return $node;
 }