@@ -162,31 +162,31 @@ |
||
| 162 | 162 | |
| 163 | 163 | Debug::log("status: $status_filename", Debug::$LOG_VERBOSE); |
| 164 | 164 | |
| 165 | - if ($this->cache->exists($status_filename)) { |
|
| 166 | - $status = json_decode($this->cache->get($status_filename), true); |
|
| 167 | - } else { |
|
| 168 | - $status = []; |
|
| 169 | - } |
|
| 165 | + if ($this->cache->exists($status_filename)) { |
|
| 166 | + $status = json_decode($this->cache->get($status_filename), true); |
|
| 167 | + } else { |
|
| 168 | + $status = []; |
|
| 169 | + } |
|
| 170 | 170 | |
| 171 | - $status["attempt"] += 1; |
|
| 171 | + $status["attempt"] += 1; |
|
| 172 | 172 | |
| 173 | - // only allow several download attempts for article |
|
| 174 | - if ($status["attempt"] > $this->max_cache_attempts) { |
|
| 175 | - Debug::log("too many attempts for $site_url", Debug::$LOG_VERBOSE); |
|
| 176 | - return false; |
|
| 177 | - } |
|
| 173 | + // only allow several download attempts for article |
|
| 174 | + if ($status["attempt"] > $this->max_cache_attempts) { |
|
| 175 | + Debug::log("too many attempts for $site_url", Debug::$LOG_VERBOSE); |
|
| 176 | + return false; |
|
| 177 | + } |
|
| 178 | 178 | |
| 179 | - if (!$this->cache->put($status_filename, json_encode($status))) { |
|
| 180 | - user_error("unable to write status file: $status_filename", E_USER_WARNING); |
|
| 181 | - return false; |
|
| 182 | - } |
|
| 179 | + if (!$this->cache->put($status_filename, json_encode($status))) { |
|
| 180 | + user_error("unable to write status file: $status_filename", E_USER_WARNING); |
|
| 181 | + return false; |
|
| 182 | + } |
|
| 183 | 183 | |
| 184 | 184 | $doc = new DOMDocument(); |
| 185 | 185 | |
| 186 | 186 | $has_images = false; |
| 187 | 187 | $success = false; |
| 188 | 188 | |
| 189 | - if ($doc->loadHTML('<?xml encoding="UTF-8">'.$content)) { |
|
| 189 | + if ($doc->loadHTML('<?xml encoding="UTF-8">'.$content)) { |
|
| 190 | 190 | $xpath = new DOMXPath($doc); |
| 191 | 191 | $entries = $xpath->query('(//img[@src])|(//video/source[@src])'); |
| 192 | 192 | |