From 8bed3021bd0e78105f74d0ff2d948bf720eb2e4d Mon Sep 17 00:00:00 2001 From: Daniel Kesselberg Date: Sun, 21 Jul 2019 20:29:11 +0200 Subject: [PATCH] Exclude .rnd files from integrity check Signed-off-by: Daniel Kesselberg --- .../Iterator/ExcludeFileByNameFilterIterator.php | 9 +++++---- .../Iterator/ExcludeFileByNameFilterIteratorTest.php | 1 + 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php index 26f4a56d15a..a82c74fd138 100644 --- a/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php +++ b/lib/private/IntegrityCheck/Iterator/ExcludeFileByNameFilterIterator.php @@ -43,6 +43,7 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator { 'Thumbs.db', // Microsoft Windows '.directory', // Dolphin (KDE) '.webapp', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manage web-apps. + '.rnd', ]; /** @@ -54,7 +55,7 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator { */ private $excludedFilenamePatterns = [ '/^\.webapp-nextcloud-(\d+\.){2}(\d+)(-r\d+)?$/', // Gentoo/Funtoo & derivatives use a tool known as webapp-config to manage wep-apps. - ]; + ]; /** * @return bool @@ -68,12 +69,12 @@ class ExcludeFileByNameFilterIterator extends \RecursiveFilterIterator { } $currentFileName = $current->getFilename(); - if (in_array($currentFileName, $this->excludedFilenames, true)){ + if (in_array($currentFileName, $this->excludedFilenames, true)) { return false; } - foreach ($this->excludedFilenamePatterns as $pattern){ - if (preg_match($pattern, $currentFileName) > 0){ + foreach ($this->excludedFilenamePatterns as $pattern) { + if (preg_match($pattern, $currentFileName) > 0) { return false; } } diff --git a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php index 124618eb538..8d5c38d275a 100644 --- a/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php +++ b/tests/lib/IntegrityCheck/Iterator/ExcludeFileByNameFilterIteratorTest.php @@ -45,6 +45,7 @@ class ExcludeFileByNameFilterIteratorTest extends TestCase { ['.webapp-nextcloud-15.0.2', false], ['.webapp-nextcloud-14.0.5-r3', false], ['wx.webapp-nextcloud-obee', true], + ['.rnd', false], ]; } -- 2.39.5