Allow to specify apps that somethign is a dir

Signed-off-by: Joas Schilling <coding@schilljs.com>
This commit is contained in:
Joas Schilling 2019-12-12 22:19:53 +01:00
parent 6955841c82
commit 790de0acef
No known key found for this signature in database
GPG Key ID: 7076EA9751AACDDA
9 changed files with 24 additions and 10 deletions

View File

@ -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
}

View File

@ -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;
}
}
}

View File

@ -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;
}

View File

@ -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) {
}
/**

View File

@ -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;
}

View File

@ -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.
}

View File

@ -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.
}

View File

@ -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.
}

View File

@ -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