From 5cd594131a38801e6da1521f3eaa8c29749db627 Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Thu, 18 Sep 2014 13:52:37 +0200 Subject: [PATCH] Added proper error message for commercial products via update server --- .../files/lib/data/package/update/PackageUpdate.class.php | 6 ++++++ .../system/package/PackageInstallationScheduler.class.php | 2 ++ .../lib/system/package/PackageUpdateDispatcher.class.php | 5 +++-- wcfsetup/install/files/lib/util/HTTPRequest.class.php | 1 + wcfsetup/install/lang/de.xml | 1 + wcfsetup/install/lang/en.xml | 1 + 6 files changed, 14 insertions(+), 2 deletions(-) diff --git a/wcfsetup/install/files/lib/data/package/update/PackageUpdate.class.php b/wcfsetup/install/files/lib/data/package/update/PackageUpdate.class.php index 0b7a6ecf9a..db130cfda2 100644 --- a/wcfsetup/install/files/lib/data/package/update/PackageUpdate.class.php +++ b/wcfsetup/install/files/lib/data/package/update/PackageUpdate.class.php @@ -23,6 +23,12 @@ class PackageUpdate extends DatabaseObject { */ protected static $databaseTableIndexName = 'packageUpdateID'; + /** + * package update API version + * @var string + */ + const API_VERSION = '2.1'; + /** * Returns the name of the package the update belongs to. * diff --git a/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php b/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php index 19416dabcc..897139cb03 100644 --- a/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageInstallationScheduler.class.php @@ -1,6 +1,7 @@ packageUpdateServers[$packageUpdateVersion['packageUpdateServerID']]->serverURL, (!empty($authData) ? array('auth' => $authData) : array()), array( + 'apiVersion' => PackageUpdate::API_VERSION, 'packageName' => $packageUpdateVersion['package'], 'packageVersion' => $packageUpdateVersion['packageVersion'] ) diff --git a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php index 5b6d1fa41d..602ca971bb 100644 --- a/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php +++ b/wcfsetup/install/files/lib/system/package/PackageUpdateDispatcher.class.php @@ -3,9 +3,8 @@ namespace wcf\system\package; use wcf\data\package\update\server\PackageUpdateServer; use wcf\data\package\update\server\PackageUpdateServerEditor; use wcf\data\package\update\version\PackageUpdateVersionEditor; -use wcf\data\package\update\version\PackageUpdateVersionList; +use wcf\data\package\update\PackageUpdate; use wcf\data\package\update\PackageUpdateEditor; -use wcf\data\package\update\PackageUpdateList; use wcf\data\package\Package; use wcf\system\cache\builder\PackageUpdateCacheBuilder; use wcf\system\database\util\PreparedStatementConditionBuilder; @@ -17,6 +16,7 @@ use wcf\system\SingletonFactory; use wcf\system\WCF; use wcf\util\HTTPRequest; use wcf\util\XML; +use wcf\data\package\update\PackageUpdate; /** * Provides functions to manage package updates. @@ -84,6 +84,7 @@ class PackageUpdateDispatcher extends SingletonFactory { if ($authData) $settings['auth'] = $authData; $postData = array( + 'apiVersion' => PackageUpdate::API_VERSION, 'lastUpdateTime' => $updateServer->lastUpdateTime ); diff --git a/wcfsetup/install/files/lib/util/HTTPRequest.class.php b/wcfsetup/install/files/lib/util/HTTPRequest.class.php index 3289cb9490..7e0589671e 100644 --- a/wcfsetup/install/files/lib/util/HTTPRequest.class.php +++ b/wcfsetup/install/files/lib/util/HTTPRequest.class.php @@ -432,6 +432,7 @@ final class HTTPRequest { break; case '401': + case '402': case '403': throw new HTTPUnauthorizedException("Received status code '".$this->statusCode."' from server"); break; diff --git a/wcfsetup/install/lang/de.xml b/wcfsetup/install/lang/de.xml index e583b3bb5e..c165d8bb7e 100644 --- a/wcfsetup/install/lang/de.xml +++ b/wcfsetup/install/lang/de.xml @@ -1133,6 +1133,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]> requiresLicense()}Lizenz- und Seriennummer{else}Benutzername und Passwort{/if}.]]> + requiresLicense()}Lizenz- und Seriennummer{else}Benutzername und Passwort{/if} wurden vom Server akzeptiert, es handelt sich aber um einer kommerzielles Produkt auf das diese Zugangsdaten keinen Zugriff haben.]]> diff --git a/wcfsetup/install/lang/en.xml b/wcfsetup/install/lang/en.xml index b3a4fc4229..2eb20232cf 100644 --- a/wcfsetup/install/lang/en.xml +++ b/wcfsetup/install/lang/en.xml @@ -1132,6 +1132,7 @@ GmbH=Gesellschaft mit beschränkter Haftung]]> requiresLicense()}license and serial number{else}username and password{/if}.]]> + requiresLicense()}License and serial number{else}Username and password{/if} have been accepted by the server, but they do not grant you the permission to download this commercial product.]]> -- 2.20.1