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 committed by Backportbot
parent c743af30d6
commit 42a51146d1
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