Commit 3c5be7fa authored by Rolf Forst's avatar Rolf Forst
Browse files

Update File.php

parent 2feae9d4
...@@ -22,7 +22,7 @@ final class File ...@@ -22,7 +22,7 @@ final class File
* [protected description] * [protected description]
* @var string * @var string
*/ */
protected static $cacheOldDir = WP_CONTENT_DIR . '/advanced-cache-old'; protected static $cacheOldDir = WP_CONTENT_DIR . '/advanced-cache-old';
/** /**
* [protected description] * [protected description]
...@@ -63,7 +63,7 @@ final class File ...@@ -63,7 +63,7 @@ final class File
{ {
if (file_exists(self::$cacheDir)) { if (file_exists(self::$cacheDir)) {
return true; return true;
} }
if (!wp_mkdir_p(self::$cacheDir)) { if (!wp_mkdir_p(self::$cacheDir)) {
do_action('rrze.log.error', __('{plugin}: The directory could not be created.', 'rrze-cache'), ['plugin' => 'rrze-cache', 'method' => __METHOD__, 'File::$cacheDir' => self::$cacheDir]); do_action('rrze.log.error', __('{plugin}: The directory could not be created.', 'rrze-cache'), ['plugin' => 'rrze-cache', 'method' => __METHOD__, 'File::$cacheDir' => self::$cacheDir]);
return false; return false;
...@@ -79,13 +79,13 @@ final class File ...@@ -79,13 +79,13 @@ final class File
{ {
if (file_exists(self::$cacheOldDir)) { if (file_exists(self::$cacheOldDir)) {
return true; return true;
} }
if (!wp_mkdir_p(self::$cacheOldDir)) { if (!wp_mkdir_p(self::$cacheOldDir)) {
do_action('rrze.log.error', __('{plugin}: The directory could not be created.', 'rrze-cache'), ['plugin' => 'rrze-cache', 'method' => __METHOD__, 'File::$cacheOldDir' => self::$cacheOldDir]); do_action('rrze.log.error', __('{plugin}: The directory could not be created.', 'rrze-cache'), ['plugin' => 'rrze-cache', 'method' => __METHOD__, 'File::$cacheOldDir' => self::$cacheOldDir]);
return false; return false;
} }
return true; return true;
} }
/** /**
* [storeTimeout description] * [storeTimeout description]
...@@ -178,7 +178,7 @@ final class File ...@@ -178,7 +178,7 @@ final class File
bin2hex(random_bytes(8)); bin2hex(random_bytes(8));
return self::renameDir($sourceDir, $targetDir); return self::renameDir($sourceDir, $targetDir);
} }
/** /**
* [cacheSignatur description] * [cacheSignatur description]
...@@ -322,8 +322,6 @@ final class File ...@@ -322,8 +322,6 @@ final class File
// Handle arguments. // Handle arguments.
if (empty($folder) || !file_exists($folder)) { if (empty($folder) || !file_exists($folder)) {
return true; // No such file/folder exists. return true; // No such file/folder exists.
} elseif (is_file($folder) || is_link($folder)) {
return @unlink($folder); // Delete file/link.
} }
// Get all children. // Get all children.
...@@ -341,7 +339,7 @@ final class File ...@@ -341,7 +339,7 @@ final class File
return false; // Abort due to the failure. return false; // Abort due to the failure.
} }
$i++; $i++;
if($maxFiles && $i > $maxFiles) { if ($maxFiles && $i > $maxFiles) {
return false; return false;
} }
} }
...@@ -374,7 +372,7 @@ final class File ...@@ -374,7 +372,7 @@ final class File
public static function getCacheOldDir(): string public static function getCacheOldDir(): string
{ {
return self::$cacheOldDir; return self::$cacheOldDir;
} }
/** /**
* [getTimeoutFile description] * [getTimeoutFile description]
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment