diff --git a/app/Config/Cache.php b/app/Config/Cache.php index 3fbade6840cc..9ae2e843ac91 100644 --- a/app/Config/Cache.php +++ b/app/Config/Cache.php @@ -34,18 +34,6 @@ class Cache extends BaseConfig */ public string $backupHandler = 'dummy'; - /** - * -------------------------------------------------------------------------- - * Cache Directory Path - * -------------------------------------------------------------------------- - * - * The path to where cache files should be stored, if using a file-based - * system. - * - * @deprecated Use the driver-specific variant under $file - */ - public string $storePath = WRITEPATH . 'cache/'; - /** * -------------------------------------------------------------------------- * Key Prefix @@ -86,6 +74,7 @@ class Cache extends BaseConfig * -------------------------------------------------------------------------- * File settings * -------------------------------------------------------------------------- + * * Your file storage preferences can be specified below, if you are using * the File driver. * @@ -100,6 +89,7 @@ class Cache extends BaseConfig * ------------------------------------------------------------------------- * Memcached settings * ------------------------------------------------------------------------- + * * Your Memcached servers can be specified below, if you are using * the Memcached drivers. * diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index 525616a71068..0a97a89f4862 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -54,13 +54,6 @@ class FileHandler extends BaseHandler */ public function __construct(Cache $config) { - if (! property_exists($config, 'file')) { - $config->file = [ - 'storePath' => $config->storePath ?? WRITEPATH . 'cache', - 'mode' => 0640, - ]; - } - $this->path = ! empty($config->file['storePath']) ? $config->file['storePath'] : WRITEPATH . 'cache'; $this->path = rtrim($this->path, '/') . '/'; diff --git a/tests/system/Cache/CacheFactoryTest.php b/tests/system/Cache/CacheFactoryTest.php index 0947f31d5045..02fce236e3eb 100644 --- a/tests/system/Cache/CacheFactoryTest.php +++ b/tests/system/Cache/CacheFactoryTest.php @@ -37,14 +37,14 @@ protected function setUp(): void // Initialize path $this->config = new Cache(); - $this->config->storePath .= self::$directory; + $this->config->file['storePath'] .= self::$directory; } protected function tearDown(): void { - if (is_dir($this->config->storePath)) { - chmod($this->config->storePath, 0777); - rmdir($this->config->storePath); + if (is_dir($this->config->file['storePath'])) { + chmod($this->config->file['storePath'], 0777); + rmdir($this->config->file['storePath']); } } @@ -75,8 +75,8 @@ public function testGetHandlerExceptionCacheHandlerNotFound(): void public function testGetDummyHandler(): void { - if (! is_dir($this->config->storePath)) { - mkdir($this->config->storePath, 0555, true); + if (! is_dir($this->config->file['storePath'])) { + mkdir($this->config->file['storePath'], 0555, true); } $this->config->handler = 'dummy'; @@ -85,13 +85,13 @@ public function testGetDummyHandler(): void // Initialize path $this->config = new Cache(); - $this->config->storePath .= self::$directory; + $this->config->file['storePath'] .= self::$directory; } public function testHandlesBadHandler(): void { - if (! is_dir($this->config->storePath)) { - mkdir($this->config->storePath, 0555, true); + if (! is_dir($this->config->file['storePath'])) { + mkdir($this->config->file['storePath'], 0555, true); } $this->config->handler = 'dummy'; @@ -104,6 +104,6 @@ public function testHandlesBadHandler(): void // Initialize path $this->config = new Cache(); - $this->config->storePath .= self::$directory; + $this->config->file['storePath'] .= self::$directory; } } diff --git a/utils/phpstan-baseline/function.alreadyNarrowedType.neon b/utils/phpstan-baseline/function.alreadyNarrowedType.neon index 346807df2847..740fa9659412 100644 --- a/utils/phpstan-baseline/function.alreadyNarrowedType.neon +++ b/utils/phpstan-baseline/function.alreadyNarrowedType.neon @@ -1,12 +1,7 @@ -# total 3 errors +# total 2 errors parameters: ignoreErrors: - - - message: '#^Call to function property_exists\(\) with Config\\Cache and ''file'' will always evaluate to true\.$#' - count: 1 - path: ../../system/Cache/Handlers/FileHandler.php - - message: '#^Call to function is_array\(\) with array will always evaluate to true\.$#' count: 1