From 42a51146d1b353f4e5eaf5bd8132047a668ab6c3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 12 Dec 2019 22:19:53 +0100 Subject: [PATCH] Allow to specify apps that somethign is a dir Signed-off-by: Joas Schilling --- apps/workflowengine/lib/Check/AbstractStringCheck.php | 3 ++- apps/workflowengine/lib/Check/FileMimeType.php | 10 ++++++++-- apps/workflowengine/lib/Check/FileName.php | 3 ++- apps/workflowengine/lib/Check/FileSize.php | 3 ++- apps/workflowengine/lib/Check/FileSystemTags.php | 3 ++- apps/workflowengine/lib/Check/RequestRemoteAddress.php | 3 ++- apps/workflowengine/lib/Check/RequestTime.php | 3 ++- apps/workflowengine/lib/Check/UserGroupMembership.php | 3 ++- lib/public/WorkflowEngine/ICheck.php | 3 ++- 9 files changed, 24 insertions(+), 10 deletions(-) diff --git a/apps/workflowengine/lib/Check/AbstractStringCheck.php b/apps/workflowengine/lib/Check/AbstractStringCheck.php index 0fd728e349..8ea987c1e5 100644 --- a/apps/workflowengine/lib/Check/AbstractStringCheck.php +++ b/apps/workflowengine/lib/Check/AbstractStringCheck.php @@ -44,8 +44,9 @@ abstract class AbstractStringCheck implements ICheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { // Nothing changes here with a different path } diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index 0a2f33dd62..b3955fbd38 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -58,13 +58,19 @@ class FileMimeType extends AbstractStringCheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { $this->storage = $storage; $this->path = $path; if (!isset($this->mimeType[$this->storage->getId()][$this->path]) || $this->mimeType[$this->storage->getId()][$this->path] === '') { - $this->mimeType[$this->storage->getId()][$this->path] = null; + + if ($isDir) { + $this->mimeType[$this->storage->getId()][$this->path] = 'httpd/unix-directory'; + } else { + $this->mimeType[$this->storage->getId()][$this->path] = null; + } } } diff --git a/apps/workflowengine/lib/Check/FileName.php b/apps/workflowengine/lib/Check/FileName.php index f775227f71..4cb402f73d 100644 --- a/apps/workflowengine/lib/Check/FileName.php +++ b/apps/workflowengine/lib/Check/FileName.php @@ -49,8 +49,9 @@ class FileName extends AbstractStringCheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { $this->storage = $storage; $this->path = $path; } diff --git a/apps/workflowengine/lib/Check/FileSize.php b/apps/workflowengine/lib/Check/FileSize.php index 7e48f0f603..76470c73f6 100644 --- a/apps/workflowengine/lib/Check/FileSize.php +++ b/apps/workflowengine/lib/Check/FileSize.php @@ -51,8 +51,9 @@ class FileSize implements ICheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { } /** diff --git a/apps/workflowengine/lib/Check/FileSystemTags.php b/apps/workflowengine/lib/Check/FileSystemTags.php index 4a2b87fd53..1def0d65aa 100644 --- a/apps/workflowengine/lib/Check/FileSystemTags.php +++ b/apps/workflowengine/lib/Check/FileSystemTags.php @@ -68,8 +68,9 @@ class FileSystemTags implements ICheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { $this->storage = $storage; $this->path = $path; } diff --git a/apps/workflowengine/lib/Check/RequestRemoteAddress.php b/apps/workflowengine/lib/Check/RequestRemoteAddress.php index 6fa4cfc880..11b0c6d234 100644 --- a/apps/workflowengine/lib/Check/RequestRemoteAddress.php +++ b/apps/workflowengine/lib/Check/RequestRemoteAddress.php @@ -47,8 +47,9 @@ class RequestRemoteAddress implements ICheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { // A different path doesn't change time, so nothing to do here. } diff --git a/apps/workflowengine/lib/Check/RequestTime.php b/apps/workflowengine/lib/Check/RequestTime.php index 2aa79e7767..d596b4d52d 100644 --- a/apps/workflowengine/lib/Check/RequestTime.php +++ b/apps/workflowengine/lib/Check/RequestTime.php @@ -52,8 +52,9 @@ class RequestTime implements ICheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { // A different path doesn't change time, so nothing to do here. } diff --git a/apps/workflowengine/lib/Check/UserGroupMembership.php b/apps/workflowengine/lib/Check/UserGroupMembership.php index fd6ba00d09..32f4a2c9f6 100644 --- a/apps/workflowengine/lib/Check/UserGroupMembership.php +++ b/apps/workflowengine/lib/Check/UserGroupMembership.php @@ -60,8 +60,9 @@ class UserGroupMembership implements ICheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir */ - public function setFileInfo(IStorage $storage, $path) { + public function setFileInfo(IStorage $storage, $path, $isDir = false) { // A different path doesn't change group memberships, so nothing to do here. } diff --git a/lib/public/WorkflowEngine/ICheck.php b/lib/public/WorkflowEngine/ICheck.php index 1d4fc96646..e5d3f79dbd 100644 --- a/lib/public/WorkflowEngine/ICheck.php +++ b/lib/public/WorkflowEngine/ICheck.php @@ -36,9 +36,10 @@ interface ICheck { /** * @param IStorage $storage * @param string $path + * @param bool $isDir * @since 9.1 */ - public function setFileInfo(IStorage $storage, $path); + public function setFileInfo(IStorage $storage, $path, $isDir = false); /** * @param string $operator