Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions system/Cache/Handlers/FileHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ public function __construct(Cache $config)

$this->mode = $config->file['mode'] ?? 0640;
$this->prefix = $config->prefix;

helper('filesystem');
}

/**
Expand Down Expand Up @@ -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);

Expand Down Expand Up @@ -176,15 +178,15 @@ 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);
}

/**
* {@inheritDoc}
*/
public function getCacheInfo()
{
return $this->getDirFileInfo($this->path);
return get_dir_file_info($this->path);
}

/**
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
*
Expand Down
5 changes: 5 additions & 0 deletions user_guide_src/source/changelogs/v4.6.1.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
**********
Expand Down
Loading