summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBart Visscher <bartv@thisnet.nl>2012-09-25 17:57:54 +0200
committerBart Visscher <bartv@thisnet.nl>2012-09-25 21:15:01 +0200
commit737a6730db884c22f01d54be36fa687442ce40df (patch)
treef5fa6458d41b9a05717f80d695e94c143de2f7c6
parentc4fc291fa78ba620900dfd6106fc8528473f2a54 (diff)
downloadnextcloud-server-737a6730db884c22f01d54be36fa687442ce40df.tar.gz
nextcloud-server-737a6730db884c22f01d54be36fa687442ce40df.zip
Add OC_Files::searchByMime function
Include shared files in result
-rw-r--r--lib/files.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/lib/files.php b/lib/files.php
index 052d7988058..ac999a9bd15 100644
--- a/lib/files.php
+++ b/lib/files.php
@@ -108,7 +108,24 @@ class OC_Files {
return $files;
}
-
+ public static function searchByMime($mimetype_filter) {
+ $files = array();
+ $dirs_to_check = array('');
+ while (!empty($dirs_to_check)) {
+ // get next subdir to check
+ $dir = array_pop($dirs_to_check);
+ $dir_content = self::getDirectoryContent($dir, $mimetype_filter);
+ foreach($dir_content as $file) {
+ if ($file['type'] == 'file') {
+ $files[] = $dir.'/'.$file['name'];
+ }
+ else {
+ $dirs_to_check[] = $dir.'/'.$file['name'];
+ }
+ }
+ }
+ return $files;
+ }
/**
* return the content of a file or return a zip file containning multiply files