Browse Source

Allow to specify apps that somethign is a dir

Signed-off-by: Joas Schilling <coding@schilljs.com>
Joas Schilling 4 years ago
parent
commit
18975b3e1d

+ 2 - 1
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
 	}
 

+ 8 - 2
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;
+			}
 		}
 	}
 

+ 2 - 1
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;
 	}

+ 2 - 1
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) {
 	}
 
 	/**

+ 2 - 1
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;
 	}

+ 2 - 1
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.
 	}
 

+ 2 - 1
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.
 	}
 

+ 2 - 1
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.
 	}
 

+ 2 - 1
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