timezones fix

This commit is contained in:
Yuri Kuznetsov
2024-12-09 12:40:07 +02:00
parent aed02c3909
commit 2115535563
2 changed files with 25 additions and 3 deletions
@@ -31,6 +31,7 @@ namespace Espo\Core\Upgrades\Migrations\V9_0;
use Espo\Core\ORM\Repository\Option\SaveOption;
use Espo\Core\Upgrades\Migration\Script;
use Espo\Core\Utils\Config;
use Espo\Core\Utils\Metadata;
use Espo\Entities\Preferences;
use Espo\Entities\ScheduledJob;
@@ -44,6 +45,8 @@ class AfterUpgrade implements Script
public function __construct(
private EntityManager $entityManager,
private Metadata $metadata,
private Config $config,
private Config\ConfigWriter $configWriter,
) {}
public function run(): void
@@ -51,6 +54,7 @@ class AfterUpgrade implements Script
$this->setReactionNotifications();
$this->createScheduledJob();
$this->setAclLinks();
$this->fixTimezone();
}
private function createScheduledJob(): void
@@ -166,4 +170,22 @@ class AfterUpgrade implements Script
$this->metadata->save();
}
private function fixTimezone(): void
{
$map = [
'Europe/Kiev' => 'Europe/Kyiv',
'Europe/Uzhgorod' => 'Europe/Uzhhorod',
'Europe/Zaporozhye' => 'Europe/Zaporozhye',
];
$timeZone = $this->config->get('timeZone');
if (in_array($timeZone, array_keys($map))) {
$timeZone = $map[$timeZone];
$this->configWriter->set('timeZone', $timeZone);
$this->configWriter->save();
}
}
}
@@ -107,13 +107,13 @@
"Europe/Athens","Europe/Belgrade","Europe/Berlin","Europe/Bratislava","Europe/Brussels",
"Europe/Bucharest","Europe/Budapest","Europe/Busingen","Europe/Chisinau","Europe/Copenhagen",
"Europe/Dublin","Europe/Gibraltar","Europe/Guernsey","Europe/Helsinki","Europe/Isle_of_Man",
"Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kiev","Europe/Lisbon","Europe/Ljubljana",
"Europe/Istanbul","Europe/Jersey","Europe/Kaliningrad","Europe/Kyiv","Europe/Lisbon","Europe/Ljubljana",
"Europe/London","Europe/Luxembourg","Europe/Madrid","Europe/Malta","Europe/Mariehamn","Europe/Minsk",
"Europe/Monaco","Europe/Moscow","Europe/Oslo","Europe/Paris","Europe/Podgorica","Europe/Prague",
"Europe/Riga","Europe/Rome","Europe/Samara","Europe/San_Marino","Europe/Sarajevo","Europe/Simferopol",
"Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Uzhgorod",
"Europe/Skopje","Europe/Sofia","Europe/Stockholm","Europe/Tallinn","Europe/Tirane","Europe/Uzhhorod",
"Europe/Vaduz","Europe/Vatican","Europe/Vienna","Europe/Vilnius","Europe/Volgograd","Europe/Warsaw",
"Europe/Zagreb","Europe/Zaporozhye","Europe/Zurich","Indian/Antananarivo","Indian/Chagos",
"Europe/Zagreb","Europe/Zaporizhzhia","Europe/Zurich","Indian/Antananarivo","Indian/Chagos",
"Indian/Christmas","Indian/Cocos","Indian/Comoro","Indian/Kerguelen","Indian/Mahe","Indian/Maldives",
"Indian/Mauritius","Indian/Mayotte","Indian/Reunion","Pacific/Apia","Pacific/Auckland",
"Pacific/Chatham","Pacific/Chuuk","Pacific/Easter","Pacific/Efate","Pacific/Enderbury",