diff --git a/scripts/common.php b/scripts/common.php index 784da53..103d658 100644 --- a/scripts/common.php +++ b/scripts/common.php @@ -175,6 +175,7 @@ class Flickr { $image = $this->get_image_from_db($sci_name); if ($image !== false && in_array($image['id'], $this->blacklisted_ids)) { $image = false; + $this->delete_image_from_db($sci_name); } if ($image !== false) { $now = new DateTime(); @@ -195,6 +196,12 @@ class Flickr { return $image; } + private function delete_image_from_db($sci_name) { + $statement0 = $this->db->prepare('DELETE FROM images WHERE sci_name == :sci_name'); + $statement0->bindValue(':sci_name', $sci_name); + $statement0->execute(); + } + private function get_image_from_db($sci_name) { $statement0 = $this->db->prepare('SELECT sci_name, com_en_name, image_url, title, id, author_url, license_url, date_created FROM images WHERE sci_name == :sci_name'); $statement0->bindValue(':sci_name', $sci_name);