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 162f38c3854c6d5ca118a288ce4f889a618f50c5..f2120539b47c95a49a661f9c4183f03f8a01c158 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... 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 613287267df7e03752556c90887e93d6f0cb58c7..22fa25607a25df15874d6d56636d0394d56d622e 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,7 @@ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. */ + class cronjob_monitor_mem_usage extends cronjob { // job schedule @@ -74,13 +75,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; + } } /*