From 1abccce729b46236b6212a9af6f9c2baaeecaffc Mon Sep 17 00:00:00 2001 From: Jason Napolitano <jason-napolitano@users.noreply.github.com> Date: Sat, 27 Jul 2019 18:17:00 -0700 Subject: [PATCH 1/2] Added app/Common.php A commit that will hopefully help with this topic: #2101. This is a re-submit due to lack of GPG signing in the previous PR: https://github.com/codeigniter4/CodeIgniter4/pull/2105 --- app/Common.php | 15 +++++++++++++++ system/bootstrap.php | 7 +++++++ 2 files changed, 22 insertions(+) create mode 100644 app/Common.php diff --git a/app/Common.php b/app/Common.php new file mode 100644 index 000000000000..385dc777e81e --- /dev/null +++ b/app/Common.php @@ -0,0 +1,15 @@ +<?php + +/** + * Te goal of this file is to allow developers a location + * where they can overwrite core procedural functions and + * replace them with their own. This file is loaded during + * the bootstrap process and is called during the frameworks + * execution. + * + * This can be looked at as a `master helper` file that is + * loaded early on, and may also contain additional functions + * that you'd like to use throughout your entire application + * + * @link: https://codeigniter4.github.io/CodeIgniter4/ + */ diff --git a/system/bootstrap.php b/system/bootstrap.php index 780c4b0b2c09..85f2f8d9fe46 100644 --- a/system/bootstrap.php +++ b/system/bootstrap.php @@ -96,6 +96,13 @@ require_once APPPATH . 'Config/Constants.php'; } +// Let's see if an app/Common.php file exists +if ( file_exists(APPPATH . 'Common.php')) { + // If it does, let's require it + require_once APPPATH . 'Common.php'; +} + +// Require system/Common.php require_once SYSTEMPATH . 'Common.php'; /* From 10ad52e18f6d6b2de2015535cde608bdad201e8b Mon Sep 17 00:00:00 2001 From: Lonnie Ezell <lonnieje@gmail.com> Date: Tue, 27 Aug 2019 23:00:26 -0500 Subject: [PATCH 2/2] Fix typo and format issue. --- app/Common.php | 2 +- system/bootstrap.php | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/app/Common.php b/app/Common.php index 385dc777e81e..780ba3f80198 100644 --- a/app/Common.php +++ b/app/Common.php @@ -1,7 +1,7 @@ <?php /** - * Te goal of this file is to allow developers a location + * The goal of this file is to allow developers a location * where they can overwrite core procedural functions and * replace them with their own. This file is loaded during * the bootstrap process and is called during the frameworks diff --git a/system/bootstrap.php b/system/bootstrap.php index 85f2f8d9fe46..f997e929cbfa 100644 --- a/system/bootstrap.php +++ b/system/bootstrap.php @@ -97,8 +97,8 @@ } // Let's see if an app/Common.php file exists -if ( file_exists(APPPATH . 'Common.php')) { - // If it does, let's require it +if (file_exists(APPPATH . 'Common.php')) +{ require_once APPPATH . 'Common.php'; }