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-14 19:07:22 +0300
committerPranav Kant <pranavk@collabora.com>2016-06-15 11:03:25 +0300
commitaf16a4cd2770d63f8948ea4deca8664f41cefc26 (patch)
tree26b7cd892630d4d7a1333d3d482311359aa090c1 /lib
parentbf87ed950036a5572adf3a0a54ff94d1aa1b62ab (diff)
Make me work with owncloud9
Due to API change (searchByMime), app was completely broken when installed with owncloud9. This change should make it work with owncloud9, while still keeping older owncloud version (upto 8.2) in working state. Lets use functions on object returned by searchByMime instead of directly accessing its data members.
Diffstat (limited to 'lib')
-rw-r--r--lib/storage.php20
1 files changed, 19 insertions, 1 deletions
diff --git a/lib/storage.php b/lib/storage.php
index 51cf6b66..c7fa35b0 100644
--- a/lib/storage.php
+++ b/lib/storage.php
@@ -139,11 +139,29 @@ class Storage {
Db\Session::cleanUp($session->getEsId());
}
+ private static function processDocuments($rawDocuments){
+ $documents = array();
+ foreach($rawDocuments as $rawDocument){
+ $document = array(
+ 'fileid' => $rawDocument->getId(),
+ 'path' => $rawDocument->getInternalPath(),
+ 'name' => $rawDocument->getName(),
+ 'mimetype' => $rawDocument->getMimetype()
+ );
+
+ array_push($documents, $document);
+ }
+
+ return $documents;
+ }
+
protected static function searchDocuments(){
$documents = array();
foreach (self::getSupportedMimetypes() as $mime){
- $documents = array_merge($documents, \OCP\Files::searchByMime($mime));
+ $rawDocuments = \OCP\Files::searchByMime($mime);
+ $documents = array_merge($documents, self::processDocuments($rawDocuments));
}
+
return $documents;
}