From 6914ad1f741570b66580d2933e8e2118adb177b5 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 14 Aug 2019 12:44:50 +0300 Subject: [PATCH] retire MIN_CACHE_FILE_SIZE --- classes/rssutils.php | 4 ++-- include/functions.php | 2 -- plugins/af_zz_imgproxy/init.php | 2 +- plugins/cache_starred_images/init.php | 8 ++------ 4 files changed, 5 insertions(+), 11 deletions(-) diff --git a/classes/rssutils.php b/classes/rssutils.php index f942fad31..fe4c0a8a3 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -1196,7 +1196,7 @@ class RSSUtils { if (!$cache->exists($local_filename)) { $file_content = fetch_file_contents(array("url" => $src, "max_size" => MAX_CACHE_FILE_SIZE)); - if ($file_content && strlen($file_content) > MIN_CACHE_FILE_SIZE) { + if ($file_content) { $cache->put($local_filename, $file_content); } } else if (is_writable($local_filename)) { @@ -1230,7 +1230,7 @@ class RSSUtils { $file_content = fetch_file_contents(array("url" => $src, "max_size" => MAX_CACHE_FILE_SIZE)); - if ($file_content && strlen($file_content) > MIN_CACHE_FILE_SIZE) { + if ($file_content) { $cache->put($local_filename, $file_content); } } else if ($cache->isWritable($local_filename)) { diff --git a/include/functions.php b/include/functions.php index 3f80ba5ba..c326ac468 100644 --- a/include/functions.php +++ b/include/functions.php @@ -54,8 +54,6 @@ // feed limit for one update batch define_default('DAEMON_SLEEP_INTERVAL', 120); // default sleep interval between feed updates (sec) - define_default('MIN_CACHE_FILE_SIZE', 1024); - // do not cache files smaller than that (bytes) define_default('MAX_CACHE_FILE_SIZE', 64*1024*1024); // do not cache files larger than that (bytes) define_default('MAX_DOWNLOAD_FILE_SIZE', 16*1024*1024); diff --git a/plugins/af_zz_imgproxy/init.php b/plugins/af_zz_imgproxy/init.php index 3c9744666..ddc30936f 100755 --- a/plugins/af_zz_imgproxy/init.php +++ b/plugins/af_zz_imgproxy/init.php @@ -67,7 +67,7 @@ class Af_Zz_ImgProxy extends Plugin { $disable_cache = $this->host->get($this, "disable_cache"); - if (!$disable_cache && strlen($data) > MIN_CACHE_FILE_SIZE) { + if (!$disable_cache) { if ($this->cache->put($local_filename, $data)) { header("Location: " . $this->cache->getUrl($local_filename)); return; diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php index 967569543..d13b0a443 100755 --- a/plugins/cache_starred_images/init.php +++ b/plugins/cache_starred_images/init.php @@ -141,13 +141,9 @@ class Cache_Starred_Images extends Plugin { $data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]); - if ($data) { - if (strlen($data) > MIN_CACHE_FILE_SIZE) { - $this->cache->put($local_filename, $data); - } + if ($data) + return $this->cache->put($local_filename, $data);; - return true; - } } else { //Debug::log("cache_images: local file exists for $url", Debug::$LOG_VERBOSE);