From e78a69f8cd556864da49919f97647aed372f00e0 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 28 Aug 2023 09:21:08 +0300 Subject: fix flagfile not created before invoking GD --- init.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/init.php b/init.php index 70f43f5..fbba819 100755 --- a/init.php +++ b/init.php @@ -297,10 +297,12 @@ class Af_Img_Phash extends Plugin { if ($this->cache->is_writable()) { - // check for .flag & create it + // check for .flag to prevent repeated failures or create it if ($this->cache->exists($cached_file_flag)) { Debug::log("phash: $cached_file_flag exists, looks like we failed on this URL before; skipping.", Debug::LOG_VERBOSE); continue; + } else { + $this->cache->put($cached_file_flag, ""); } // check for local cache @@ -325,9 +327,7 @@ class Af_Img_Phash extends Plugin { Debug::log("phash: calculated perceptual hash: $hash", Debug::LOG_VERBOSE); // we managed to process this image, it should be safe to remove the flag now - // @phpstan-ignore-next-line - if ($this->cache->is_writable() && $this->cache->exists($cached_file_flag)) - unlink($this->cache->get_full_path($cached_file_flag)); + $this->cache->remove($cached_file_flag); if ($hash) { $hash = base_convert($hash, 16, 10); -- cgit v1.2.3