From b5599457d6a7640e73db6d3d46dbb9e92a097964 Mon Sep 17 00:00:00 2001 From: Mathieu Ducrot Date: Tue, 26 Mar 2024 17:19:09 +0100 Subject: [PATCH] Add IniOverrideConfig::initDefaultTimezoneForCli when using with PHP CLI on Clever --- CHANGELOG.md | 11 +++++++++++ src/Config/IniOverrideConfig.php | 9 +++++++++ 2 files changed, 20 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a1d7ca..facc520 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,16 @@ CHANGELOG for 1.x =================== +## v1.2.0 - (2024-03-26) +### Added +- Common Entity Interface and Trait such as the `ProcessInterface` which we will use to monitor cron, api and file generation. +- `ProcessMonitor` to centralize process code management +- `CommandPoolHelper` service to fetch data about the project symfony commands (like getting all cron choices) +- `DateUtils::secondsToString` helper to convert seconds into a small summary string +- `IniOverrideConfig::initDefaultTimezoneForCli` helper to properly set the timezone when using date with PHP CLI on CleverCloud + +### Fixed +- `RegexUtils::PHONE_PATTERN` remove wrong extra digit needed on foreign number + ## v1.1.0 - (2024-03-25) ### Added - new `ArrayUtils` methods : `checkIssetKeys`, `trimExplode`, `removeEmpty`, `filterByPattern`, `flatToMap` diff --git a/src/Config/IniOverrideConfig.php b/src/Config/IniOverrideConfig.php index 104fd48..2996c83 100644 --- a/src/Config/IniOverrideConfig.php +++ b/src/Config/IniOverrideConfig.php @@ -40,4 +40,13 @@ public function resetMemoryLimit(): void { ini_set('memory_limit', $this->getDefaultMemoryLimit()); } + + /** + * Call this function on every PHP script run with the CLI (ex: all symfony cron commands) when you are on CleverCloud to ensure every date + * creation or comparaison are using the right timezone. + */ + public function initDefaultTimezoneForCli(string $timezone = 'Europe/Paris'): void + { + date_default_timezone_set($timezone); + } }