diff --git a/system/Commands/Utilities/ConfigCheck.php b/system/Commands/Utilities/ConfigCheck.php index c42de1eb7566..7d6dc332ca45 100644 --- a/system/Commands/Utilities/ConfigCheck.php +++ b/system/Commands/Utilities/ConfigCheck.php @@ -13,9 +13,11 @@ namespace CodeIgniter\Commands\Utilities; +use CodeIgniter\Cache\FactoriesCache; use CodeIgniter\CLI\BaseCommand; use CodeIgniter\CLI\CLI; use CodeIgniter\Config\BaseConfig; +use Config\Optimize; use Kint\Kint; /** @@ -87,6 +89,14 @@ public function run(array $params) /** @var class-string $class */ $class = $params[0]; + // Load Config cache if it is enabled. + $configCacheEnabled = class_exists(Optimize::class) + && (new Optimize())->configCacheEnabled; + if ($configCacheEnabled) { + $factoriesCache = new FactoriesCache(); + $factoriesCache->load('config'); + } + $config = config($class); if ($config === null) { @@ -103,6 +113,10 @@ public function run(array $params) ); } + CLI::newLine(); + $state = CLI::color($configCacheEnabled ? 'Enabled' : 'Disabled', 'green'); + CLI::write('Config Caching: ' . $state); + return EXIT_SUCCESS; } diff --git a/user_guide_src/source/general/configuration.rst b/user_guide_src/source/general/configuration.rst index 27d3fd3d76c4..bfb4b0f1b4ef 100644 --- a/user_guide_src/source/general/configuration.rst +++ b/user_guide_src/source/general/configuration.rst @@ -378,10 +378,11 @@ Confirming Config Values ************************ The actual Config object property values are changed at runtime by the :ref:`registrars` -and :ref:`Environment Variables `. +and :ref:`Environment Variables `, +and :ref:`factories-config-caching`. CodeIgniter has the following :doc:`command <../cli/spark_commands>` to check -Config values. +the actual Config values. .. _spark-config-check: @@ -417,3 +418,9 @@ The output is like the following: public 'CSPEnabled' -> boolean false ) + Config Caching: Disabled + +You can see if Config Caching is eabled or not. + +.. note:: If Config Caching is enabled, the cached values are used permanently. + See :ref:`factories-config-caching` for details.