-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add dynamic build date using time() function in VersionInfo #6473
base: stable
Are you sure you want to change the base?
Conversation
This update introduces a dynamic build date in the VersionInfo class using the time() function, allowing the build date to be set at runtime. This change ensures that the build date is always current without needing manual updates.
The server isn't built during runtime. It's built during build time. Please ensure the build time is accurate to a time generated during the build step rather than when the server is ran. |
src/VersionInfo.php
Outdated
@@ -103,4 +104,8 @@ public static function VERSION() : VersionString{ | |||
} | |||
return self::$fullVersion; | |||
} | |||
|
|||
public static function BUILD_DATE() : int { | |||
return time(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's supposed to be the time the phar was built, not the time the function was called.
This isn't as simple as just adding an extra function.
$pharPath = \Phar::running(false); | ||
$phar = \Phar::isValidPharFilename($pharPath) ? new \Phar($pharPath) : new \PharData($pharPath); | ||
$meta = $phar->getMetadata(); | ||
if (isset($meta["date"])) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This isn't going to magically appear in the phar metadata
This update introduces a dynamic build date in the
VersionInfo
class using thetime()
function, allowing the build date to be set at runtime. This change ensures that the build date is always current without needing manual updates.