From a88538f95695f07a24ab8e4e8d3e8a3df3c40d05 Mon Sep 17 00:00:00 2001 From: Nephiaust <29741794+Nephiaust@users.noreply.github.com> Date: Sun, 17 Sep 2023 00:33:57 +0930 Subject: [PATCH 1/4] Added ignores for VSCode (missing items) Signed-off-by: Nephiaust <29741794+Nephiaust@users.noreply.github.com> --- .gitignore | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ef9abd3d60..334dbbc502 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,5 @@ .idea /nbproject/private/ -.vscode .phplint-cache *.swp @@ -37,4 +36,18 @@ Temporary Items .apdisk # Configuration for the Nova editor -.nova \ No newline at end of file +.nova + +# VS Code files for those working on multiple tools +.vscode/* +*.code-workspace + +# Local History for Visual Studio Code +.history/ + +# Built Visual Studio Code Extensions +*.vsix + +# Visual Studio code coverage results +*.coverage +*.coveragexml \ No newline at end of file -- GitLab From 57b93738c045a8e3ffa72615727e1d971ab70621 Mon Sep 17 00:00:00 2001 From: Nephiaust <29741794+Nephiaust@users.noreply.github.com> Date: Sun, 24 Sep 2023 19:41:31 +0930 Subject: [PATCH 2/4] Fixed warning for mem checks & clamav (Added check to test if line is >= 1 character) PHP Warning: Undefined array key 1 in /usr/local/ispconfig/server/ lib/classes/cron.d/100-monitor_mem_usage.inc.php on line 79 PHP Deprecated: trim(): Passing null to parameter #1 ($string) of type string is deprecated in /usr/local/ispconfig/server/lib/ classes/cron.d/100-monitor_mem_usage.inc.php on line 79 Signed-off-by: Nephiaust <29741794+Nephiaust@users.noreply.github.com> --- .../cron.d/100-monitor_mem_usage.inc.php | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php b/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php index 613287267d..c227cd125a 100644 --- a/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php +++ b/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php @@ -28,6 +28,8 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ +use IDS\Event; + class cronjob_monitor_mem_usage extends cronjob { // job schedule @@ -74,13 +76,15 @@ class cronjob_monitor_mem_usage extends cronjob { $memInfo = explode("\n", $miData); foreach ($memInfo as $line) { - $part = preg_split('/:/', $line); - $key = trim($part[0]); - $tmp = explode(' ', trim($part[1])); - $value = 0; - if (isset($tmp[1]) && $tmp[1] == 'kB') - $value = $tmp[0] * 1024; - $data[$key] = $value; + if (strlen($line) >= 1){ + $part = preg_split('/:/', $line); + $key = trim($part[0]); + $tmp = explode(' ', trim($part[1])); + $value = 0; + if (isset($tmp[1]) && $tmp[1] == 'kB') + $value = $tmp[0] * 1024; + $data[$key] = $value; + } } /* -- GitLab From f746ea8441d606121e5d74f12d1b882821425904 Mon Sep 17 00:00:00 2001 From: Nephiaust <29741794+Nephiaust@users.noreply.github.com> Date: Sun, 24 Sep 2023 19:42:10 +0930 Subject: [PATCH 3/4] Fixed warning for clamav checks (Added check to test if array is >= than 2) PHP Warning: Undefined array key -1 in /usr/local/ispconfig/server/lib /classes/cron.d/100-monitor_clamav_log.inc.php on line 111 PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in /usr/local/ispconfig/server/lib/classes/ cron.d/100-monitor_clamav_log.inc.php on line 111 Signed-off-by: Nephiaust <29741794+Nephiaust@users.noreply.github.com> --- .../cron.d/100-monitor_clamav_log.inc.php | 34 ++++++++++--------- 1 file changed, 18 insertions(+), 16 deletions(-) diff --git a/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php b/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php index 162f38c385..f2120539b4 100644 --- a/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php +++ b/server/lib/classes/cron.d/100-monitor_clamav_log.inc.php @@ -104,24 +104,26 @@ class cronjob_monitor_clamav_log extends cronjob { $tmp = explode("\n", $data); $lastLog = array(); - if ($tmp[sizeof($tmp) - 1] == '') { - /* the log ends with an empty line remove this */ - array_pop($tmp); - } - if (strpos($tmp[sizeof($tmp) - 1], '-------------') !== false) { - /* the log ends with "-----..." remove this */ - array_pop($tmp); - } - for ($i = sizeof($tmp) - 1; $i > 0; $i--) { - if (strpos($tmp[$i], '---------') === false) { - /* no delimiter found, so add this to the last-log */ - $lastLog[] = $tmp[$i]; - } else { - /* delimiter found, so there is no more line left! */ - break; + if (count($tmp) >= 2) { + if ($tmp[sizeof($tmp) - 1] == '') { + /* the log ends with an empty line remove this */ + array_pop($tmp); + } + if (strpos($tmp[sizeof($tmp) - 1], '-------------') !== false) { + /* the log ends with "-----..." remove this */ + array_pop($tmp); + } + for ($i = sizeof($tmp) - 1; $i > 0; $i--) { + if (strpos($tmp[$i], '---------') === false) { + /* no delimiter found, so add this to the last-log */ + $lastLog[] = $tmp[$i]; + } else { + /* delimiter found, so there is no more line left! */ + break; + } } } - + /* * Now we have the last log in the array. * Check if the outdated-string is found... -- GitLab From be140a958658defee3bd74b92a54446e85b95938 Mon Sep 17 00:00:00 2001 From: Till Brehm Date: Sat, 21 Oct 2023 07:44:24 +0000 Subject: [PATCH 4/4] Update 100-monitor_mem_usage.inc.php --- server/lib/classes/cron.d/100-monitor_mem_usage.inc.php | 1 - 1 file changed, 1 deletion(-) diff --git a/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php b/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php index c227cd125a..22fa25607a 100644 --- a/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php +++ b/server/lib/classes/cron.d/100-monitor_mem_usage.inc.php @@ -28,7 +28,6 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ -use IDS\Event; class cronjob_monitor_mem_usage extends cronjob { -- GitLab