diff --git a/public/index.php b/public/index.php index d031ea10944a..0cdc61b05ddd 100644 --- a/public/index.php +++ b/public/index.php @@ -43,6 +43,11 @@ 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 INSTANCE diff --git a/spark b/spark index f2ba3f305ceb..2ea79d5ccdaf 100755 --- 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(); diff --git a/system/CodeIgniter.php b/system/CodeIgniter.php index 8bdcc15bc16e..3664c0321fa2 100644 --- a/system/CodeIgniter.php +++ b/system/CodeIgniter.php @@ -200,7 +200,6 @@ public function __construct(App $config) public function initialize() { // Define environment variables - $this->detectEnvironment(); $this->bootstrapEnvironment(); // Setup Exception Handling @@ -560,6 +559,8 @@ protected function handleRequest(?RouteCollectionInterface $routes, Cache $cache * production * * @codeCoverageIgnore + * + * @deprecated 4.4.0 No longer used. Moved to index.php and spark. */ protected function detectEnvironment() {