diff --git a/system/Commands/Utilities/Optimize.php b/system/Commands/Utilities/Optimize.php index 958acf5a6072..613029297e0c 100644 --- a/system/Commands/Utilities/Optimize.php +++ b/system/Commands/Utilities/Optimize.php @@ -178,6 +178,8 @@ private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, /** * Disable Caching + * + * @return array */ private function disableCaching(): array { @@ -191,6 +193,8 @@ private function disableCaching(): array * Enable Caching * * @param array $options + * + * @return array */ private function enableCaching(array $options): array { diff --git a/tests/system/Commands/Utilities/OptimizeTest.php b/tests/system/Commands/Utilities/OptimizeTest.php index 9a901b010717..48fe4fbe3b27 100644 --- a/tests/system/Commands/Utilities/OptimizeTest.php +++ b/tests/system/Commands/Utilities/OptimizeTest.php @@ -41,10 +41,10 @@ public function testEnableConfigCaching(): void { $command = new Optimize(service('logger'), service('commands')); - $enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching'); + $runCaching = $this->getPrivateMethodInvoker($command, 'runCaching'); - // private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void - $enableCaching(true, null, null); + // private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void + $runCaching(true, null, null); // Check if config caching is enabled $this->assertFileContains('public bool $configCacheEnabled = true;', APPPATH . 'Config/Optimize.php'); @@ -54,10 +54,10 @@ public function testEnableLocatorCaching(): void { $command = new Optimize(service('logger'), service('commands')); - $enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching'); + $runCaching = $this->getPrivateMethodInvoker($command, 'runCaching'); - // private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void - $enableCaching(null, true, null); + // private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void + $runCaching(null, true, null); // Check if locator caching is enabled $this->assertFileContains('public bool $locatorCacheEnabled = true;', APPPATH . 'Config/Optimize.php'); @@ -67,10 +67,10 @@ public function testDisableCaching(): void { $command = new Optimize(service('logger'), service('commands')); - $enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching'); + $runCaching = $this->getPrivateMethodInvoker($command, 'runCaching'); - // private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void - $enableCaching(null, null, true); + // private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void + $runCaching(null, null, true); // Check if both caches are disabled $this->assertFileContains('public bool $configCacheEnabled = false;', APPPATH . 'Config/Optimize.php'); @@ -81,10 +81,10 @@ public function testWithoutOptions(): void { $command = new Optimize(service('logger'), service('commands')); - $enableCaching = $this->getPrivateMethodInvoker($command, 'enableCaching'); + $runCaching = $this->getPrivateMethodInvoker($command, 'runCaching'); - // private function enableCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void - $enableCaching(null, null, null); + // private function runCaching(?bool $enableConfigCache, ?bool $enableLocatorCache, ?bool $disable): void + $runCaching(null, null, null); // Check if both caches are disabled $this->assertFileContains('public bool $configCacheEnabled = true;', APPPATH . 'Config/Optimize.php'); diff --git a/user_guide_src/source/installation/deployment.rst b/user_guide_src/source/installation/deployment.rst index 0eb206ee9d04..74f56e7020bd 100644 --- a/user_guide_src/source/installation/deployment.rst +++ b/user_guide_src/source/installation/deployment.rst @@ -28,6 +28,21 @@ The ``spark optimize`` command performs the following optimizations: - Enabling `Config Caching`_ - Enabling `FileLocator Caching`_ +If you want disable or restore the actions above, run ``spark optimize -d`` +it will do a restore to default settings, as follow: + +.. versionadded:: 4.6.0 + +- `Reinstall Dev Packages`_ +- Disabling `Config Caching`_ +- Disabling `FileLocator Caching`_ + +Available options: + +- `-c` Enable only config caching. +- `-l` Enable only locator caching. +- `-d` Disable config and locator caching. + Composer Optimization =====================