Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/richdocuments.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorPranav Kant <pranavk@collabora.com>2016-06-08 22:09:17 +0300
committerPranav Kant <pranavk@collabora.com>2016-06-09 17:47:36 +0300
commitb138109820e246c3323ae410b8a7715beb16d683 (patch)
tree5c8bd0c47f16fd00559ab4cf8237b5cacd011647 /lib
parent3566c7cff5a06aa2870ef2129c8c5c56f2d26bc5 (diff)
Don't load all documents when only one is clicked on from 'Files'
Diffstat (limited to 'lib')
-rw-r--r--lib/storage.php20
1 files changed, 20 insertions, 0 deletions
diff --git a/lib/storage.php b/lib/storage.php
index ce65d39c..51cf6b66 100644
--- a/lib/storage.php
+++ b/lib/storage.php
@@ -72,6 +72,26 @@ class Storage {
return $list;
}
+ public static function getDocumentById($fileId){
+ $root = \OC::$server->getUserFolder();
+ $ret = array();
+
+ // If type of fileId is a string, then it
+ // doesn't work for shared documents, lets cast to int everytime
+ $document = $root->getById((int)$fileId)[0];
+ if ($document === null){
+ error_log('File with file id, ' . $fileId . ', not found');
+ return $ret;
+ }
+
+ $ret['mimetype'] = $document->getMimeType();
+ $ret['path'] = $root->getRelativePath($document->getPath());
+ $ret['name'] = $document->getName();
+ $ret['fileid'] = $fileId;
+
+ return $ret;
+ }
+
public static function resolvePath($fileId){
$list = array_filter(
self::searchDocuments(),