use wcf\data\package\update\server\PackageUpdateServer;
use wcf\page\AbstractPage;
use wcf\system\database\util\PreparedStatementConditionBuilder;
+use wcf\system\exception\NamedUserException;
+use wcf\system\package\license\exception\ParsingFailed;
use wcf\system\package\license\LicenseApi;
use wcf\system\package\license\LicenseData;
use wcf\system\request\LinkHandler;
(new PackageUpdateAction([], 'refreshDatabase'))->executeAction();
$licenseApi = new LicenseApi();
- $this->licenseData = $licenseApi->fetchFromRemote();
- $licenseApi->updateLicenseFile($this->licenseData);
+ try {
+ $this->licenseData = $licenseApi->readFromFile();
+
+ if (
+ $this->licenseData === null
+ // Cache valid license data for 2 minutes.
+ || $this->licenseData->creationDate->getTimestamp() < (\TIME_NOW - 2 * 60)
+ ) {
+ $this->licenseData = $licenseApi->fetchFromRemote();
+ $licenseApi->updateLicenseFile($this->licenseData);
+ }
+ } catch (ParsingFailed $e) {
+ if (\ENABLE_DEBUG_MODE && \ENABLE_DEVELOPER_TOOLS) {
+ throw $e;
+ }
+
+ throw new NamedUserException(WCF::getLanguage()->getDynamicVariable(
+ 'wcf.acp.license.error.parsingFailed',
+ [
+ 'licenseData' => $this->licenseData,
+ ]
+ ));
+ }
$identifiers = \array_merge(
\array_keys($this->licenseData->woltlab),
<item name="wcf.acp.license.package.installed"><![CDATA[Bereits installiert]]></item>
<item name="wcf.acp.license.package.outdated"><![CDATA[Bis Version {$accessibleVersion}]]></item>
<item name="wcf.acp.license.package.version"><![CDATA[Version]]></item>
+ <item name="wcf.acp.license.error.parsingFailed"><![CDATA[Die Aktualisierung der Lizenzinformationen ist fehlgeschlagen. Bitte <a href="{link controller="LicenseEdit"}{/link}">{if LANGUAGE_USE_INFORMAL_VARIANT}kontrolliere und aktualisiere{else}kontrollieren und aktualisieren Sie{/if} die Lizenzdaten</a>.{if $licenseData !== null} Der letzte erfolgreiche Abruf der Lizenzinformationen erfolgte am {time type='plainTime' time=$licenseData->creationDate}.{/if}]]></item>
</category>
<category name="wcf.acp.menu">
<item name="wcf.acp.menu.link.management"><![CDATA[Verwaltung]]></item>
<item name="wcf.acp.license.package.installed"><![CDATA[Already installed]]></item>
<item name="wcf.acp.license.package.outdated"><![CDATA[Up to version {$accessibleVersion}]]></item>
<item name="wcf.acp.license.package.version"><![CDATA[Version]]></item>
+ <item name="wcf.acp.license.error.parsingFailed"><![CDATA[Updating the license metadata failed. Please <a href="{link controller="LicenseEdit"}{/link}">verify and update the license credentials</a>.{if $licenseData !== null} The metadata was last updated on {time type='plainTime' time=$licenseData->creationDate}.{/if}]]></item>
</category>
<category name="wcf.acp.menu">
<item name="wcf.acp.menu.link.management"><![CDATA[Management]]></item>