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

This commit is contained in:
Rémi Gaillard
2013-03-29 14:29:07 +01:00
12 changed files with 74 additions and 21 deletions
+28 -2
View File
@@ -95,7 +95,9 @@ class InstallControllerHttpProcess extends InstallControllerHttp
$this->processConfigureShop();
elseif (Tools::getValue('installModules') && !empty($this->session->process_validated['configureShop']))
$this->processInstallModules();
elseif (Tools::getValue('installFixtures') && !empty($this->session->process_validated['installModules']))
elseif (Tools::getValue('installModulesAddons') && !empty($this->session->process_validated['installModules']))
$this->processInstallAddonsModules();
elseif (Tools::getValue('installFixtures') && !empty($this->session->process_validated['installModulesAddons']))
$this->processInstallFixtures();
elseif (Tools::getValue('installTheme') && !empty($this->session->process_validated['installModules']))
$this->processInstallTheme();
@@ -231,6 +233,23 @@ class InstallControllerHttpProcess extends InstallControllerHttp
$this->session->process_validated = array_merge($this->session->process_validated, array('installModules' => true));
$this->ajaxJsonAnswer(true);
}
/**
* PROCESS : installModulesAddons
* Install modules from addons
*/
public function processInstallAddonsModules()
{
$this->initializeContext();
if ($module = Tools::getValue('module') && $id_module = Tools::getValue('id_module'))
$result = $this->model_install->installModulesAddons(array('name' => $module, 'id_module' => $id_module));
else
$result = $this->model_install->installModulesAddons();
if (!$result || $this->model_install->getErrors())
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
$this->session->process_validated = array_merge($this->session->process_validated, array('installModulesAddons' => true));
$this->ajaxJsonAnswer(true);
}
/**
* PROCESS : installFixtures
@@ -312,6 +331,8 @@ class InstallControllerHttpProcess extends InstallControllerHttp
*/
public function display()
{
$this->initializeContext();
// The installer SHOULD take less than 32M, but may take up to 35/36M sometimes. So 42M is a good value :)
$low_memory = Tools::getMemoryLimit() < Tools::getOctets('42M');
@@ -333,12 +354,17 @@ class InstallControllerHttpProcess extends InstallControllerHttp
$this->process_steps[] = $populate_step;
$this->process_steps[] = array('key' => 'configureShop', 'lang' => $this->l('Configure shop information'));
$install_modules = array('key' => 'installModules', 'lang' => $this->l('Install modules'));
if ($low_memory)
foreach ($this->model_install->getModulesList() as $module)
$install_modules['subtasks'][] = array('module' => $module);
$this->process_steps[] = $install_modules;
$install_modules = array('key' => 'installModulesAddons', 'lang' => $this->l('Install modules Addons'));
if ($low_memory)
foreach ($this->model_install->getAddonsModulesList() as $module)
$install_modules['subtasks'][] = array('module' => (string)$module['name'], 'id_module' => (string)$module['id_module']);
$this->process_steps[] = $install_modules;
// Fixtures are installed only if option is selected
if ($this->session->install_type == 'full')
+1 -1
View File
@@ -144,7 +144,7 @@ CREATE TABLE `PREFIX_carrier` (
`max_width` int(10) DEFAULT 0,
`max_height` int(10) DEFAULT 0,
`max_depth` int(10) DEFAULT 0,
`max_weight` int(10) DEFAULT 0,
`max_weight` DECIMAL(20,6) DEFAULT 0,
`grade` int(10) DEFAULT 0,
PRIMARY KEY (`id_carrier`),
KEY `deleted` (`deleted`,`active`),
+25 -7
View File
@@ -585,7 +585,6 @@ class InstallModelInstall extends InstallAbstractModel
'statsvisits',
);
}
return $modules;
}
@@ -602,18 +601,16 @@ class InstallModelInstall extends InstallAbstractModel
return $addons_modules;
}
/**
* PROCESS : installModules
* Download module from addons and Install all modules in ~/modules/ directory
*/
public function installModules($module = null)
public function installModulesAddons($module = null)
{
$modules = $module ? array($module) : $this->getModulesList();
$addons_modules = $module ? array($module) : $this->getAddonsModulesList();
$modules = array();
if (!InstallSession::getInstance()->safe_mode)
{
$addons_modules = $this->getAddonsModulesList();
foreach($addons_modules as $addons_module)
if (file_put_contents(_PS_MODULE_DIR_.$addons_module['name'].'.zip', Tools::addonsRequest('module', array('id_module' => $addons_module['id_module']))))
if (Tools::ZipExtract(_PS_MODULE_DIR_.$addons_module['name'].'.zip', _PS_MODULE_DIR_))
@@ -622,6 +619,27 @@ class InstallModelInstall extends InstallAbstractModel
unlink(_PS_MODULE_DIR_.$addons_module['name'].'.zip');
}
}
$errors = array();
foreach ($modules as $module_name)
if (!$this->installModules($module_name))
$errors[] = $this->language->l('Cannot install module "%s"', $module_name);
if ($errors)
{
$this->setError($errors);
return false;
}
return true;
}
/**
* PROCESS : installModules
* Download module from addons and Install all modules in ~/modules/ directory
*/
public function installModules($module = null)
{
$modules = $module ? array($module) : $this->getModulesList();
$errors = array();
foreach ($modules as $module_name)
{
@@ -634,7 +652,7 @@ class InstallModelInstall extends InstallAbstractModel
}
if ($errors)
{
{
$this->setError($errors);
return false;
}
+3
View File
@@ -0,0 +1,3 @@
SET NAMES 'utf8';
ALTER TABLE `PREFIX_carrier` CHANGE `max_weight` `max_weight` DECIMAL( 20, 6 ) NULL DEFAULT '0';