Skip to content

Commit

Permalink
v0.1.0.1-alpha. Fix install & timezone
Browse files Browse the repository at this point in the history
  • Loading branch information
FlamesONE committed Mar 30, 2024
1 parent 616c5a4 commit 5b4ab2c
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 9 deletions.
2 changes: 1 addition & 1 deletion app/Core/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ final class App
*
* @var string
*/
public const VERSION = '0.1.0-alpha';
public const VERSION = '0.1.0.1-alpha';

/**
* Set the base path of the application
Expand Down
2 changes: 1 addition & 1 deletion app/Core/Http/Views/Installer/steps/2.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class="col-md-12 ext @if ($reqs['php_version']['current'] < 8) {{ $reqs['php_ver
@endif
</div>
<div class="ext_name">
<span class="status-label">{{ $reqs['opcache_enabled']['required'] ? __('install.2.all_good') : __('install.2.may_installed') }}</span>
<span class="status-label">{{ $reqs['opcache_enabled']['required'] ? __('install.2.all_good') : __('install.2.may_unstable') }}</span>
<p>OPCache: {{ $reqs['opcache_enabled']['current'] ? __('install.on') : __('install.off') }}</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/Core/Installer/Steps/DatabaseStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ protected function checkConnection(APIInstallerController $installController, ar
} catch (DatabaseException $e) {
// Возвращаем сообщение об ошибке, если подключение не удалось
return $installController->error($installController->trans('db_error', [
"%error%" => mb_convert_encoding($e->getTraceAsString(), 'UTF-8'),
"%error%" => mb_convert_encoding($e->getMessage(), 'UTF-8'),
]));
}
} else {
Expand Down
12 changes: 11 additions & 1 deletion app/Core/Installer/Steps/LangStep.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class LangStep extends AbstractStep
public function install(\Flute\Core\Support\FluteRequest $request, APIInstallerController $installController) : Response
{
$lang = (string) $request->input('lang');
$timezone = (string) $request->input('timezone');
$timezone = (string) $this->checkTimezone($request->input('timezone'));

if (!in_array($lang, config('lang.available'))) {
return $installController->error($installController->trans('Несуществующий язык'));
Expand All @@ -31,4 +31,14 @@ public function install(\Flute\Core\Support\FluteRequest $request, APIInstallerC

return $installController->success();
}

protected function checkTimezone( string $timezone ) : string
{
switch ($timezone) {
case 'Europe/Kyiv':
return 'Europe/Kiev';
default:
return $timezone;
}
}
}
2 changes: 2 additions & 0 deletions app/Core/ServiceProviders/ConfigurationServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ public function boot(\DI\Container $container) : void

app()->debug($configs['app']['debug']);
app()->setLang($configs['lang']['locale']);

date_default_timezone_set($configs['app']['timezone']);
}

private function registerConfigServices(array $configs, \DI\Container $container, string $prefix = ''): void
Expand Down
2 changes: 1 addition & 1 deletion app/Core/Services/UserService.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ protected function sessionExpired()
*
* @return User
*/
public function getCurrentUser(): User
public function getCurrentUser(): ?User
{
if (!$this->currentUser) {
$this->authSession();
Expand Down
2 changes: 1 addition & 1 deletion config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
'logo' => 'assets/img/logo.svg',
'key' => '',
'tips' => true,
'timezone' => 'Asia/Yekaterinburg',
'timezone' => '',
'notifications' => 'all',
'mode' => 'default',
'share' => false,
Expand Down
6 changes: 3 additions & 3 deletions config/tips_complete.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,16 @@
'editor' =>
array (
'permission' => 'admin.pages',
'completed' => true,
'completed' => false,
),
'admin_stats' =>
array (
'permission' => 'admin.stats',
'completed' => true,
'completed' => false,
),
'admin_settings' =>
array (
'permission' => 'admin.system',
'completed' => true,
'completed' => false,
),
);

0 comments on commit 5b4ab2c

Please sign in to comment.