Adjust format of the license file
authorTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Sep 2023 09:25:37 +0000 (11:25 +0200)
committerTim Düsterhus <duesterhus@woltlab.com>
Fri, 29 Sep 2023 09:25:37 +0000 (11:25 +0200)
- Use a format that is consistent with `lib/bootstrap.php`.
- Ensure a trailing newline.
- Use the `creationDate` from the LicenseData object as the more accurate date.

wcfsetup/install/files/lib/system/package/license/LicenseApi.class.php

index e0151f559f9f992776e36ba80a74e04a52ab59da..9d2726db2eacf603b5b3bb1a88c1863f7fa53659 100644 (file)
@@ -29,15 +29,8 @@ final class LicenseApi
     public function updateLicenseFile(?LicenseData $data): void
     {
         $writer = new AtomicWriter(self::LICENSE_FILE);
-        $writer->write(\sprintf(
-            <<<'EOT'
-                <?php
-                /* GENERATED AT %s -- DO NOT EDIT */
-                return unserialize(%s);
-                EOT,
-            \gmdate('r', \TIME_NOW),
-            \var_export(\serialize($data), true),
-        ));
+        $writer->write("<?php /* {$data->creationDate->format('c')} */\n\n");
+        $writer->write(\sprintf("return unserialize(%s);\n", \var_export(\serialize($data), true)));
         $writer->flush();
 
         WCF::resetZendOpcache(self::LICENSE_FILE);