diff --git a/classes/cache/adapter.php b/classes/cache/adapter.php index 88dca21b9..a61e5cb83 100644 --- a/classes/cache/adapter.php +++ b/classes/cache/adapter.php @@ -20,7 +20,6 @@ interface Cache_Adapter { * @return int|false Bytes written or false if an error occurred. */ public function put(string $filename, $data); - public function touch(string $filename): bool; public function get(string $filename): ?string; public function get_full_path(string $filename): string; /** diff --git a/classes/cache/local.php b/classes/cache/local.php index 4461ef4ca..62f33662a 100644 --- a/classes/cache/local.php +++ b/classes/cache/local.php @@ -66,10 +66,6 @@ class Cache_Local implements Cache_Adapter { return file_put_contents($this->get_full_path($filename), $data); } - public function touch(string $filename): bool { - return touch($this->get_full_path($filename)); - } - /** * @return false|null|string false if detection failed, null if the file doesn't exist, string mime content type otherwise */ diff --git a/classes/diskcache.php b/classes/diskcache.php index 69b48688c..80c73682f 100644 --- a/classes/diskcache.php +++ b/classes/diskcache.php @@ -238,8 +238,12 @@ class DiskCache implements Cache_Adapter { return $this->adapter->put($filename, $data); } + /** @deprecated we can't assume cached files are local, and other storages + * might not support this operation (object metadata may be immutable) */ public function touch(string $filename): bool { - return $this->adapter->touch($filename); + user_error("DiskCache: called unsupported method touch() for $filename", E_USER_DEPRECATED); + + return false; } public function get(string $filename): ?string { diff --git a/classes/rssutils.php b/classes/rssutils.php index 2a82a35b0..15efa77bd 100755 --- a/classes/rssutils.php +++ b/classes/rssutils.php @@ -1326,8 +1326,6 @@ class RSSUtils { } else { Debug::log("cache_enclosures: failed with ".UrlHelper::$fetch_last_error_code.": ".UrlHelper::$fetch_last_error); } - } else if (is_writable($local_filename)) { - $cache->touch($local_filename); } } } @@ -1353,8 +1351,6 @@ class RSSUtils { } else { Debug::log("cache_media: failed with ".UrlHelper::$fetch_last_error_code.": ".UrlHelper::$fetch_last_error); } - } else if ($cache->is_writable($local_filename)) { - $cache->touch($local_filename); } } diff --git a/plugins/cache_starred_images/init.php b/plugins/cache_starred_images/init.php index eed5264c6..daaab2dca 100755 --- a/plugins/cache_starred_images/init.php +++ b/plugins/cache_starred_images/init.php @@ -31,10 +31,10 @@ class Cache_Starred_Images extends Plugin { chmod($this->cache_status->get_dir(), 0777); if (!$this->cache->exists(".no-auto-expiry")) - $this->cache->touch(".no-auto-expiry"); + $this->cache->put(".no-auto-expiry", ""); if (!$this->cache_status->exists(".no-auto-expiry")) - $this->cache_status->touch(".no-auto-expiry"); + $this->cache_status->put(".no-auto-expiry", ""); if ($this->cache->is_writable() && $this->cache_status->is_writable()) { $host->add_hook($host::HOOK_HOUSE_KEEPING, $this);