From: Tim Düsterhus Date: Wed, 27 Sep 2023 13:32:14 +0000 (+0200) Subject: Clear the license data by writing `null` to the license file X-Git-Tag: 6.0.0_RC_2~3^2~3 X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9d1ac0b770107c40792334483983dbf6144e7fac;p=GitHub%2FWoltLab%2FWCF.git Clear the license data by writing `null` to the license file This will allow to save the readability check in a follow-up commit. --- diff --git a/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php b/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php index 252910d64b..5a1d93ee3c 100644 --- a/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php +++ b/wcfsetup/install/files/lib/acp/form/LicenseEditForm.class.php @@ -211,7 +211,7 @@ final class LicenseEditForm extends AbstractFormBuilderForm $authCode = $this->licenseData->license['authCode'] ?? ''; } else { - $this->licenseApi->removeLicenseFile(); + $this->licenseApi->clearLicenseFile(); } $objectAction = new OptionAction( diff --git a/wcfsetup/install/files/lib/system/package/license/LicenseApi.class.php b/wcfsetup/install/files/lib/system/package/license/LicenseApi.class.php index c51a028307..8bd70517d2 100644 --- a/wcfsetup/install/files/lib/system/package/license/LicenseApi.class.php +++ b/wcfsetup/install/files/lib/system/package/license/LicenseApi.class.php @@ -23,7 +23,7 @@ final class LicenseApi { private const LICENSE_FILE = \WCF_DIR . 'license.php'; - public function updateLicenseFile(LicenseData $data): void + public function updateLicenseFile(?LicenseData $data): void { @\file_put_contents( self::LICENSE_FILE, @@ -91,13 +91,9 @@ final class LicenseApi return require(self::LICENSE_FILE); } - public function removeLicenseFile(): void + public function clearLicenseFile(): void { - if (!\file_exists(self::LICENSE_FILE)) { - return; - } - - \unlink(self::LICENSE_FILE); + $this->updateLicenseFile(null); } public static function hasLicenseCredentials(): bool