diff options
author | Andrew Dolgov <[email protected]> | 2022-11-24 08:46:31 +0300 |
---|---|---|
committer | Andrew Dolgov <[email protected]> | 2022-11-24 08:46:31 +0300 |
commit | a40cb9881e649556aba5a196456f00663a8b0ee5 (patch) | |
tree | b89b9a5e66e2709794a5505803496fbfb4c19902 | |
parent | 5965900c7638d9c2dfcd384be5fa01f935523494 (diff) |
stop using DiskCache->touch()
-rw-r--r-- | init.php | 10 |
1 files changed, 8 insertions, 2 deletions
@@ -137,7 +137,8 @@ class Api_Resize_Media extends Plugin { return; } - $this->cache->touch($local_filename_flag); + if (!$this->cache->exists($local_filename_flag)) + $this->cache->put($local_filename_flag, ""); if (!$this->cache->exists($local_filename)) { $data = UrlHelper::fetch(["url" => $url, "max_size" => Config::get(Config::MAX_CACHE_FILE_SIZE)]); @@ -293,7 +294,12 @@ class Api_Resize_Media extends Plugin { if ($this->cache->exists($local_filename)) { return $this->cache->get_url($local_filename); } else { - if ($this->cache->touch(sha1($url) . ".flag")) { + $flag = sha1($url) . ".flag"; + + if (!$this->cache->exists($flag)) + $this->cache->put($flag, ""); + + if ($this->cache->exists($flag)) { return $this->host->get_public_method_url($this, "api_resize", ["url" => $url, "width" => $width, "force_stamp" => $force_stamp]); } |