Skip to content

Commit

Permalink
Fixed issue CR-797: Only check versions from CU server once per day
Browse files Browse the repository at this point in the history
  • Loading branch information
olleharstedt committed Jan 4, 2023
1 parent 4deac13 commit 5cfb2df
Showing 1 changed file with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ public function beforeAdminMenuRender()

$update = (array)$this->getUpdate();

if ($update['result']) {
if ($update && $update['result']) {
//Default icon class
$iconClass = "";
$NotificationText = gT("Update available");
Expand Down Expand Up @@ -98,14 +98,19 @@ public function beforeAdminMenuRender()
/**
* This function check if update is available from the comfort update server
*
* @return void
* @return ?stdClass
*/
private function getUpdate()
{
$buttons = 1;
$updateModel = new UpdateForm();
$serverAnswer = $updateModel->getUpdateInfo($buttons);
return $serverAnswer;
// NB: Use getUpdateNotification, since it checks session for datetime to avoid multiple calls.
$serverAnswer = $updateModel->getUpdateNotification($buttons);
if ($serverAnswer && $serverAnswer->result) {
return $updateModel->getUpdateInfo($buttons);
} else {
return null;
}
}

/**
Expand Down

0 comments on commit 5cfb2df

Please sign in to comment.