[*] Installer : Set context in upgrader
This commit is contained in:
@@ -129,7 +129,7 @@ class TranslateCore
|
||||
static $translations_merged = array();
|
||||
|
||||
$name = $module instanceof Module ? $module->name : $module;
|
||||
if (!isset($translations_merged[$name]))
|
||||
if (!isset($translations_merged[$name]) && isset(Context::getContext()->language))
|
||||
{
|
||||
$filesByPriority = array(
|
||||
// Translations in theme
|
||||
|
||||
@@ -139,8 +139,9 @@ abstract class ModuleCore
|
||||
public function __construct($name = null, Context $context = null)
|
||||
{
|
||||
// Load context and smarty
|
||||
$this->context = $context ? $context : Context::getContext();
|
||||
$this->smarty = $this->context->smarty->createData($this->context->smarty);
|
||||
$this->context = $context ? $context : Context::getContext();
|
||||
if (is_object($this->context->smarty))
|
||||
$this->smarty = $this->context->smarty->createData($this->context->smarty);
|
||||
|
||||
// If the module has no name we gave him its id as name
|
||||
if ($this->name == null)
|
||||
@@ -152,8 +153,9 @@ abstract class ModuleCore
|
||||
// If cache is not generated, we generate it
|
||||
if (self::$modules_cache == null && !is_array(self::$modules_cache))
|
||||
{
|
||||
// Join clause is done to check if the module is activated in current shop context
|
||||
$sql_limit_shop = 'SELECT COUNT(*) FROM `'._DB_PREFIX_.'module_shop` ms WHERE m.`id_module` = ms.`id_module` AND ms.`id_shop` = '.(int)Context::getContext()->shop->id;
|
||||
// Join clause is done to check if the module is activated in current shop context
|
||||
$sql_limit_shop = 'SELECT COUNT(*) FROM `'._DB_PREFIX_.'module_shop` ms WHERE m.`id_module` = ms.`id_module` AND ms.`id_shop` = '.((is_object(Context::getContext()->shop) && $id = (int)Context::getContext()->shop->id) ? $id : 1);
|
||||
|
||||
$sql = 'SELECT m.`id_module`, m.`name`, ('.$sql_limit_shop.') as total FROM `'._DB_PREFIX_.'module` m';
|
||||
|
||||
// Result is cached
|
||||
|
||||
@@ -24,4 +24,4 @@
|
||||
* International Registered Trademark & Property of PrestaShop SA
|
||||
*/
|
||||
|
||||
define('_PS_INSTALL_VERSION_', '1.5.4.0');
|
||||
define('_PS_INSTALL_VERSION_', '1.5.4.1');
|
||||
|
||||
@@ -246,6 +246,28 @@ if(!defined('_PS_CACHE_ENABLED_'))
|
||||
define('_PS_CACHE_ENABLED_', '0');
|
||||
if(!defined('_MYSQL_ENGINE_'))
|
||||
define('_MYSQL_ENGINE_', 'MyISAM');
|
||||
|
||||
global $smarty;
|
||||
// Clean all cache values
|
||||
Cache::clean('*');
|
||||
|
||||
Context::getContext()->shop = new Shop(1);
|
||||
Shop::setContext(Shop::CONTEXT_SHOP, 1);
|
||||
Configuration::loadConfiguration();
|
||||
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_'))
|
||||
define('_PS_SMARTY_FAST_LOAD_', true);
|
||||
require_once _PS_ROOT_DIR_.'/config/smarty.config.inc.php';
|
||||
|
||||
Context::getContext()->smarty = $smarty;
|
||||
|
||||
if(isset($_GET['customModule']) AND $_GET['customModule'] == 'desactivate')
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user