From fdb119587e2d32a98758e2af43a0e109ba2a5fe5 Mon Sep 17 00:00:00 2001 From: ghost Date: Wed, 13 Sep 2023 18:47:16 +0300 Subject: [PATCH] set permissions on config file initiation --- src/config/bootstrap.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/config/bootstrap.php b/src/config/bootstrap.php index 81148d9..aa52f28 100644 --- a/src/config/bootstrap.php +++ b/src/config/bootstrap.php @@ -18,10 +18,12 @@ if (!in_array($_SERVER['PHP_ENV'], ['default', 'mirror', 'dev', 'test', 'prod']) // Generate configuration file if not exists if (!file_exists(__DIR__ . '/../../env.' . $_SERVER['PHP_ENV'] . '.php')) { - copy( - __DIR__ . '/../../example/environment/env.example.php', - __DIR__ . '/env.' . $_SERVER['PHP_ENV'] . '.php' - ); + if (copy(__DIR__ . '/../../example/environment/env.example.php', __DIR__ . '/env.' . $_SERVER['PHP_ENV'] . '.php')) + { + chmod(__DIR__ . '/env.' . $_SERVER['PHP_ENV'] . '.php', 0770); + } + + else exit (_('Could not init configuration file. Please check permissions.')); } // Load environment configuration