diff --git a/install-dev/controllers/console/process.php b/install-dev/controllers/console/process.php index 6a8e1e1cd..346114ece 100644 --- a/install-dev/controllers/console/process.php +++ b/install-dev/controllers/console/process.php @@ -63,12 +63,19 @@ class InstallControllerConsoleProcess extends InstallControllerConsole public function initializeContext() { global $smarty; + // Clean all cache values + Cache::clean('*'); Context::getContext()->shop = new Shop(1); Shop::setContext(Shop::CONTEXT_SHOP, 1); Configuration::loadConfiguration(); - Context::getContext()->language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); - Context::getContext()->country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT')); + if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language)) + if ($id_lang = (int)Configuration::get('PS_LANG_DEFAULT')) + Context::getContext()->language = new Language($id_lang); + if (!isset(Context::getContext()->country) || !Validate::isLoadedObject(Context::getContext()->country)) + if ($id_country = (int)Configuration::get('PS_COUNTRY_DEFAULT')) + Context::getContext()->country = new Country((int)$id_country); + Context::getContext()->cart = new Cart(); Context::getContext()->employee = new Employee(1); if (!defined('_PS_SMARTY_FAST_LOAD_')) @@ -138,6 +145,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole */ public function processInstallDatabase() { + $this->initializeContext(); return $this->model_install->installDatabase($this->datas->database_clear); } @@ -147,6 +155,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole */ public function processInstallDefaultData() { + $this->initializeContext(); return $this->model_install->installDefaultData($this->datas->shop_name, true); }