From b2b17eb0416d77f978297bc21f4f2928981aaec8 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Thu, 25 Apr 2013 09:03:32 +0200 Subject: [PATCH] // Removed deprecated block for new installs --- .../template/controllers/images/content.tpl | 2 +- controllers/admin/AdminImagesController.php | 28 +++++++++++-------- 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/admin-dev/themes/default/template/controllers/images/content.tpl b/admin-dev/themes/default/template/controllers/images/content.tpl index fbe4ac3cb..2e8e0ea65 100644 --- a/admin-dev/themes/default/template/controllers/images/content.tpl +++ b/admin-dev/themes/default/template/controllers/images/content.tpl @@ -76,7 +76,7 @@ {/if} -{if isset($display_move)} +{if isset($display_move) && $display_move}

{l s='Move images'}

{l s='PrestaShop now uses a new storage system for product images. It offers better performance if your shop has a large number of products.'}

diff --git a/controllers/admin/AdminImagesController.php b/controllers/admin/AdminImagesController.php index 0438b68ab..38ecea2e4 100644 --- a/controllers/admin/AdminImagesController.php +++ b/controllers/admin/AdminImagesController.php @@ -28,6 +28,7 @@ class AdminImagesControllerCore extends AdminController { protected $start_time = 0; protected $max_execution_time = 7200; + protected $display_move; public function __construct() { @@ -50,6 +51,9 @@ class AdminImagesControllerCore extends AdminController 'scenes' => array('title' => $this->l('Scenes'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false), 'stores' => array('title' => $this->l('Stores'), 'width' => 50, 'align' => 'center', 'type' => 'bool', 'callback' => 'printEntityActiveIcon', 'orderby' => false) ); + + // No need to display the old image system if the install has been made later than 2013-03-26 + $this->display_move = (defined('_PS_CREATION_DATE_') && strtotime(_PS_CREATION_DATE_) > strtotime('2013-03-26')) ? false : true; $this->fields_options = array( 'images' => array( @@ -141,20 +145,22 @@ class AdminImagesControllerCore extends AdminController 'type' => 'text', 'height' => 'px', 'visibility' => Shop::CONTEXT_ALL - ), - 'PS_LEGACY_IMAGES' => array( - 'title' => $this->l('Use the legacy image filesystem'), - 'desc' => $this->l('This should be set to yes unless you successfully moved images in "Images" page under the "Preferences" menu.'), - 'validation' => 'isBool', - 'cast' => 'intval', - 'required' => false, - 'type' => 'bool', - 'visibility' => Shop::CONTEXT_ALL - ), + ) ), 'submit' => array('title' => $this->l('Save '), 'class' => 'button'), ), ); + + if ($this->display_move) + $this->fields_options['product_images']['fields']['PS_LEGACY_IMAGES'] = array( + 'title' => $this->l('Use the legacy image filesystem'), + 'desc' => $this->l('This should be set to yes unless you successfully moved images in "Images" page under the "Preferences" menu.'), + 'validation' => 'isBool', + 'cast' => 'intval', + 'required' => false, + 'type' => 'bool', + 'visibility' => Shop::CONTEXT_ALL + ); $this->fields_form = array( 'legend' => array( @@ -670,7 +676,7 @@ class AdminImagesControllerCore extends AdminController $this->context->smarty->assign(array( 'display_regenerate' => true, - 'display_move' => true + 'display_move' => $this->display_move )); }