+ $status_filename = $this->cache_dir . $article_id . "-" . sha1($site_url) . ".status";
+
+ //_debug("status: $status_filename"); return;
+
+ if (file_exists($status_filename))
+ $status = json_decode(file_get_contents($status_filename), true);
+ else
+ $status = [];
+
+ $status["attempt"] += 1;
+
+ // only allow several download attempts for article
+ if ($status["attempt"] > $this->max_cache_attempts) {
+ _debug("too many attempts for $site_url");
+ return;
+ }
+
+ if (!file_put_contents($status_filename, json_encode($status))) {
+ user_error("unable to write status file: $status_filename", E_USER_WARNING);
+ return;
+ }
+