diff options
author | Phie <phie@phie.ovh> | 2019-04-17 15:54:09 +0300 |
---|---|---|
committer | Phie <phie@phie.ovh> | 2019-04-17 15:54:09 +0300 |
commit | 8d34b338749d10d040780ad21b96c27bb6b5bd3f (patch) | |
tree | 7bda54ba29b278ea203933dcbd88c904b5a826bf /lib/Controller/NoteController.php | |
parent | 712e9161c1a2627661b7bb6d8550295c295a3c02 (diff) |
send metadata with file list
Diffstat (limited to 'lib/Controller/NoteController.php')
-rwxr-xr-x | lib/Controller/NoteController.php | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/lib/Controller/NoteController.php b/lib/Controller/NoteController.php index 6d2bdf2..329dedc 100755 --- a/lib/Controller/NoteController.php +++ b/lib/Controller/NoteController.php @@ -61,7 +61,7 @@ $path = ""; else if(substr($path, -1) !== '/' && !empty($path)) $path .= "/"; - + $paths = array(); $data = array(); foreach($this->CarnetFolder->get($path)->getDirectoryListing() as $in){ $inf = $in->getFileInfo(); @@ -70,10 +70,20 @@ $file['path'] = $path.$inf->getName(); $file['isDir'] = $inf->getType() === "dir"; $file['mtime'] = $inf->getMtime(); + if($inf->getType() !== "dir"){ + array_push($paths, $file['path']); + } array_push($data,$file); } - - return $data; + + $return = array(); + if(sizeof($paths)>0){ + $cache = new CacheManager($this->db, $this->CarnetFolder); + $metadataFromCache = $cache->getFromCache($paths); + $return['metadata'] = $metadataFromCache; + } + $return['files'] = $data; + return $return; } /* @@ -131,10 +141,10 @@ array_push($paths, $path); } + $return = array(); if(sizeof($paths)>0){ $cache = new CacheManager($this->db, $this->CarnetFolder); $metadataFromCache = $cache->getFromCache($paths); - $return = array(); $return['metadata'] = $metadataFromCache; } |