consistency: use DiskCache->exists() to check for present files
This commit is contained in:
parent
6914ad1f74
commit
c34726b2b2
|
@ -101,7 +101,7 @@ class DiskCache {
|
||||||
$src = $entry->hasAttribute('poster') ? $entry->getAttribute('poster') : $entry->getAttribute('src');
|
$src = $entry->hasAttribute('poster') ? $entry->getAttribute('poster') : $entry->getAttribute('src');
|
||||||
$cached_filename = sha1($src);
|
$cached_filename = sha1($src);
|
||||||
|
|
||||||
if ($cache->getSize($cached_filename) > 0) {
|
if ($cache->exists($cached_filename)) {
|
||||||
|
|
||||||
$src = $cache->getUrl(sha1($src));
|
$src = $cache->getUrl(sha1($src));
|
||||||
|
|
||||||
|
|
|
@ -136,7 +136,7 @@ class Cache_Starred_Images extends Plugin {
|
||||||
private function cache_url($article_id, $url) {
|
private function cache_url($article_id, $url) {
|
||||||
$local_filename = $article_id . "-" . sha1($url);
|
$local_filename = $article_id . "-" . sha1($url);
|
||||||
|
|
||||||
if (!$this->cache->getSize($local_filename) >= 0) {
|
if (!$this->cache->exists($local_filename)) {
|
||||||
Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE);
|
Debug::log("cache_images: downloading: $url to $local_filename", Debug::$LOG_VERBOSE);
|
||||||
|
|
||||||
$data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]);
|
$data = fetch_file_contents(["url" => $url, "max_size" => MAX_CACHE_FILE_SIZE]);
|
||||||
|
|
Loading…
Reference in New Issue