Esempio n. 1
0
 private static function getOC7FileList($user, $path, $onlyID, $indexed)
 {
     $result = array();
     $dirView = new \OC\Files\View('/' . $user);
     $dirContent = $dirView->getDirectoryContent($path);
     foreach ($dirContent as $item) {
         $fileID = $item->getId();
         $fileMime = $item->getMimetype();
         $fileName = $item->getName();
         $filePath = substr($item->getPath(), strlen($user) + 2);
         $itemRes = array();
         if (strpos($fileMime, 'directory') === FALSE) {
             $fileData = array('fileid' => $fileID, 'name' => $fileName, 'mimetype' => $fileMime, 'path' => $filePath);
             $itemRes[] = $onlyID ? $fileID : $fileData;
         } else {
             $itemRes = \OCA\OCLife\utilities::getOC7FileList($user, $filePath, $onlyID, $indexed);
         }
         foreach ($itemRes as $item) {
             if ($onlyID) {
                 $result[] = intval($item);
             } else {
                 if ($indexed) {
                     $result[intval($item['fileid'])] = $item;
                 } else {
                     $result[] = $item;
                 }
             }
         }
     }
     return $result;
 }