From 0f3fe7be2c89ed3b9bf892e7e8f7e64d5d75b981 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 28 Nov 2019 15:24:57 +0100 Subject: [PATCH 1/7] Allow to check for the mimetype by content only Signed-off-by: Joas Schilling --- lib/private/Files/Type/Detection.php | 28 +++++++++++++++++++------- lib/public/Files/IMimeTypeDetector.php | 10 ++++++++- 2 files changed, 30 insertions(+), 8 deletions(-) diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 3207562763..3db880538a 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -192,12 +192,12 @@ class Detection implements IMimeTypeDetector { } /** - * detect mimetype based on both filename and content - * + * detect mimetype only based on the content of file * @param string $path * @return string + * @since 18.0.0 */ - public function detect($path) { + public function detectContent(string $path): string { $this->loadMappings(); if (@is_dir($path)) { @@ -205,9 +205,7 @@ class Detection implements IMimeTypeDetector { return "httpd/unix-directory"; } - $mimeType = $this->detectPath($path); - - if ($mimeType === 'application/octet-stream' and function_exists('finfo_open') + if (function_exists('finfo_open') and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME) ) { $info = @strtolower(finfo_file($finfo, $path)); @@ -219,7 +217,7 @@ class Detection implements IMimeTypeDetector { } $isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://'); - if (!$isWrapped and $mimeType === 'application/octet-stream' && function_exists("mime_content_type")) { + if (!$isWrapped and function_exists("mime_content_type")) { // use mime magic extension if available $mimeType = mime_content_type($path); } @@ -242,6 +240,22 @@ class Detection implements IMimeTypeDetector { return $mimeType; } + /** + * detect mimetype based on both filename and content + * + * @param string $path + * @return string + */ + public function detect($path) { + $mimeType = $this->detectPath($path); + + if ($mimeType !== 'application/octet-stream') { + return $mimeType; + } + + return $this->detectContent($path); + } + /** * detect mimetype based on the content of a string * diff --git a/lib/public/Files/IMimeTypeDetector.php b/lib/public/Files/IMimeTypeDetector.php index f66eb4e0b9..63ac8854f1 100644 --- a/lib/public/Files/IMimeTypeDetector.php +++ b/lib/public/Files/IMimeTypeDetector.php @@ -39,9 +39,17 @@ interface IMimeTypeDetector { * @param string $path * @return string * @since 8.2.0 - **/ + */ public function detectPath($path); + /** + * detect mimetype only based on the content of file + * @param string $path + * @return string + * @since 18.0.0 + */ + public function detectContent(string $path): string; + /** * detect mimetype based on both filename and content * From 1fe16ca6f52eaa30649e91d8774234d15ba4af20 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 29 Nov 2019 11:04:20 +0100 Subject: [PATCH 2/7] Some more fixes in detecting the mimetype from the content Signed-off-by: Joas Schilling --- lib/private/Files/Type/Detection.php | 42 +++++++++++++++++----------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 3db880538a..ce7a6f669c 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -178,7 +178,7 @@ class Detection implements IMimeTypeDetector { if (strpos($fileName, '.') > 0) { // remove versioning extension: name.v1508946057 and transfer extension: name.ocTransferId2057600214.part - $fileName = preg_replace('!((\.v\d+)|((.ocTransferId\d+)?.part))$!', '', $fileName); + $fileName = preg_replace('!((\.v\d+)|((\.ocTransferId\d+)?\.part))$!', '', $fileName); //try to guess the type by the file extension $extension = strtolower(strrchr($fileName, '.')); @@ -206,38 +206,46 @@ class Detection implements IMimeTypeDetector { } if (function_exists('finfo_open') - and function_exists('finfo_file') and $finfo = finfo_open(FILEINFO_MIME) - ) { - $info = @strtolower(finfo_file($finfo, $path)); + && function_exists('finfo_file') + && $finfo = finfo_open(FILEINFO_MIME)) { + $info = @finfo_file($finfo, $path); finfo_close($finfo); if ($info) { + $info = strtolower($info); $mimeType = strpos($info, ';') !== false ? substr($info, 0, strpos($info, ';')) : $info; - return empty($mimeType) ? 'application/octet-stream' : $mimeType; + return $this->getSecureMimeType($mimeType); } - } - $isWrapped = (strpos($path, '://') !== false) and (substr($path, 0, 7) === 'file://'); - if (!$isWrapped and function_exists("mime_content_type")) { + + if (strpos($path, '://') !== false && strpos($path, 'file://') === 0) { + // Is the file wrapped in a stream? + return 'application/octet-stream'; + } + + if (function_exists('mime_content_type')) { // use mime magic extension if available $mimeType = mime_content_type($path); + if ($mimeType !== false) { + return $this->getSecureMimeType($mimeType); + } } - if (!$isWrapped and $mimeType === 'application/octet-stream' && \OC_Helper::canExecute("file")) { + + if (\OC_Helper::canExecute('file')) { // it looks like we have a 'file' command, // lets see if it does have mime support $path = escapeshellarg($path); - $fp = popen("file -b --mime-type $path 2>/dev/null", "r"); - $reply = fgets($fp); + $fp = popen("test -f $path && file -b --mime-type $path", 'r'); + $mimeType = fgets($fp); pclose($fp); - //trim the newline - $mimeType = trim($reply); - - if (empty($mimeType)) { - $mimeType = 'application/octet-stream'; + if ($mimeType !== false) { + //trim the newline + $mimeType = trim($mimeType); + return $this->getSecureMimeType($mimeType); } } - return $mimeType; + return 'application/octet-stream'; } /** From 25d7d6965d45ac725f28f17ae32bf03052c643e3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Fri, 29 Nov 2019 11:06:04 +0100 Subject: [PATCH 3/7] Improve mimetype detection in workflow components Signed-off-by: Joas Schilling --- .../workflowengine/lib/Check/FileMimeType.php | 95 +++---------------- 1 file changed, 13 insertions(+), 82 deletions(-) diff --git a/apps/workflowengine/lib/Check/FileMimeType.php b/apps/workflowengine/lib/Check/FileMimeType.php index 8f2f8c9e1d..0a2f33dd62 100644 --- a/apps/workflowengine/lib/Check/FileMimeType.php +++ b/apps/workflowengine/lib/Check/FileMimeType.php @@ -103,93 +103,24 @@ class FileMimeType extends AbstractStringCheck { return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, 'httpd/unix-directory'); } - if ($this->isWebDAVRequest()) { + if ($this->storage->file_exists($this->path)) { + $path = $this->storage->getLocalFile($this->path); + $mimeType = $this->mimeTypeDetector->detectContent($path); + return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, $mimeType); + } + + if ($this->isWebDAVRequest() || $this->isPublicWebDAVRequest()) { // Creating a folder if ($this->request->getMethod() === 'MKCOL') { - return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, 'httpd/unix-directory'); - } - - if ($this->request->getMethod() === 'PUT' || $this->request->getMethod() === 'MOVE') { - if ($this->request->getMethod() === 'MOVE') { - $mimeType = $this->mimeTypeDetector->detectPath($this->path); - } else { - $path = $this->request->getPathInfo(); - $mimeType = $this->mimeTypeDetector->detectPath($path); - } - return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, $mimeType); - } - } else if ($this->isPublicWebDAVRequest()) { - if ($this->request->getMethod() === 'PUT') { - $path = $this->request->getPathInfo(); - if (strpos($path, '/webdav/') === 0) { - $path = substr($path, strlen('/webdav')); - } - $path = $this->path . $path; - $mimeType = $this->mimeTypeDetector->detectPath($path); - return $this->cacheAndReturnMimeType($this->storage->getId(), $path, $mimeType); + return 'httpd/unix-directory'; } } - if (in_array($this->request->getMethod(), ['POST', 'PUT'])) { - $files = $this->request->getUploadedFile('files'); - if (isset($files['type'][0])) { - $mimeType = $files['type'][0]; - if ($mimeType === 'application/octet-stream') { - // Maybe not... - $mimeTypeTest = $this->mimeTypeDetector->detectPath($files['name'][0]); - if ($mimeTypeTest !== 'application/octet-stream' && $mimeTypeTest !== false) { - $mimeType = $mimeTypeTest; - } else { - $mimeTypeTest = $this->mimeTypeDetector->detect($files['tmp_name'][0]); - if ($mimeTypeTest !== 'application/octet-stream' && $mimeTypeTest !== false) { - $mimeType = $mimeTypeTest; - } - } - } - return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, $mimeType); - } - } - - $mimeType = $this->storage->getMimeType($this->path); - if ($mimeType === 'application/octet-stream') { - $mimeType = $this->detectMimetypeFromPath(); - } - - return $this->cacheAndReturnMimeType($this->storage->getId(), $this->path, $mimeType); - } - - /** - * @return string - */ - protected function detectMimetypeFromPath() { - $mimeType = $this->mimeTypeDetector->detectPath($this->path); - if ($mimeType !== 'application/octet-stream' && $mimeType !== false) { - return $mimeType; - } - - if ($this->storage->instanceOfStorage('\OC\Files\Storage\Local') - || $this->storage->instanceOfStorage('\OC\Files\Storage\Home') - || $this->storage->instanceOfStorage('\OC\Files\ObjectStore\HomeObjectStoreStorage')) { - $localFile = $this->storage->getLocalFile($this->path); - if ($localFile !== false) { - $mimeType = $this->mimeTypeDetector->detect($localFile); - if ($mimeType !== false) { - return $mimeType; - } - } - - return 'application/octet-stream'; - } else { - $handle = $this->storage->fopen($this->path, 'r'); - $data = fread($handle, 8024); - fclose($handle); - $mimeType = $this->mimeTypeDetector->detectString($data); - if ($mimeType !== false) { - return $mimeType; - } - - return 'application/octet-stream'; - } + // We do not cache this, as the file did not exist yet. + // In case it does in the future, we will check with detectContent() + // again to get the real mimetype of the content, rather than + // guessing it from the path. + return $this->mimeTypeDetector->detectPath($this->path); } /** From b7b7380d6bb45332cc67f801731dd077a915750a Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Wed, 4 Dec 2019 22:32:54 +0100 Subject: [PATCH 4/7] Update the unit test to dataProviders Signed-off-by: Joas Schilling --- tests/lib/Files/Type/DetectionTest.php | 129 ++++++++++++++++--------- 1 file changed, 82 insertions(+), 47 deletions(-) diff --git a/tests/lib/Files/Type/DetectionTest.php b/tests/lib/Files/Type/DetectionTest.php index 1d01a96fcc..c6dded1f6f 100644 --- a/tests/lib/Files/Type/DetectionTest.php +++ b/tests/lib/Files/Type/DetectionTest.php @@ -37,61 +37,96 @@ class DetectionTest extends \Test\TestCase { ); } - public function testDetect() { - $dir = \OC::$SERVERROOT.'/tests/data'; - - $result = $this->detection->detect($dir."/"); - $expected = 'httpd/unix-directory'; - $this->assertEquals($expected, $result); - - $result = $this->detection->detect($dir."/data.tar.gz"); - $expected = 'application/x-gzip'; - $this->assertEquals($expected, $result); - - $result = $this->detection->detect($dir."/data.zip"); - $expected = 'application/zip'; - $this->assertEquals($expected, $result); - - $result = $this->detection->detect($dir."/testimagelarge.svg"); - $expected = 'image/svg+xml'; - $this->assertEquals($expected, $result); - - $result = $this->detection->detect($dir."/testimage.png"); - $expected = 'image/png'; - $this->assertEquals($expected, $result); + public function dataDetectPath(): array { + return [ + ['foo.txt', 'text/plain'], + ['foo.png', 'image/png'], + ['foo.bar.png', 'image/png'], + ['.hidden.png', 'image/png'], + ['.hidden.foo.png', 'image/png'], + ['.hidden/foo.png', 'image/png'], + ['.hidden/.hidden.png', 'image/png'], + ['test.jpg/foo.png', 'image/png'], + ['.png', 'application/octet-stream'], + ['..hidden', 'application/octet-stream'], + ['foo', 'application/octet-stream'], + ['', 'application/octet-stream'], + ['foo.png.ocTransferId123456789.part', 'image/png'], + ['foo.png.v1234567890', 'image/png'], + ]; } - public function testGetSecureMimeType() { - $result = $this->detection->getSecureMimeType('image/svg+xml'); + /** + * @dataProvider dataDetectPath + * + * @param string $path + * @param string $expected + */ + public function testDetectPath(string $path, string $expected): void { + $this->assertEquals($expected, $this->detection->detectPath($path)); + } + + public function dataDetectContent(): array { + return [ + ['/', 'httpd/unix-directory'], + ['/data.tar.gz', 'application/x-gzip'], + ['/data.zip', 'application/zip'], + ['/testimage.mp3', 'audio/mpeg'], + ['/testimage.png', 'image/png'], + ]; + } + + /** + * @dataProvider dataDetectContent + * + * @param string $path + * @param string $expected + */ + public function testDetectContent(string $path, string $expected): void { + $this->assertEquals($expected, $this->detection->detectContent(\OC::$SERVERROOT . '/tests/data' . $path)); + } + + public function dataDetect(): array { + return [ + ['/', 'httpd/unix-directory'], + ['/data.tar.gz', 'application/x-gzip'], + ['/data.zip', 'application/zip'], + ['/testimagelarge.svg', 'image/svg+xml'], + ['/testimage.png', 'image/png'], + ]; + } + + /** + * @dataProvider dataDetect + * + * @param string $path + * @param string $expected + */ + public function testDetect(string $path, string $expected): void { + $this->assertEquals($expected, $this->detection->detect(\OC::$SERVERROOT . '/tests/data' . $path)); + } + + public function testDetectString(): void { + $result = $this->detection->detectString('/data/data.tar.gz'); $expected = 'text/plain'; $this->assertEquals($expected, $result); - - $result = $this->detection->getSecureMimeType('image/png'); - $expected = 'image/png'; - $this->assertEquals($expected, $result); } - public function testDetectPath() { - $this->assertEquals('text/plain', $this->detection->detectPath('foo.txt')); - $this->assertEquals('image/png', $this->detection->detectPath('foo.png')); - $this->assertEquals('image/png', $this->detection->detectPath('foo.bar.png')); - $this->assertEquals('image/png', $this->detection->detectPath('.hidden.png')); - $this->assertEquals('image/png', $this->detection->detectPath('.hidden.foo.png')); - $this->assertEquals('image/png', $this->detection->detectPath('.hidden/foo.png')); - $this->assertEquals('image/png', $this->detection->detectPath('.hidden/.hidden.png')); - $this->assertEquals('image/png', $this->detection->detectPath('test.jpg/foo.png')); - $this->assertEquals('application/octet-stream', $this->detection->detectPath('.png')); - $this->assertEquals('application/octet-stream', $this->detection->detectPath('..hidden')); - $this->assertEquals('application/octet-stream', $this->detection->detectPath('foo')); - $this->assertEquals('application/octet-stream', $this->detection->detectPath('')); - $this->assertEquals('image/png', $this->detection->detectPath('foo.png.ocTransferId123456789.part')); - $this->assertEquals('image/png', $this->detection->detectPath('foo.png.v1234567890')); + public function dataGetSecureMimeType(): array { + return [ + ['image/svg+xml', 'text/plain'], + ['image/png', 'image/png'], + ]; } - public function testDetectString() { - $result = $this->detection->detectString("/data/data.tar.gz"); - $expected = 'text/plain'; - $this->assertEquals($expected, $result); + /** + * @dataProvider dataGetSecureMimeType + * + * @param string $mimeType + * @param string $expected + */ + public function testGetSecureMimeType(string $mimeType, string $expected): void { + $this->assertEquals($expected, $this->detection->getSecureMimeType($mimeType)); } public function testMimeTypeIcon() { From 877e1bb55b5a454b4cda0ac92bc38c3aa1a04501 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Tue, 10 Dec 2019 10:56:47 +0100 Subject: [PATCH 5/7] Try more methods Signed-off-by: Joas Schilling --- lib/private/Files/Type/Detection.php | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index ce7a6f669c..2801bfadd1 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -213,7 +213,10 @@ class Detection implements IMimeTypeDetector { if ($info) { $info = strtolower($info); $mimeType = strpos($info, ';') !== false ? substr($info, 0, strpos($info, ';')) : $info; - return $this->getSecureMimeType($mimeType); + $mimeType = $this->getSecureMimeType($mimeType); + if ($mimeType !== 'application/octet-stream') { + return $mimeType; + } } } @@ -226,7 +229,10 @@ class Detection implements IMimeTypeDetector { // use mime magic extension if available $mimeType = mime_content_type($path); if ($mimeType !== false) { - return $this->getSecureMimeType($mimeType); + $mimeType = $this->getSecureMimeType($mimeType); + if ($mimeType !== 'application/octet-stream') { + return $mimeType; + } } } @@ -241,7 +247,10 @@ class Detection implements IMimeTypeDetector { if ($mimeType !== false) { //trim the newline $mimeType = trim($mimeType); - return $this->getSecureMimeType($mimeType); + $mimeType = $this->getSecureMimeType($mimeType); + if ($mimeType !== 'application/octet-stream') { + return $mimeType; + } } } From c743af30d6dd5b76f42f8dc76a23ccfacf494352 Mon Sep 17 00:00:00 2001 From: Roeland Jago Douma Date: Thu, 12 Dec 2019 09:58:22 +0100 Subject: [PATCH 6/7] Fix detection of non extention types Signed-off-by: Roeland Jago Douma --- lib/private/Files/Type/Detection.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/private/Files/Type/Detection.php b/lib/private/Files/Type/Detection.php index 2801bfadd1..ebd28e7cd2 100644 --- a/lib/private/Files/Type/Detection.php +++ b/lib/private/Files/Type/Detection.php @@ -181,8 +181,11 @@ class Detection implements IMimeTypeDetector { $fileName = preg_replace('!((\.v\d+)|((\.ocTransferId\d+)?\.part))$!', '', $fileName); //try to guess the type by the file extension - $extension = strtolower(strrchr($fileName, '.')); - $extension = substr($extension, 1); //remove leading . + $extension = strrchr($fileName, '.'); + if ($extension !== false) { + $extension = strtolower($extension); + $extension = substr($extension, 1); //remove leading . + } return (isset($this->mimetypes[$extension]) && isset($this->mimetypes[$extension][0])) ? $this->mimetypes[$extension][0] : 'application/octet-stream'; From 42a51146d1b353f4e5eaf5bd8132047a668ab6c3 Mon Sep 17 00:00:00 2001 From: Joas Schilling Date: Thu, 12 Dec 2019 22:19:53 +0100 Subject: [PATCH 7/7] 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