1
0
Fork 0
mirror of https://github.com/DanielnetoDotCom/YouPHPTube synced 2025-10-03 09:49:28 +02:00

Fix cache

This commit is contained in:
DanielnetoDotCom 2021-03-12 19:13:21 -03:00
parent b798b8a024
commit 1d7821e224

View file

@ -463,7 +463,7 @@ abstract class ObjectYPT implements ObjectInterface
public static function getCacheFileName($name) public static function getCacheFileName($name)
{ {
$name = self::cleanCacheName($name); $name = self::cleanCacheName($name);
$ignoreLocationDirectoryName = strpos($name, DIRECTORY_SEPARATOR); $ignoreLocationDirectoryName = (strpos($name, DIRECTORY_SEPARATOR)!==false);
$tmpDir = self::getCacheDir($ignoreLocationDirectoryName); $tmpDir = self::getCacheDir($ignoreLocationDirectoryName);
$uniqueHash = md5(__FILE__); $uniqueHash = md5(__FILE__);
return $tmpDir . DIRECTORY_SEPARATOR . $name . $uniqueHash; return $tmpDir . DIRECTORY_SEPARATOR . $name . $uniqueHash;
@ -472,7 +472,7 @@ abstract class ObjectYPT implements ObjectInterface
public static function deleteCacheFromPattern($name) public static function deleteCacheFromPattern($name)
{ {
$name = self::cleanCacheName($name); $name = self::cleanCacheName($name);
$ignoreLocationDirectoryName = strpos($name, DIRECTORY_SEPARATOR); $ignoreLocationDirectoryName = (strpos($name, DIRECTORY_SEPARATOR)!==false);
$tmpDir = self::getCacheDir($ignoreLocationDirectoryName); $tmpDir = self::getCacheDir($ignoreLocationDirectoryName);
$filePattern = $tmpDir . DIRECTORY_SEPARATOR . $name; $filePattern = $tmpDir . DIRECTORY_SEPARATOR . $name;
foreach (glob("{$filePattern}*") as $filename) { foreach (glob("{$filePattern}*") as $filename) {