Merge branch 'release' of https://github.com/PrestaShop/PrestaShop into release

This commit is contained in:
gRoussac
2013-08-08 11:05:37 +02:00
4 changed files with 30 additions and 29 deletions

View File

@@ -292,15 +292,17 @@ abstract class ModuleCore
else
{
if (!$upgrade_detail['number_upgraded'])
$this->_errors[] = $this->l('None upgrades have been applied');
$this->_errors[] = $this->l('No upgrade has been applied');
else
{
$this->_errors[] = $this->l('Upgraded from: ').$upgrade_detail['upgraded_from'].$this->l(' to ').
$upgrade_detail['upgraded_to'];
$this->_errors[] = sprintf($this->l('Upgraded from: %S to %s'), $upgrade_detail['upgraded_from'], $upgrade_detail['upgraded_to']);
$this->_errors[] = $upgrade_detail['number_upgrade_left'].' '.$this->l('upgrade left');
}
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
if ($upgrade_detail['duplicate'])
$this->_errors[] = sprintf(Tools::displayError('Module %s cannot be upgraded this time: please refresh this page to update it.'), $this->name);
else
$this->_errors[] = $this->l('To prevent any problem, this module has been turned off');
}
}
}
@@ -348,19 +350,21 @@ abstract class ModuleCore
$upgrade = &self::$modules_cache[$this->name]['upgrade'];
foreach ($upgrade['upgrade_file_left'] as $num => $file_detail)
{
// Default variable required in the included upgrade file need to be set by default there:
// upgrade_version, success_upgrade
$upgrade_result = false;
if (function_exists($file_detail['upgrade_function']))
{
$upgrade['success'] = false;
$upgrade['duplicate'] = true;
break;
}
include($file_detail['file']);
// Call the upgrade function if defined
$upgrade['success'] = false;
if (function_exists($file_detail['upgrade_function']))
$upgrade_result = $file_detail['upgrade_function']($this);
$upgrade['success'] = $upgrade_result;
$upgrade['success'] = $file_detail['upgrade_function']($this);
// Set detail when an upgrade succeed or failed
if ($upgrade_result)
if ($upgrade['success'])
{
$upgrade['number_upgraded'] += 1;
$upgrade['upgraded_to'] = $file_detail['version'];
@@ -378,6 +382,7 @@ abstract class ModuleCore
}
$upgrade['number_upgrade_left'] = count($upgrade['upgrade_file_left']);
// Update module version in DB with the last succeed upgrade
if ($upgrade['upgraded_to'])
Module::upgradeModuleVersion($this->name, $upgrade['upgraded_to']);
@@ -396,9 +401,9 @@ abstract class ModuleCore
public static function upgradeModuleVersion($name, $version)
{
return Db::getInstance()->execute('
UPDATE `'._DB_PREFIX_.'module` m
SET m.version = \''.bqSQL($version).'\'
WHERE m.name = \''.bqSQL($name).'\'');
UPDATE `'._DB_PREFIX_.'module` m
SET m.version = \''.bqSQL($version).'\'
WHERE m.name = \''.bqSQL($name).'\'');
}
/**

View File

@@ -630,9 +630,8 @@ class AdminModulesControllerCore extends AdminController
if (!$download_ok)
$this->errors[] = $this->l('Error on downloading the lastest version');
else
if(!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
elseif (!$this->extractArchive(_PS_MODULE_DIR_.$modaddons->name.'.zip', false))
$this->errors[] = $this->l(sprintf("Module %s can't be upgraded: ", $modaddons->name));
}
}
}
@@ -674,18 +673,18 @@ class AdminModulesControllerCore extends AdminController
// Get the return value of current method
$echo = $module->{$method}();
// After a successful install of a single module that has a configuration method, to the configuration page
if ($key == 'install' && $echo === true && strpos(Tools::getValue('install'), '|') === false && method_exists($module, 'getContent'))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&configure='.$module->name.'&conf=12');
}
// If the method called is "configure" (getContent method), we show the html code of configure page
if ($key == 'configure' && Module::isInstalled($module->name))
{
if (isset($module->multishop_context))
$this->multishop_context = $module->multishop_context;
$backlink = self::$currentIndex.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name;
$hooklink = 'index.php?tab=AdminModulesPositions&token='.Tools::getAdminTokenLite('AdminModulesPositions').'&show_modules='.(int)$module->id;
$tradlink = 'index.php?tab=AdminTranslations&token='.Tools::getAdminTokenLite('AdminTranslations').'&type=modules&lang=';
@@ -768,10 +767,8 @@ class AdminModulesControllerCore extends AdminController
Tools::redirectAdmin(self::$currentIndex.'&conf='.$return.'&token='.$this->token.'&tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
}
if(isset($_GET['update']))
{
if (isset($_GET['update']))
Tools::redirectAdmin(self::$currentIndex.'&token='.$this->token.'&updated=1tab_module='.$module->tab.'&module_name='.$module->name.'&anchor=anchor'.ucfirst($module->name).(isset($modules_list_save) ? '&modules_list='.$modules_list_save : '').$params);
}
}
public function postProcess()
@@ -779,7 +776,6 @@ class AdminModulesControllerCore extends AdminController
// Parent Post Process
parent::postProcess();
// Get the list of installed module ans prepare it for ajax call.
if (($list = Tools::getValue('installed_modules')))
Context::getContext()->smarty->assign('installed_modules', Tools::jsonEncode(explode('|', $list)));

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8" ?>
<module>
<name>blocklayered</name>
<displayName><![CDATA[Bloc navigation &agrave; facettes]]></displayName>
<displayName><![CDATA[Layered navigation block]]></displayName>
<version><![CDATA[1.8.9]]></version>
<description><![CDATA[Affiche un bloc avec les filtres de la navigation &agrave; facettes]]></description>
<description><![CDATA[Displays a block with layered navigation filters.]]></description>
<author><![CDATA[PrestaShop]]></author>
<tab><![CDATA[front_office_features]]></tab>
<is_configurable>1</is_configurable>

View File

@@ -16,9 +16,9 @@ function upgrade_module_1_2_1($object)
function homeslider_stripslashes_field($field)
{
$quotes = array('\'\\\\\'\'', '\'\\\'\'');
$dquotes = array('\'\\"\'', '\'"\'');
$backslashes = array('\'\\\\\'', '\'\\\'');
$quotes = array('"\\\'"', '"\'"');
$dquotes = array('\'\\\\"\'', '\'"\'');
$backslashes = array('"\\\\\\\\"', '"\\\\"');
return '`'.bqSQL($field).'` = replace(replace(replace(`'.bqSQL($field).'`, '.$quotes[0].', '.$quotes[1].'), '.$dquotes[0].', '.$dquotes[1].'), '.$backslashes[0].', '.$backslashes[1].')';
}