From 33dae5a6813e78310e5696cad74d0d0d96ba7310 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 3 Nov 2023 18:21:14 +0100 Subject: [PATCH] Improve the messaging for paid updates --- .../packageUpdateUnauthorizedPaidUpgrade.tpl | 9 +++++++++ .../PackageUpdateUnauthorizedException.class.php | 15 +++++++++++++++ wcfsetup/install/lang/de.xml | 2 ++ wcfsetup/install/lang/en.xml | 2 ++ 4 files changed, 28 insertions(+) create mode 100644 wcfsetup/install/files/acp/templates/packageUpdateUnauthorizedPaidUpgrade.tpl diff --git a/wcfsetup/install/files/acp/templates/packageUpdateUnauthorizedPaidUpgrade.tpl b/wcfsetup/install/files/acp/templates/packageUpdateUnauthorizedPaidUpgrade.tpl new file mode 100644 index 0000000000..e8ba347280 --- /dev/null +++ b/wcfsetup/install/files/acp/templates/packageUpdateUnauthorizedPaidUpgrade.tpl @@ -0,0 +1,9 @@ +
+

{lang}wcf.acp.package.update.paidUpgrade{/lang}

+ +

{lang packageName=$packageName}wcf.acp.package.update.paidUpgrade.description{/lang}

+
+
+ {lang}wcf.acp.package.update.purchaseRequired.button.purchase{/lang} + +
\ No newline at end of file diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php index 0ee416b283..83029800c1 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateUnauthorizedException.class.php @@ -61,6 +61,20 @@ class PackageUpdateUnauthorizedException extends UserException { $serverReply = $this->request->getReply(); + $requiresPaidUpgrade = false; + if ($this->updateServer->isWoltLabStoreServer() && !empty($this->packageUpdateVersion['pluginStoreFileID'])) { + $requiresPaidUpgrade = ($serverReply['httpHeaders']['wcf-update-server-requires-paid-upgrade'][0] ?? '') === 'true'; + } + + if ($requiresPaidUpgrade) { + WCF::getTPL()->assign([ + 'packageName' => $this->packageUpdateVersion['packageName'], + 'pluginStoreFileID' => $this->packageUpdateVersion['pluginStoreFileID'], + ]); + + return WCF::getTPL()->fetch('packageUpdateUnauthorizedPaidUpgrade'); + } + $authInsufficient = (($serverReply['httpHeaders']['wcf-update-server-auth'][0] ?? '') === 'unauthorized'); if (ENABLE_ENTERPRISE_MODE && $authInsufficient && !empty($this->packageUpdateVersion['pluginStoreFileID'])) { WCF::getTPL()->assign([ @@ -78,6 +92,7 @@ class PackageUpdateUnauthorizedException extends UserException 'updateServer' => $this->updateServer, 'serverAuthData' => $this->updateServer->getAuthData(), 'serverReply' => $serverReply, + 'requiresPaidUpgrade' => $requiresPaidUpgrade, ]); return WCF::getTPL()->fetch('packageUpdateUnauthorized'); diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index 9bb99d8a42..a93eaaf620 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1918,6 +1918,8 @@ Die Datenbestände werden sorgfältig gepflegt, aber es ist nicht ausgeschlossen + + {$newVersion}]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index 9d46b6d396..c7cd4624ca 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1903,6 +1903,8 @@ The database is carefully maintained, but there will be always be a margin of er + + {$newVersion}]]> -- 2.20.1