From c0f7c4581cc998ec9c4ea6955bd20dfeddd39c96 Mon Sep 17 00:00:00 2001 From: trendschau Date: Mon, 4 Mar 2024 19:30:18 +0100 Subject: [PATCH] V2.2.2 Finish license update --- cache/timer.yaml | 2 +- .../typemill/Controllers/ControllerWebSystem.php | 2 +- system/typemill/Models/License.php | 15 +++++++++------ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/cache/timer.yaml b/cache/timer.yaml index a4bd127..42d6ff2 100644 --- a/cache/timer.yaml +++ b/cache/timer.yaml @@ -1 +1 @@ -licenseupdate: 1709153456 +licenseupdate: 1709508480 diff --git a/system/typemill/Controllers/ControllerWebSystem.php b/system/typemill/Controllers/ControllerWebSystem.php index c69909a..a220568 100644 --- a/system/typemill/Controllers/ControllerWebSystem.php +++ b/system/typemill/Controllers/ControllerWebSystem.php @@ -198,7 +198,7 @@ class ControllerWebSystem extends Controller } # check license data - $licensecheck = $license->checkLicense($licensedata, $this->c->get('urlinfo')); + $licensecheck = $license->checkLicense($licensedata, $this->c->get('urlinfo'), $forceUpdateCheck = true); if(!$licensecheck) { $message = $license->getMessage(); diff --git a/system/typemill/Models/License.php b/system/typemill/Models/License.php index 369b275..7adc933 100644 --- a/system/typemill/Models/License.php +++ b/system/typemill/Models/License.php @@ -69,7 +69,7 @@ class License } # check the local licence file (like pem or pub) - public function checkLicense($licensedata, array $urlinfo) + public function checkLicense($licensedata, array $urlinfo, $forceUpdateCheck = NULL) { if(!isset( $licensedata['license'], @@ -111,7 +111,7 @@ class License if(!$subscriptionPaid) { $storage = new StorageWrapper('\Typemill\Models\Storage'); - if(!$storage->timeoutIsOver('licenseupdate', 3600)) + if(!$forceUpdateCheck && !$storage->timeoutIsOver('licenseupdate', 3600)) { $this->message = Translations::translate('The subscription period has not been paid yet. We will check it every 60 minutes.') . $this->message; @@ -121,7 +121,7 @@ class License $update = $this->updateLicense($licensedata); if(!$update) { - $this->message = Translations::translate('We tried to check your subscription payment but it failed. Answer from server: ') . $this->message; + $this->message = Translations::translate('The subscription period has not been paid yet and we got an error. ') . $this->message; return false; } @@ -256,7 +256,7 @@ class License { $message = $signedLicense['code']; } - $this->message = Translations::translate('the license server responded with: ') . $message; + $this->message = Translations::translate('Answer from license server: ') . $message; return false; } @@ -290,7 +290,9 @@ class License 'license' => $data['license'], 'email' => $this->hashMail($readableMail), 'domain' => $data['domain'], - 'signature' => $data['signature'] + 'signature' => $data['signature'], + 'plan' => $data['plan'], + 'payed_until' => $data['payed_until'] ]; $postdata = http_build_query($licensedata); @@ -325,7 +327,8 @@ class License $message = $signedLicense['code']; } - $this->message = Translations::translate('the license server responded with: ') . $message; + # problem: if admin is on license website, then the first check has already been done on start in system and it has set timer, so the admin will never see this message from server. + $this->message = Translations::translate('Answer from license server: ') . $message; return false; }