{
private ?LicenseData $licenseData;
private array $expiredLicenses;
+ private bool $fetchLicenseDataFailed = false;
#[\Override]
public function isAccessible(): bool
#[\Override]
public function hasContent(): bool
{
- return $this->getExpiredLicenses() !== [];
+ return $this->getExpiredLicenses() !== [] || $this->fetchLicenseDataFailed;
}
private function getExpiredLicenses(): array
{
if (!isset($this->licenseData)) {
$licenseApi = new LicenseApi();
- $this->licenseData = $licenseApi->getUpToDateLicenseData();
+
+ try {
+ $this->licenseData = $licenseApi->getUpToDateLicenseData();
+ } catch (\Throwable) {
+ $this->licenseData = null;
+ $this->fetchLicenseDataFailed = true;
+ }
}
return $this->licenseData;
#[\Override]
public function getContent(): string
{
+ if ($this->fetchLicenseDataFailed) {
+ return \sprintf(
+ '<woltlab-core-notice type="error">%s</woltlab-core-notice>',
+ WCF::getLanguage()->getDynamicVariable('wcf.acp.license.error.parsingFailed', [
+ 'licenseData' => null,
+ ])
+ );
+ }
+
$packages = [];
foreach (\array_keys($this->getExpiredLicenses()) as $packageName) {
$packages[$packageName] = PackageCache::getInstance()->getPackageByIdentifier($packageName);