From 428c1fa99b3b38133acaa290a1d45f31b39f5800 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9mi=20Gaillard?= Date: Mon, 3 Dec 2012 12:26:27 +0100 Subject: [PATCH] [-] BO: Fix #PSCFV-5332 wrong rights on folder after uploading image --- classes/Image.php | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/classes/Image.php b/classes/Image.php index 0f56d1295..75c0a7f52 100644 --- a/classes/Image.php +++ b/classes/Image.php @@ -409,9 +409,8 @@ class ImageCore extends ObjectModel // Delete auto-generated images $image_types = ImageType::getImagesTypes(); foreach ($image_types as $image_type) - { $files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-'.$image_type['name'].'.'.$this->image_format; - } + // Delete watermark image $files_to_delete[] = $this->image_dir.$this->getExistingImgPath().'-watermark.'.$this->image_format; // delete index.php @@ -533,11 +532,11 @@ class ImageCore extends ObjectModel if (!file_exists(_PS_PROD_IMG_DIR_.$this->getImgFolder())) { // Apparently sometimes mkdir cannot set the rights, and sometimes chmod can't. Trying both. - $success = @mkdir(_PS_PROD_IMG_DIR_.$this->getImgFolder(), self::$access_rights, true) - || @chmod(_PS_PROD_IMG_DIR_.$this->getImgFolder(), self::$access_rights); + $success = @mkdir(_PS_PROD_IMG_DIR_.$this->getImgFolder(), self::$access_rights, true); + $chmod = @chmod(_PS_PROD_IMG_DIR_.$this->getImgFolder(), self::$access_rights); // Create an index.php file in the new folder - if ($success + if (($success || $chmod) && !file_exists(_PS_PROD_IMG_DIR_.$this->getImgFolder().'index.php') && file_exists($this->source_index)) return @copy($this->source_index, _PS_PROD_IMG_DIR_.$this->getImgFolder().'index.php');