From 987d8e592e2e3c2431c0debc94330dc8cedb540f Mon Sep 17 00:00:00 2001 From: "choi.jh" Date: Mon, 28 Aug 2023 10:39:37 +0900 Subject: [PATCH] cfmgrv3 init... --- public/index.php | 26 +++++++++++++++++++++++--- spark | 5 +++++ 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/public/index.php b/public/index.php index 96e7f45..1cc4710 100644 --- a/public/index.php +++ b/public/index.php @@ -16,7 +16,9 @@ if (version_compare(PHP_VERSION, $minPhpVersion, '<')) { define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR); // Ensure the current directory is pointing to the front controller's directory -chdir(FCPATH); +if (getcwd() . DIRECTORY_SEPARATOR !== FCPATH) { + chdir(FCPATH); +} /* *--------------------------------------------------------------- @@ -41,13 +43,23 @@ require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstra require_once SYSTEMPATH . 'Config/DotEnv.php'; (new CodeIgniter\Config\DotEnv(ROOTPATH))->load(); +// Define ENVIRONMENT +if (! defined('ENVIRONMENT')) { + define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production')); +} + +// Load Config Cache +// $factoriesCache = new \CodeIgniter\Cache\FactoriesCache(); +// $factoriesCache->load('config'); +// ^^^ Uncomment these lines if you want to use Config Caching. + /* * --------------------------------------------------------------- * GRAB OUR CODEIGNITER INSTANCE * --------------------------------------------------------------- * * The CodeIgniter class contains the core functionality to make - * the application run, and does all of the dirty work to get + * the application run, and does all the dirty work to get * the pieces all working together. */ @@ -60,8 +72,16 @@ $app->setContext($context); *--------------------------------------------------------------- * LAUNCH THE APPLICATION *--------------------------------------------------------------- - * Now that everything is setup, it's time to actually fire + * Now that everything is set up, it's time to actually fire * up the engines and make this app do its thang. */ $app->run(); + +// Save Config Cache +// $factoriesCache->save('config'); +// ^^^ Uncomment this line if you want to use Config Caching. + +// Exits the application, setting the exit code for CLI-based applications +// that might be watching. +exit(EXIT_SUCCESS); diff --git a/spark b/spark index f2ba3f3..2ea79d5 100644 --- a/spark +++ b/spark @@ -78,6 +78,11 @@ require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'bootstra require_once SYSTEMPATH . 'Config/DotEnv.php'; (new CodeIgniter\Config\DotEnv(ROOTPATH))->load(); +// Define ENVIRONMENT +if (! defined('ENVIRONMENT')) { + define('ENVIRONMENT', env('CI_ENVIRONMENT', 'production')); +} + // Grab our CodeIgniter $app = Config\Services::codeigniter(); $app->initialize();