From 6fec49a659011b11b24d0610bf3d779d4b24b9e9 Mon Sep 17 00:00:00 2001 From: Oleg Andreyev Date: Sun, 28 Jul 2019 15:18:31 +0300 Subject: [PATCH] Updated logic in useLocalCache to reuse getCacheId --- PEAR/REST.php | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/PEAR/REST.php b/PEAR/REST.php index f9471a473..fe1391eba 100644 --- a/PEAR/REST.php +++ b/PEAR/REST.php @@ -173,13 +173,7 @@ function retrieveData($url, $accept = false, $forcestring = false, $channel = fa function useLocalCache($url, $cacheid = null) { if (!is_array($cacheid)) { - $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR . - md5($url) . 'rest.cacheid'; - if (!file_exists($cacheidfile)) { - return false; - } - - $cacheid = unserialize(implode('', file($cacheidfile))); + $cacheid = $this->getCacheId($url); } $cachettl = $this->config->get('cache_ttl'); @@ -191,6 +185,11 @@ function useLocalCache($url, $cacheid = null) return false; } + /** + * @param string $url + * + * @return bool|mixed + */ function getCacheId($url) { $cacheidfile = $this->config->get('cache_dir') . DIRECTORY_SEPARATOR .