From 781ddadaf8bbad3adb7eff727538877260b32148 Mon Sep 17 00:00:00 2001 From: Torqu3Wr3nch <46223457+Torqu3Wr3nch@users.noreply.github.com> Date: Wed, 3 May 2023 14:45:00 -0500 Subject: [PATCH] Don't exclude everything when nothing is set to be excluded Swapped out !empty for isset on exclusion array. isset returns true for an empty string. As the code was written, you were stuck with blanket/wildcard exclusions even when you didn't want to exclude anything at all. --- source/file-integrity/include/update.watcher.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/source/file-integrity/include/update.watcher.php b/source/file-integrity/include/update.watcher.php index ecbfb0b1..23d88532 100644 --- a/source/file-integrity/include/update.watcher.php +++ b/source/file-integrity/include/update.watcher.php @@ -43,10 +43,10 @@ function regex($text) { $hname = $hash[$method]; if (isset($docker[$img]) && strpos(dirname($docker[$img]),'/mnt/disk')!==false) $map[] = expand_file(basename($docker[$img])); -if (isset($new['folders'])) $map = array_merge($map,array_map('expand_folder',explode(',',$new['folders']))); -if (isset($new['files'])) $map = array_merge($map,array_map('expand_file',explode(',',$new['files']))); -if (isset($new['exclude'])) $map = array_merge($map,array_map('expand_share',explode(',',$new['exclude']))); -if (isset($new['apple'])) $map = array_merge($map,[expand_folder('.AppleDB'),expand_file('.DS_Store')]); +if (!empty($new['folders'])) $map = array_merge($map,array_map('expand_folder',explode(',',$new['folders']))); +if (!empty($new['files'])) $map = array_merge($map,array_map('expand_file',explode(',',$new['files']))); +if (!empty($new['exclude'])) $map = array_merge($map,array_map('expand_share',explode(',',$new['exclude']))); +if (!empty($new['apple'])) $map = array_merge($map,[expand_folder('.AppleDB'),expand_file('.DS_Store')]); if (count($map)>1) {$open = '('; $close = ')';} else {$open = $close = '';} $exclude = $map ? $open.regex(implode('|',$map)).$close : '';