From 58a11ab5a36de71a5dbf1ce37477002c8d0c064b Mon Sep 17 00:00:00 2001
From: Andrey Zhdanov <52035133+sorquan@users.noreply.github.com>
Date: Sat, 11 Sep 2021 14:45:59 +0300
Subject: [PATCH] Fix Incorrect DATETIME value error (#3382)

By default, the lastSeen field of the ip address is set to '1970-01-01 00:00:01'.
In mysql 8.0, the script does not work correctly referring to the incorrect date format '0000-00-00 00:00:00'.
Specifying the date '0000-00-00 00:00:00' does not make sense.
---
 functions/scripts/remove_offline_addresses.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/functions/scripts/remove_offline_addresses.php b/functions/scripts/remove_offline_addresses.php
index d35a1835..3d7dc19f 100644
--- a/functions/scripts/remove_offline_addresses.php
+++ b/functions/scripts/remove_offline_addresses.php
@@ -44,7 +44,7 @@ $query = "select
 			and `su`.`pingSubnet` = 1
 			and (`ip`.`excludePing` IS NULL or `ip`.`excludePing`!=1 )
 			and
-			(`ip`.`lastSeen` < '$beforetime' and `ip`.`lastSeen` != '0000-00-00 00:00:00' and `ip`.`lastSeen` is not NULL);";
+			(`ip`.`lastSeen` < '$beforetime' and `ip`.`lastSeen` != '1970-01-01 00:00:01' and `ip`.`lastSeen` is not NULL);";
 
 # fetch
 try { $offline_addresses = $Database->getObjectsQuery($query); }
-- 
GitLab