From b701acc8cf99d28782bcc4c9b58a6756f6b84cec Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 6 Aug 2013 16:15:08 +0200 Subject: [PATCH 1/3] // Clean language pack retrieval --- controllers/admin/AdminTranslationsController.php | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/controllers/admin/AdminTranslationsController.php b/controllers/admin/AdminTranslationsController.php index c58031995..524a30200 100644 --- a/controllers/admin/AdminTranslationsController.php +++ b/controllers/admin/AdminTranslationsController.php @@ -722,9 +722,8 @@ class AdminTranslationsControllerCore extends AdminController $arr_import_lang = explode('|', Tools::getValue('params_import_language')); /* 0 = Language ISO code, 1 = PS version */ if (Validate::isLangIsoCode($arr_import_lang[0])) { - if ($content = Tools::file_get_contents( - 'http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.Tools::strtolower($arr_import_lang[0]).'.gzip', false, - @stream_context_create(array('http' => array('method' => 'GET', 'timeout' => 5))))) + $content = Tools::file_get_contents('http://www.prestashop.com/download/lang_packs/gzip/'.$arr_import_lang[1].'/'.Tools::strtolower($arr_import_lang[0]).'.gzip'); + if ($content) { $file = _PS_TRANSLATIONS_DIR_.$arr_import_lang[0].'.gzip'; if ((bool)@file_put_contents($file, $content)) From a1cf8d462f1c0e599d1d0bc3478b9f4d5c384331 Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 6 Aug 2013 16:42:10 +0200 Subject: [PATCH 2/3] // Keep remote file retrieval in the right order --- classes/controller/AdminController.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/classes/controller/AdminController.php b/classes/controller/AdminController.php index cf12984dd..e36804246 100644 --- a/classes/controller/AdminController.php +++ b/classes/controller/AdminController.php @@ -1509,6 +1509,8 @@ class AdminControllerCore extends Controller */ protected function initTabModuleList() { + if (!$this->isFresh(Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, 86400)) + @file_put_contents(_PS_ROOT_DIR_.Module::CACHE_FILE_MUST_HAVE_MODULES_LIST, Tools::addonsRequest('must-have')); if (!$this->isFresh(Module::CACHE_FILE_TAB_MODULES_LIST, 604800)) $this->refresh(Module::CACHE_FILE_TAB_MODULES_LIST, 'http://'.Tab::TAB_MODULE_LIST_URL); From 2303677ebf610e0bd274fde967807a5a960ac58f Mon Sep 17 00:00:00 2001 From: Damien Metzger Date: Tue, 6 Aug 2013 16:52:13 +0200 Subject: [PATCH 3/3] // Rollback a modification in object model --- classes/ObjectModel.php | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/classes/ObjectModel.php b/classes/ObjectModel.php index 3207009e2..812c9010a 100644 --- a/classes/ObjectModel.php +++ b/classes/ObjectModel.php @@ -858,15 +858,13 @@ abstract class ObjectModelCore continue; $values = $this->$field; + + // If the object has not been loaded in multilanguage, then the value is the one for the current language of the object if (!is_array($values)) - { - $value = $values; - $values = array(); - $values[$this->id_lang] = $value; - $values[Configuration::get('PS_LANG_DEFAULT')] = $value; - } + $values = array($this->id_lang => $values); - if (!isset($values[Configuration::get('PS_LANG_DEFAULT')])) + // The value for the default must always be set, so we put an empty string if it does not exists + if (!isset($values[Configuration::get('PS_LANG_DEFAULT')])) $values[Configuration::get('PS_LANG_DEFAULT')] = ''; foreach ($values as $id_lang => $value)