Commit bf3f0374 authored by Sebastian Kummer's avatar Sebastian Kummer

ZP-1305 Save KOE's access time and alert if too old in z-push-admin.

The time is updated only every 6h which can cause a delay of up to 7h as
KOE does regular accesses once an hour.

Released under the Affero GNU General Public License (AGPL) version 3.
parent eefbcf6d
...@@ -59,6 +59,7 @@ class ASDevice extends StateObject { ...@@ -59,6 +59,7 @@ class ASDevice extends StateObject {
'koebuilddate' => false, 'koebuilddate' => false,
'koegabbackendfolderid' => false, 'koegabbackendfolderid' => false,
'koecapabilities' => array(), 'koecapabilities' => array(),
'koelastaccess' => false,
); );
static private $loadedData; static private $loadedData;
......
...@@ -98,6 +98,7 @@ class DeviceManager { ...@@ -98,6 +98,7 @@ class DeviceManager {
if ($this->IsKoe() && $this->device->GetKoeVersion() !== false) { if ($this->IsKoe() && $this->device->GetKoeVersion() !== false) {
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KOE: %s / %s / %s", $this->device->GetKoeVersion(), $this->device->GetKoeBuild(), strftime("%Y-%m-%d %H:%M", $this->device->GetKoeBuildDate()))); ZLog::Write(LOGLEVEL_DEBUG, sprintf("KOE: %s / %s / %s", $this->device->GetKoeVersion(), $this->device->GetKoeBuild(), strftime("%Y-%m-%d %H:%M", $this->device->GetKoeBuildDate())));
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KOE Capabilities: %s ", count($this->device->GetKoeCapabilities()) ? implode(',', $this->device->GetKoeCapabilities()) : 'unknown')); ZLog::Write(LOGLEVEL_DEBUG, sprintf("KOE Capabilities: %s ", count($this->device->GetKoeCapabilities()) ? implode(',', $this->device->GetKoeCapabilities()) : 'unknown'));
ZLog::Write(LOGLEVEL_DEBUG, sprintf("KOE Last confirmed access: %s (may be up to 7h old)", ($this->device->GetKoeLastAccess() ? strftime("%Y-%m-%d %H:%M", $this->device->GetKoeLastAccess()) : 'unknown')));
} }
} }
...@@ -164,6 +165,10 @@ class DeviceManager { ...@@ -164,6 +165,10 @@ class DeviceManager {
$this->device->SetKoeBuild(Request::GetKoeBuild()); $this->device->SetKoeBuild(Request::GetKoeBuild());
$this->device->SetKoeBuildDate(Request::GetKoeBuildDate()); $this->device->SetKoeBuildDate(Request::GetKoeBuildDate());
$this->device->SetKoeCapabilities(Request::GetKoeCapabilities()); $this->device->SetKoeCapabilities(Request::GetKoeCapabilities());
// update KOE last access time if it's at least 6h old
if ($this->device->GetKoeLastAccess() < time() - 21600) {
$this->device->SetKoeLastAccess(time());
}
} }
// data to be saved // data to be saved
......
...@@ -977,15 +977,21 @@ class ZPushAdminCLI { ...@@ -977,15 +977,21 @@ class ZPushAdminCLI {
echo "Kopano Outlook Extension:\n"; echo "Kopano Outlook Extension:\n";
echo "\tVersion:\t". $device->GetKoeVersion() ."\n"; echo "\tVersion:\t". $device->GetKoeVersion() ."\n";
echo "\tBuild:\t\t". $device->GetKoeBuild() ."\n"; echo "\tBuild:\t\t". $device->GetKoeBuild() ."\n";
echo "\tBuild Date:\t". strftime("%Y-%m-%d %H:%M",$device->GetKoeBuildDate()) ."\n"; echo "\tBuild Date:\t". strftime("%Y-%m-%d %H:%M", $device->GetKoeBuildDate()) ."\n";
echo "\tCapabilities:\t". (count($device->GetKoeCapabilities()) ? implode(',', $device->GetKoeCapabilities()) : 'unknown') ."\n"; echo "\tCapabilities:\t". (count($device->GetKoeCapabilities()) ? implode(',', $device->GetKoeCapabilities()) : 'unknown') ."\n";
echo "\tLast access:\t". ($device->GetKoeLastAccess() ? strftime("%Y-%m-%d", $device->GetKoeLastAccess()) : 'unknown') ."\n";
} }
echo "Attention needed:\t"; echo "Attention needed:\t";
if ($device->GetDeviceError()) if ($device->GetDeviceError()) {
echo $device->GetDeviceError() ."\n"; echo $device->GetDeviceError() ."\n";
else if (!isset($device->ignoredmessages) || empty($device->ignoredmessages)) { }
// if KOE's access time is older than 7:01 h than the last successful sync it's probably inactive
elseif ($device->GetKoeLastAccess() && $device->GetKoeLastAccess() + 25260 < $device->GetLastSyncTime()) {
echo "KOE seems to be inactive on client\n";
}
if (!isset($device->ignoredmessages) || empty($device->ignoredmessages)) {
echo "No errors known\n"; echo "No errors known\n";
} }
else { else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment