From c9e7954446c75e1b8354b2cfcb0786ea0e61792d Mon Sep 17 00:00:00 2001 From: Tobias Reich Date: Sat, 12 Apr 2014 14:19:52 +0200 Subject: [PATCH] Improved deleting of photos --- php/modules/Photo.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/php/modules/Photo.php b/php/modules/Photo.php index 78ca2ed..76837bb 100755 --- a/php/modules/Photo.php +++ b/php/modules/Photo.php @@ -674,9 +674,9 @@ class Photo extends Module { $thumbUrl2x = $thumbUrl2x[0] . '@2x.' . $thumbUrl2x[1]; # Delete files - if (!unlink($this->uploadsBig . $photo->url)) return false; - if (!unlink($this->uploadsThumb . $photo->thumbUrl)) return false; - if (!unlink($this->uploadsThumb . $thumbUrl2x)) return false; + if (file_exists($this->uploadsBig . $photo->url)&&!unlink($this->uploadsBig . $photo->url)) return false; + if (file_exists($this->uploadsThumb . $photo->thumbUrl)&&!unlink($this->uploadsThumb . $photo->thumbUrl)) return false; + if (file_exists($this->uploadsThumb . $thumbUrl2x)&&!unlink($this->uploadsThumb . $thumbUrl2x)) return false; # Delete db entry $delete = $this->database->query("DELETE FROM lychee_photos WHERE id = '$photo->id';");