Ejemplo n.º 1
0
 /**
  * Returns an array of all keys (files and directories)
  *
  * @return array
  */
 public function keys()
 {
     $this->initialize();
     $objectList = $this->container->ObjectList();
     $keys = array();
     while ($object = $objectList->Next()) {
         $keys[] = $object->name;
     }
     sort($keys);
     return $keys;
 }
Ejemplo n.º 2
0
 public function opendir($path)
 {
     $path = $this->normalizePath($path);
     if ($path === '.') {
         $path = '';
     } else {
         $path .= '/';
     }
     try {
         $files = array();
         $objects = $this->container->ObjectList(array('prefix' => $path, 'delimiter' => '/'));
         while ($object = $objects->Next()) {
             $file = basename($object->Name());
             if ($file !== basename($path)) {
                 $files[] = $file;
             }
         }
         \OC\Files\Stream\Dir::register('swift' . $path, $files);
         return opendir('fakedir://swift' . $path);
     } catch (Exception $e) {
         \OCP\Util::writeLog('files_external', $e->getMessage(), \OCP\Util::ERROR);
         return false;
     }
 }