|
|
|
@ -13,15 +13,17 @@ use function file_get_contents;
|
|
|
|
|
use function file_put_contents;
|
|
|
|
|
use function filemtime;
|
|
|
|
|
use function get_class;
|
|
|
|
|
use function hash;
|
|
|
|
|
use function igbinary_serialize;
|
|
|
|
|
use function igbinary_unserialize;
|
|
|
|
|
use function is_dir;
|
|
|
|
|
use function mkdir;
|
|
|
|
|
use function phpversion;
|
|
|
|
|
use function serialize;
|
|
|
|
|
use function sha1;
|
|
|
|
|
use function strtolower;
|
|
|
|
|
use function unlink;
|
|
|
|
|
use function unserialize;
|
|
|
|
|
use function version_compare;
|
|
|
|
|
|
|
|
|
|
use const DIRECTORY_SEPARATOR;
|
|
|
|
|
|
|
|
|
@ -111,7 +113,8 @@ class ClassLikeStorageCacheProvider
|
|
|
|
|
|
|
|
|
|
private function getCacheHash(?string $file_path, ?string $file_contents): string
|
|
|
|
|
{
|
|
|
|
|
return sha1(($file_path ? $file_contents : '') . $this->modified_timestamps);
|
|
|
|
|
$data = ($file_path ? $file_contents : '') . $this->modified_timestamps;
|
|
|
|
|
return version_compare(phpversion(), '8.1', '>=') ? hash('xxh128', $data) : hash('md4', $data);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
@ -161,9 +164,13 @@ class ClassLikeStorageCacheProvider
|
|
|
|
|
mkdir($parser_cache_directory, 0777, true);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$data = $file_path ? strtolower($file_path) . ' ' : '';
|
|
|
|
|
$data .= $fq_classlike_name_lc;
|
|
|
|
|
$file_path_sha = version_compare(phpversion(), '8.1', '>=') ? hash('xxh128', $data) : hash('md4', $data);
|
|
|
|
|
|
|
|
|
|
return $parser_cache_directory
|
|
|
|
|
. DIRECTORY_SEPARATOR
|
|
|
|
|
. sha1(($file_path ? strtolower($file_path) . ' ' : '') . $fq_classlike_name_lc)
|
|
|
|
|
. $file_path_sha
|
|
|
|
|
. ($this->config->use_igbinary ? '-igbinary' : '');
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|