diff --git a/system/Cache/Handlers/FileHandler.php b/system/Cache/Handlers/FileHandler.php index 0a97a89f4862..8f63c93acb20 100644 --- a/system/Cache/Handlers/FileHandler.php +++ b/system/Cache/Handlers/FileHandler.php @@ -63,6 +63,8 @@ public function __construct(Cache $config) $this->mode = $config->file['mode'] ?? 0640; $this->prefix = $config->prefix; + + helper('filesystem'); } /** @@ -96,7 +98,7 @@ public function save(string $key, $value, int $ttl = 60) 'data' => $value, ]; - if ($this->writeFile($this->path . $key, serialize($contents))) { + if (write_file($this->path . $key, serialize($contents))) { try { chmod($this->path . $key, $this->mode); @@ -176,7 +178,7 @@ public function decrement(string $key, int $offset = 1) */ public function clean() { - return $this->deleteFiles($this->path, false, true); + return delete_files($this->path, false, true); } /** @@ -184,7 +186,7 @@ public function clean() */ public function getCacheInfo() { - return $this->getDirFileInfo($this->path); + return get_dir_file_info($this->path); } /** @@ -251,6 +253,8 @@ protected function getItem(string $filename) /** * Writes a file to disk, or returns false if not successful. * + * @deprecated 4.6.1 Use `write_file()` instead. + * * @param string $path * @param string $data * @param string $mode @@ -283,6 +287,8 @@ protected function writeFile($path, $data, $mode = 'wb') * If the second parameter is set to TRUE, any directories contained * within the supplied base directory will be nuked as well. * + * @deprecated 4.6.1 Use `delete_files()` instead. + * * @param string $path File path * @param bool $delDir Whether to delete any directories found in the path * @param bool $htdocs Whether to skip deleting .htaccess and index page files @@ -318,6 +324,8 @@ protected function deleteFiles(string $path, bool $delDir = false, bool $htdocs * * Any sub-folders contained within the specified path are read as well. * + * @deprecated 4.6.1 Use `get_dir_file_info()` instead. + * * @param string $sourceDir Path to source * @param bool $topLevelOnly Look only at the top level directory specified? * @param bool $_recursion Internal variable to determine recursion status - do not use in calls @@ -360,6 +368,8 @@ protected function getDirFileInfo(string $sourceDir, bool $topLevelOnly = true, * Options are: name, server_path, size, date, readable, writable, executable, fileperms * Returns FALSE if the file cannot be found. * + * @deprecated 4.6.1 Use `get_file_info()` instead. + * * @param string $file Path to file * @param array|string $returnedValues Array or comma separated string of information returned * diff --git a/user_guide_src/source/changelogs/v4.6.1.rst b/user_guide_src/source/changelogs/v4.6.1.rst index 495fcd1b3af5..2eb8db9600f3 100644 --- a/user_guide_src/source/changelogs/v4.6.1.rst +++ b/user_guide_src/source/changelogs/v4.6.1.rst @@ -26,6 +26,11 @@ Changes Deprecations ************ +- **Cache:** The ``FileHandler::writeFile()`` method is deprecated. Use ``write_file()`` instead. +- **Cache:** The ``FileHandler::deleteFiles()`` method is deprecated. Use ``delete_files()`` instead. +- **Cache:** The ``FileHandler::getDirFileInfo()`` method is deprecated. Use ``get_dir_file_info()`` instead. +- **Cache:** The ``FileHandler::getFileInfo()`` method is deprecated. Use ``get_file_info()`` instead. + ********** Bugs Fixed **********