// fix cache on hooks for php cli installation

This commit is contained in:
Rémi Gaillard
2013-04-02 15:25:10 +02:00
parent 9517e1a22b
commit 66f22fd00a
+11 -2
View File
@@ -63,12 +63,19 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
public function initializeContext() public function initializeContext()
{ {
global $smarty; global $smarty;
// Clean all cache values
Cache::clean('*');
Context::getContext()->shop = new Shop(1); Context::getContext()->shop = new Shop(1);
Shop::setContext(Shop::CONTEXT_SHOP, 1); Shop::setContext(Shop::CONTEXT_SHOP, 1);
Configuration::loadConfiguration(); Configuration::loadConfiguration();
Context::getContext()->language = new Language((int)Configuration::get('PS_LANG_DEFAULT')); if (!isset(Context::getContext()->language) || !Validate::isLoadedObject(Context::getContext()->language))
Context::getContext()->country = new Country((int)Configuration::get('PS_COUNTRY_DEFAULT')); 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()->cart = new Cart();
Context::getContext()->employee = new Employee(1); Context::getContext()->employee = new Employee(1);
if (!defined('_PS_SMARTY_FAST_LOAD_')) if (!defined('_PS_SMARTY_FAST_LOAD_'))
@@ -138,6 +145,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
*/ */
public function processInstallDatabase() public function processInstallDatabase()
{ {
$this->initializeContext();
return $this->model_install->installDatabase($this->datas->database_clear); return $this->model_install->installDatabase($this->datas->database_clear);
} }
@@ -147,6 +155,7 @@ class InstallControllerConsoleProcess extends InstallControllerConsole
*/ */
public function processInstallDefaultData() public function processInstallDefaultData()
{ {
$this->initializeContext();
return $this->model_install->installDefaultData($this->datas->shop_name, true); return $this->model_install->installDefaultData($this->datas->shop_name, true);
} }