File tree 2 files changed +23
-2
lines changed
system/Commands/Utilities
user_guide_src/source/general
2 files changed +23
-2
lines changed Original file line number Diff line number Diff line change 13
13
14
14
namespace CodeIgniter \Commands \Utilities ;
15
15
16
+ use CodeIgniter \Cache \FactoriesCache ;
16
17
use CodeIgniter \CLI \BaseCommand ;
17
18
use CodeIgniter \CLI \CLI ;
18
19
use CodeIgniter \Config \BaseConfig ;
20
+ use Config \Optimize ;
19
21
use Kint \Kint ;
20
22
21
23
/**
@@ -87,6 +89,14 @@ public function run(array $params)
87
89
/** @var class-string<BaseConfig> $class */
88
90
$ class = $ params [0 ];
89
91
92
+ // Load Config cache if it is enabled.
93
+ $ configCacheEnabled = class_exists (Optimize::class)
94
+ && (new Optimize ())->configCacheEnabled ;
95
+ if ($ configCacheEnabled ) {
96
+ $ factoriesCache = new FactoriesCache ();
97
+ $ factoriesCache ->load ('config ' );
98
+ }
99
+
90
100
$ config = config ($ class );
91
101
92
102
if ($ config === null ) {
@@ -103,6 +113,10 @@ public function run(array $params)
103
113
);
104
114
}
105
115
116
+ CLI ::newLine ();
117
+ $ state = CLI ::color ($ configCacheEnabled ? 'Enabled ' : 'Disabled ' , 'green ' );
118
+ CLI ::write ('Config Caching: ' . $ state );
119
+
106
120
return EXIT_SUCCESS ;
107
121
}
108
122
Original file line number Diff line number Diff line change @@ -378,10 +378,11 @@ Confirming Config Values
378
378
************************
379
379
380
380
The actual Config object property values are changed at runtime by the :ref: `registrars `
381
- and :ref: `Environment Variables <configuration-classes-and-environment-variables >`.
381
+ and :ref: `Environment Variables <configuration-classes-and-environment-variables >`,
382
+ and :ref: `factories-config-caching `.
382
383
383
384
CodeIgniter has the following :doc: `command <../cli/spark_commands >` to check
384
- Config values.
385
+ the actual Config values.
385
386
386
387
.. _spark-config-check :
387
388
@@ -417,3 +418,9 @@ The output is like the following:
417
418
public 'CSPEnabled' -> boolean false
418
419
)
419
420
421
+ Config Caching: Disabled
422
+
423
+ You can see if Config Caching is eabled or not.
424
+
425
+ .. note :: If Config Caching is enabled, the cached values are used permanently.
426
+ See :ref: `factories-config-caching ` for details.
You can’t perform that action at this time.
0 commit comments