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

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-03-09 13:58:26 +0300
committerJoas Schilling <coding@schilljs.com>2017-04-06 11:13:50 +0300
commitd0a7e01baf7dcb2b4c400688e01a16078816cb76 (patch)
tree79d7fce644fa2cf1b6b25b8bfa4dad0be58fed41
parent392610e3c6dd45de73790047d3151a309d72b1da (diff)
Also add the root of external storages to the file id list
Signed-off-by: Joas Schilling <coding@schilljs.com>
-rw-r--r--apps/workflowengine/lib/Check/FileSystemTags.php18
1 files changed, 13 insertions, 5 deletions
diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php
index e9b5a945967..4a2b87fd53e 100644
--- a/apps/workflowengine/lib/Check/FileSystemTags.php
+++ b/apps/workflowengine/lib/Check/FileSystemTags.php
@@ -23,6 +23,7 @@ namespace OCA\WorkflowEngine\Check;
use OCP\Files\Cache\ICache;
+use OCP\Files\IHomeStorage;
use OCP\Files\Storage\IStorage;
use OCP\IL10N;
use OCP\SystemTag\ISystemTagManager;
@@ -108,7 +109,7 @@ class FileSystemTags implements ICheck {
*/
protected function getSystemTags() {
$cache = $this->storage->getCache();
- $fileIds = $this->getFileIds($cache, $this->path);
+ $fileIds = $this->getFileIds($cache, $this->path, !$this->storage->instanceOfStorage(IHomeStorage::class));
$systemTags = [];
foreach ($fileIds as $i => $fileId) {
@@ -135,17 +136,19 @@ class FileSystemTags implements ICheck {
* Get the file ids of the given path and its parents
* @param ICache $cache
* @param string $path
+ * @param bool $isExternalStorage
* @return int[]
*/
- protected function getFileIds(ICache $cache, $path) {
+ protected function getFileIds(ICache $cache, $path, $isExternalStorage) {
$cacheId = $cache->getNumericStorageId();
if (isset($this->fileIds[$cacheId][$path])) {
return $this->fileIds[$cacheId][$path];
}
- if ($path !== dirname($path)) {
- $parentIds = $this->getFileIds($cache, dirname($path));
- } else {
+ $parentIds = [];
+ if ($path !== $this->dirname($path)) {
+ $parentIds = $this->getFileIds($cache, $this->dirname($path), $isExternalStorage);
+ } else if (!$isExternalStorage) {
return [];
}
@@ -158,4 +161,9 @@ class FileSystemTags implements ICheck {
return $parentIds;
}
+
+ protected function dirname($path) {
+ $dir = dirname($path);
+ return $dir === '.' ? '' : $dir;
+ }
}