diff options
-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]); } |