refactor: Remove deprecated Cache::$storePath

This commit is contained in:
neznaika0 2025-01-12 13:21:30 +03:00
parent b635a1790f
commit c6bb6e9552
No known key found for this signature in database
GPG Key ID: 7B8BD4FF88B7C50C
4 changed files with 13 additions and 35 deletions

View File

@ -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.
*

View File

@ -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, '/') . '/';

View File

@ -37,14 +37,14 @@ final class CacheFactoryTest extends CIUnitTestCase
// 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 @@ final class CacheFactoryTest extends CIUnitTestCase
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 @@ final class CacheFactoryTest extends CIUnitTestCase
// 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 @@ final class CacheFactoryTest extends CIUnitTestCase
// Initialize path
$this->config = new Cache();
$this->config->storePath .= self::$directory;
$this->config->file['storePath'] .= self::$directory;
}
}

View File

@ -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