Exclude .rnd files from integrity check

Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
This commit is contained in:
Daniel Kesselberg 2019-07-21 20:29:11 +02:00
parent 5b604eaeab
commit 8bed3021bd
No known key found for this signature in database
GPG key ID: 36E3664E099D0614
2 changed files with 6 additions and 4 deletions

View file

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

View file

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