|
15 | 15 | use CraftCms\Cms\Support\Facades\Updates; |
16 | 16 | use CraftCms\Cms\Support\File; |
17 | 17 | use GuzzleHttp\Utils; |
18 | | -use Illuminate\Contracts\Config\Repository as ConfigRepository; |
19 | 18 | use Illuminate\Foundation\Application; |
20 | 19 | use Illuminate\Foundation\Console\AboutCommand; |
21 | 20 | use Illuminate\Foundation\Events\LocaleUpdated; |
|
29 | 28 | use Illuminate\Support\Facades\Config; |
30 | 29 | use Illuminate\Support\Facades\Event; |
31 | 30 | use Illuminate\Support\Facades\Gate; |
32 | | -use Illuminate\Support\Facades\Log; |
33 | 31 | use Illuminate\Support\Facades\Redirect; |
34 | 32 | use Illuminate\Support\Facades\URL; |
35 | 33 | use Illuminate\Support\ServiceProvider; |
36 | 34 | use Illuminate\Validation\Rules\Password; |
37 | | -use IntlDateFormatter; |
38 | | -use IntlException; |
39 | 35 | use Override; |
40 | 36 | use ReflectionClass; |
41 | 37 | use RuntimeException; |
@@ -70,7 +66,6 @@ public function boot(): void |
70 | 66 | 'Version' => Cms::VERSION, |
71 | 67 | ]); |
72 | 68 |
|
73 | | - $this->setTimezone(); |
74 | 69 | $this->setNamespace(); |
75 | 70 | $this->bootAliases(); |
76 | 71 |
|
@@ -121,11 +116,6 @@ private function registerMacros(): void |
121 | 116 | return Env::parseBoolean(app(ProjectConfig::class)->get('system.live')) ?? false; |
122 | 117 | }); |
123 | 118 |
|
124 | | - Application::macro( |
125 | | - 'getTimezone', |
126 | | - fn (): string => $this->make(ConfigRepository::class)->get('app.timezone') ?? date_default_timezone_get(), |
127 | | - ); |
128 | | - |
129 | 119 | // Register Collection::one() as an alias of first() |
130 | 120 | Collection::macro('one', fn () => $this->first(...func_get_args())); |
131 | 121 |
|
@@ -196,31 +186,6 @@ private function registerMacros(): void |
196 | 186 | )); |
197 | 187 | } |
198 | 188 |
|
199 | | - private function setTimezone(): void |
200 | | - { |
201 | | - $timezone = app(ProjectConfig::class)->get('system.timeZone') |
202 | | - ?? $this->app->make(ConfigRepository::class)->get('app.timezone') |
203 | | - ?? 'UTC'; |
204 | | - |
205 | | - $timezone = Env::parse($timezone); |
206 | | - |
207 | | - if ($timezone !== 'UTC') { |
208 | | - // Make sure that ICU supports this timezone |
209 | | - try { |
210 | | - $formatter = new IntlDateFormatter($this->app->getLocale(), IntlDateFormatter::NONE, IntlDateFormatter::NONE); |
211 | | - if (! $formatter->setTimeZone($timezone)) { |
212 | | - $timezone = 'UTC'; |
213 | | - } |
214 | | - } catch (IntlException) { |
215 | | - Log::warning("Time zone “{$timezone}” does not appear to be supported by ICU: ".intl_get_error_message()); |
216 | | - $timezone = 'UTC'; |
217 | | - } |
218 | | - } |
219 | | - |
220 | | - $this->app->make(ConfigRepository::class)->set('app.timezone', $timezone); |
221 | | - date_default_timezone_set($timezone); |
222 | | - } |
223 | | - |
224 | 189 | private function setNamespace(): void |
225 | 190 | { |
226 | 191 | /** |
|
0 commit comments