From c34726b2b2182ed38b86d33978c4e996893124d8 Mon Sep 17 00:00:00 2001
From: Andrew Dolgov <noreply@fakecake.org>
Date: Wed, 14 Aug 2019 12:52:41 +0300
Subject: [PATCH] consistency: use DiskCache->exists() to check for present
 files

---
 classes/diskcache.php                 | 2 +-
 plugins/cache_starred_images/init.php | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/classes/diskcache.php b/classes/diskcache.php
index 92fd23ad4..2d46ced4c 100644
--- a/classes/diskcache.php
+++ b/classes/diskcache.php
@@ -101,7 +101,7 @@ class DiskCache {
 					$src = $entry->hasAttribute('poster') ? $entry->getAttribute('poster') : $entry->getAttribute('src');
 					$cached_filename = sha1($src);
 
-					if ($cache->getSize($cached_filename) > 0) {
+					if ($cache->exists($cached_filename)) {
 
 						$src = $cache->getUrl(sha1($src));
 
diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php
index d13b0a443..ae369f56e 100755
--- a/plugins/cache_starred_images/init.php
+++ b/plugins/cache_starred_images/init.php
@@ -136,7 +136,7 @@ class Cache_Starred_Images extends Plugin {
 	private function cache_url($article_id, $url) {
 		$local_filename = $article_id . "-" . sha1($url);
 
-		if (!$this->cache->getSize($local_filename) >= 0) {
+		if (!$this->cache->exists($local_filename)) {
 			Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE);
 
 			$data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]);
-- 
GitLab