// Installer can work with 18MO (under 32MO sub ajax queries are triggered)
This commit is contained in:
@@ -47,6 +47,10 @@ if (Configuration::get('PS_SMARTY_CONSOLE') == _PS_SMARTY_CONSOLE_OPEN_BY_URL_)
|
|||||||
else if (Configuration::get('PS_SMARTY_CONSOLE') == _PS_SMARTY_CONSOLE_OPEN_)
|
else if (Configuration::get('PS_SMARTY_CONSOLE') == _PS_SMARTY_CONSOLE_OPEN_)
|
||||||
$smarty->debugging = true;
|
$smarty->debugging = true;
|
||||||
|
|
||||||
|
/* Use this constant if you want to load smarty without all PrestaShop functions */
|
||||||
|
if (defined('_PS_SMARTY_FAST_LOAD_') && _PS_SMARTY_FAST_LOAD_)
|
||||||
|
return;
|
||||||
|
|
||||||
if (defined('_PS_ADMIN_DIR_'))
|
if (defined('_PS_ADMIN_DIR_'))
|
||||||
require_once (dirname(__FILE__).'/smartyadmin.config.inc.php');
|
require_once (dirname(__FILE__).'/smartyadmin.config.inc.php');
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -144,10 +144,7 @@ class InstallXmlLoader
|
|||||||
$this->ids = $ids;
|
$this->ids = $ids;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getSortedEntities()
|
||||||
* Read all XML files from data folder and populate tables
|
|
||||||
*/
|
|
||||||
public function populateFromXmlFiles()
|
|
||||||
{
|
{
|
||||||
// Browse all XML files from data/xml directory
|
// Browse all XML files from data/xml directory
|
||||||
$entities = array();
|
$entities = array();
|
||||||
@@ -201,14 +198,19 @@ class InstallXmlLoader
|
|||||||
}
|
}
|
||||||
while ($current != $sort_entities);
|
while ($current != $sort_entities);
|
||||||
|
|
||||||
|
return $sort_entities;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read all XML files from data folder and populate tables
|
||||||
|
*/
|
||||||
|
public function populateFromXmlFiles()
|
||||||
|
{
|
||||||
|
$entities = $this->getSortedEntities();
|
||||||
|
|
||||||
// Populate entities
|
// Populate entities
|
||||||
foreach ($sort_entities as $entity)
|
foreach ($entities as $entity)
|
||||||
{
|
$this->populateEntity($entity);
|
||||||
if (method_exists($this, 'populateEntity'.Tools::toCamelCase($entity)))
|
|
||||||
$this->{'populateEntity'.Tools::toCamelCase($entity)}();
|
|
||||||
else
|
|
||||||
$this->populateEntity($entity);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -218,6 +220,12 @@ class InstallXmlLoader
|
|||||||
*/
|
*/
|
||||||
public function populateEntity($entity)
|
public function populateEntity($entity)
|
||||||
{
|
{
|
||||||
|
if (method_exists($this, 'populateEntity'.Tools::toCamelCase($entity)))
|
||||||
|
{
|
||||||
|
$this->{'populateEntity'.Tools::toCamelCase($entity)}();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$xml = $this->loadEntity($entity);
|
$xml = $this->loadEntity($entity);
|
||||||
|
|
||||||
// Read list of fields
|
// Read list of fields
|
||||||
|
|||||||
@@ -66,8 +66,9 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
Context::getContext()->language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
Context::getContext()->language = new Language(Configuration::get('PS_LANG_DEFAULT'));
|
||||||
Context::getContext()->country = new Country('PS_COUNTRY_DEFAULT');
|
Context::getContext()->country = new Country('PS_COUNTRY_DEFAULT');
|
||||||
Context::getContext()->cart = new Cart();
|
Context::getContext()->cart = new Cart();
|
||||||
|
define('_PS_SMARTY_FAST_LOAD_', true);
|
||||||
require_once _PS_ROOT_DIR_.'/config/smarty.config.inc.php';
|
require_once _PS_ROOT_DIR_.'/config/smarty.config.inc.php';
|
||||||
|
|
||||||
Context::getContext()->smarty = $smarty;
|
Context::getContext()->smarty = $smarty;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -83,6 +84,8 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
$this->processGenerateSettingsFile();
|
$this->processGenerateSettingsFile();
|
||||||
else if (Tools::getValue('installDatabase') && !empty($this->session->process_validated['generateSettingsFile']))
|
else if (Tools::getValue('installDatabase') && !empty($this->session->process_validated['generateSettingsFile']))
|
||||||
$this->processInstallDatabase();
|
$this->processInstallDatabase();
|
||||||
|
else if (Tools::getValue('installDefaultData'))
|
||||||
|
$this->processInstallDefaultData();
|
||||||
else if (Tools::getValue('populateDatabase') && !empty($this->session->process_validated['installDatabase']))
|
else if (Tools::getValue('populateDatabase') && !empty($this->session->process_validated['installDatabase']))
|
||||||
$this->processPopulateDatabase();
|
$this->processPopulateDatabase();
|
||||||
else if (Tools::getValue('configureShop') && !empty($this->session->process_validated['populateDatabase']))
|
else if (Tools::getValue('configureShop') && !empty($this->session->process_validated['populateDatabase']))
|
||||||
@@ -142,6 +145,20 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
$this->ajaxJsonAnswer(true);
|
$this->ajaxJsonAnswer(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PROCESS : installDefaultData
|
||||||
|
* Create default shop and languages
|
||||||
|
*/
|
||||||
|
public function processInstallDefaultData()
|
||||||
|
{
|
||||||
|
// @todo remove true in populateDatabase for 1.5.0 RC version
|
||||||
|
$result = $this->model_install->installDefaultData($this->session->shop_name, true);
|
||||||
|
|
||||||
|
if (!$result || $this->model_install->getErrors())
|
||||||
|
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||||
|
$this->ajaxJsonAnswer(true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PROCESS : populateDatabase
|
* PROCESS : populateDatabase
|
||||||
* Populate database with default data
|
* Populate database with default data
|
||||||
@@ -150,11 +167,8 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
{
|
{
|
||||||
$this->initializeContext();
|
$this->initializeContext();
|
||||||
|
|
||||||
// @todo remove true in populateDatabase for 1.5.0 RC version
|
$this->model_install->xml_loader_ids = $this->session->xml_loader_ids;
|
||||||
$result = $this->model_install->populateDatabase(true, array(
|
$result = $this->model_install->populateDatabase(Tools::getValue('entity'));
|
||||||
'shop_name' => $this->session->shop_name
|
|
||||||
));
|
|
||||||
|
|
||||||
if (!$result || $this->model_install->getErrors())
|
if (!$result || $this->model_install->getErrors())
|
||||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||||
$this->session->xml_loader_ids = $this->model_install->xml_loader_ids;
|
$this->session->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||||
@@ -202,10 +216,8 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
{
|
{
|
||||||
$this->initializeContext();
|
$this->initializeContext();
|
||||||
|
|
||||||
// Remove all modules from module table, just in case
|
$result = $this->model_install->installModules(Tools::getValue('module'));
|
||||||
Db::getInstance()->delete(_DB_PREFIX_.'module');
|
if (!$result || $this->model_install->getErrors())
|
||||||
|
|
||||||
if (!$this->model_install->installModules() || $this->model_install->getErrors())
|
|
||||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||||
$this->session->process_validated['installModules'] = true;
|
$this->session->process_validated['installModules'] = true;
|
||||||
$this->ajaxJsonAnswer(true);
|
$this->ajaxJsonAnswer(true);
|
||||||
@@ -220,8 +232,9 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
$this->initializeContext();
|
$this->initializeContext();
|
||||||
|
|
||||||
$this->model_install->xml_loader_ids = $this->session->xml_loader_ids;
|
$this->model_install->xml_loader_ids = $this->session->xml_loader_ids;
|
||||||
if (!$this->model_install->installFixtures() || $this->model_install->getErrors())
|
if (!$this->model_install->installFixtures(Tools::getValue('entity')) || $this->model_install->getErrors())
|
||||||
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
$this->ajaxJsonAnswer(false, $this->model_install->getErrors());
|
||||||
|
$this->session->xml_loader_ids = $this->model_install->xml_loader_ids;
|
||||||
$this->ajaxJsonAnswer(true);
|
$this->ajaxJsonAnswer(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -290,15 +303,53 @@ class InstallControllerHttpProcess extends InstallControllerHttp
|
|||||||
*/
|
*/
|
||||||
public function display()
|
public function display()
|
||||||
{
|
{
|
||||||
|
$low_memory = Tools::getMemoryLimit() < Tools::getOctets('32M');
|
||||||
|
|
||||||
|
// We fill the process step used for Ajax queries
|
||||||
$this->process_steps = array();
|
$this->process_steps = array();
|
||||||
$this->process_steps[] = array('key' => 'generateSettingsFile', 'lang' => $this->l('Create settings.inc file'));
|
$this->process_steps[] = array('key' => 'generateSettingsFile', 'lang' => $this->l('Create settings.inc file'));
|
||||||
$this->process_steps[] = array('key' => 'installDatabase', 'lang' => $this->l('Create database tables'));
|
$this->process_steps[] = array('key' => 'installDatabase', 'lang' => $this->l('Create database tables'));
|
||||||
$this->process_steps[] = array('key' => 'populateDatabase', 'lang' => $this->l('Populate database tables'));
|
$this->process_steps[] = array('key' => 'installDefaultData', 'lang' => $this->l('Create default shop and languages'));
|
||||||
|
|
||||||
|
// If low memory, create subtasks for populateDatabase step (entity per entity)
|
||||||
|
$populate_step = array('key' => 'populateDatabase', 'lang' => $this->l('Populate database tables'));
|
||||||
|
if ($low_memory)
|
||||||
|
{
|
||||||
|
$populate_step['subtasks'] = array();
|
||||||
|
$xml_loader = new InstallXmlLoader();
|
||||||
|
foreach ($xml_loader->getSortedEntities() as $entity)
|
||||||
|
$populate_step['subtasks'][] = array('entity' => $entity);
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->process_steps[] = $populate_step;
|
||||||
$this->process_steps[] = array('key' => 'configureShop', 'lang' => $this->l('Configure shop informations'));
|
$this->process_steps[] = array('key' => 'configureShop', 'lang' => $this->l('Configure shop informations'));
|
||||||
$this->process_steps[] = array('key' => 'installModules', 'lang' => $this->l('Install modules'));
|
|
||||||
|
|
||||||
|
$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;
|
||||||
|
|
||||||
|
// Fixtures are installed only if option is selected
|
||||||
if ($this->session->install_type == 'full')
|
if ($this->session->install_type == 'full')
|
||||||
$this->process_steps[] = array('key' => 'installFixtures', 'lang' => $this->l('Install demonstration data'));
|
{
|
||||||
|
// If low memory, create subtasks for installFixtures step (entity per entity)
|
||||||
|
$fixtures_step = array('key' => 'installFixtures', 'lang' => $this->l('Install demonstration data'));
|
||||||
|
if ($low_memory)
|
||||||
|
{
|
||||||
|
$fixtures_step['subtasks'] = array();
|
||||||
|
$xml_loader = new InstallXmlLoader();
|
||||||
|
$xml_loader->setFixturesPath();
|
||||||
|
foreach ($xml_loader->getSortedEntities() as $entity)
|
||||||
|
$fixtures_step['subtasks'][] = array('entity' => $entity);
|
||||||
|
}
|
||||||
|
$this->process_steps[] = $fixtures_step;
|
||||||
|
}
|
||||||
|
|
||||||
$this->process_steps[] = array('key' => 'installTheme', 'lang' => $this->l('Install theme'));
|
$this->process_steps[] = array('key' => 'installTheme', 'lang' => $this->l('Install theme'));
|
||||||
|
|
||||||
|
// Mail is send only if option is selected
|
||||||
if ($this->session->send_informations)
|
if ($this->session->send_informations)
|
||||||
$this->process_steps[] = array('key' => 'sendEmail', 'lang' => $this->l('Send information e-mail'));
|
$this->process_steps[] = array('key' => 'sendEmail', 'lang' => $this->l('Send information e-mail'));
|
||||||
|
|
||||||
|
|||||||
+5
-51
@@ -66,55 +66,9 @@ require_once(_PS_INSTALL_PATH_.'classes/simplexml.php');
|
|||||||
|
|
||||||
@set_time_limit(300);
|
@set_time_limit(300);
|
||||||
|
|
||||||
class InstallLog
|
// Try to improve memory limit if it's under 32M
|
||||||
{
|
if (Tools::getMemoryLimit() < Tools::getOctets('32M'))
|
||||||
/**
|
ini_set('memory_limit', '32M');
|
||||||
* @return InstallLog
|
|
||||||
*/
|
|
||||||
public function getInstance()
|
|
||||||
{
|
|
||||||
static $instance = null;
|
|
||||||
|
|
||||||
if (!$instance)
|
if (Tools::getMemoryLimit() < Tools::getOctets('16M'))
|
||||||
$instance = new InstallLog();
|
die('PrestaShop requires at least 16M of memory to run, please check the memory_limit directive in php.ini or contact your host provider');
|
||||||
return $instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected $fd;
|
|
||||||
protected $data = array();
|
|
||||||
protected $last_time;
|
|
||||||
protected $depth = 0;
|
|
||||||
|
|
||||||
public function __construct()
|
|
||||||
{
|
|
||||||
$this->fd = fopen(_PS_INSTALL_PATH_.'log.txt', 'w');
|
|
||||||
$this->last_time = microtime(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public function write($id)
|
|
||||||
{
|
|
||||||
$str = str_pad("[$id]", 35, ' ');
|
|
||||||
if (isset($this->data[$id]['start']))
|
|
||||||
$str .= str_pad(round(microtime(true) - $this->data[$id]['start'], 4).'ms', 10, ' ');
|
|
||||||
$str .= str_pad(round(microtime(true) - $this->last_time, 4).'ms', 10, ' ');
|
|
||||||
$this->data[$id]['str'] = str_repeat("\t", $this->depth - 1)."$str\n";
|
|
||||||
$this->depth--;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function start($id)
|
|
||||||
{
|
|
||||||
$this->data[$id] = array('start' => microtime(true));
|
|
||||||
$this->depth++;
|
|
||||||
}
|
|
||||||
|
|
||||||
public function __destruct()
|
|
||||||
{
|
|
||||||
foreach ($this->data as $k => $info)
|
|
||||||
if (!isset($info['str']))
|
|
||||||
$this->write($k);
|
|
||||||
|
|
||||||
foreach ($this->data as $info)
|
|
||||||
fwrite($this->fd, $info['str']);
|
|
||||||
fclose($this->fd);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ return array(
|
|||||||
'An error occurred while sending email, please verify your parameters' => 'Une erreur est survenue lors de l\'envoi de l\'e-mail, merci de vérifier vos paramètres',
|
'An error occurred while sending email, please verify your parameters' => 'Une erreur est survenue lors de l\'envoi de l\'e-mail, merci de vérifier vos paramètres',
|
||||||
'Create settings.inc file' => 'Création du fichier settings.inc',
|
'Create settings.inc file' => 'Création du fichier settings.inc',
|
||||||
'Create database tables' => 'Création des tables de la base',
|
'Create database tables' => 'Création des tables de la base',
|
||||||
|
'Create default shop and languages ' => 'Création de la boutique par défaut et des langues',
|
||||||
'Populate database tables' => 'Remplissage des tables de la base',
|
'Populate database tables' => 'Remplissage des tables de la base',
|
||||||
'Configure shop informations' => 'Configuration de la boutique',
|
'Configure shop informations' => 'Configuration de la boutique',
|
||||||
'Install modules' => 'Installation des modules',
|
'Install modules' => 'Installation des modules',
|
||||||
|
|||||||
@@ -137,16 +137,15 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PROCESS : populateDatabase
|
* PROCESS : installDefaultData
|
||||||
* Populate database with default data
|
* Create default shop and languages
|
||||||
*/
|
*/
|
||||||
public function populateDatabase($clear_database = false, array $params = array())
|
public function installDefaultData($shop_name, $clear_database = false)
|
||||||
{
|
{
|
||||||
if ($clear_database)
|
if ($clear_database)
|
||||||
$this->clearDatabase(true);
|
$this->clearDatabase(true);
|
||||||
|
|
||||||
// Install first shop
|
// Install first shop
|
||||||
$shop_name = isset($params['shop_name']) ? $params['shop_name'] : 'Default';
|
|
||||||
if (!$this->createShop($shop_name))
|
if (!$this->createShop($shop_name))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
@@ -163,11 +162,31 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
|
|
||||||
$flip_languages = array_flip($languages);
|
$flip_languages = array_flip($languages);
|
||||||
Configuration::updateGlobalValue('PS_LANG_DEFAULT', $flip_languages[$this->language->getLanguageIso()]);
|
Configuration::updateGlobalValue('PS_LANG_DEFAULT', $flip_languages[$this->language->getLanguageIso()]);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PROCESS : populateDatabase
|
||||||
|
* Populate database with default data
|
||||||
|
*/
|
||||||
|
public function populateDatabase($entity = null)
|
||||||
|
{
|
||||||
|
Db::getInstance()->delete(_DB_PREFIX_.'timezone');
|
||||||
|
$languages = array();
|
||||||
|
foreach (Language::getLanguages(false) as $lang)
|
||||||
|
$languages[$lang['id_lang']] = $lang['iso_code'];
|
||||||
|
|
||||||
// Install XML data (data/xml/ folder)
|
// Install XML data (data/xml/ folder)
|
||||||
$xml_loader = new InstallXmlLoader();
|
$xml_loader = new InstallXmlLoader();
|
||||||
$xml_loader->setLanguages($languages);
|
$xml_loader->setLanguages($languages);
|
||||||
$xml_loader->populateFromXmlFiles();
|
|
||||||
|
if (isset($this->xml_loader_ids) && $this->xml_loader_ids)
|
||||||
|
$xml_loader->setIds($this->xml_loader_ids);
|
||||||
|
|
||||||
|
if ($entity)
|
||||||
|
$xml_loader->populateEntity($entity);
|
||||||
|
else
|
||||||
|
$xml_loader->populateFromXmlFiles();
|
||||||
if ($errors = $xml_loader->getErrors())
|
if ($errors = $xml_loader->getErrors())
|
||||||
{
|
{
|
||||||
$this->setError($errors);
|
$this->setError($errors);
|
||||||
@@ -447,11 +466,7 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
@unlink($dir.$file);
|
@unlink($dir.$file);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
public function getModulesList()
|
||||||
* PROCESS : installModules
|
|
||||||
* Install all modules in ~/modules/ directory
|
|
||||||
*/
|
|
||||||
public function installModules()
|
|
||||||
{
|
{
|
||||||
// @todo REMOVE DEV MODE
|
// @todo REMOVE DEV MODE
|
||||||
$modules = array();
|
$modules = array();
|
||||||
@@ -532,6 +547,17 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return $modules;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* PROCESS : installModules
|
||||||
|
* Install all modules in ~/modules/ directory
|
||||||
|
*/
|
||||||
|
public function installModules($module = null)
|
||||||
|
{
|
||||||
|
$modules = $module ? array($module) : $this->getModulesList();
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
foreach ($modules as $module_name)
|
foreach ($modules as $module_name)
|
||||||
{
|
{
|
||||||
@@ -555,57 +581,8 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
* PROCESS : installFixtures
|
* PROCESS : installFixtures
|
||||||
* Install fixtures (E.g. demo products)
|
* Install fixtures (E.g. demo products)
|
||||||
*/
|
*/
|
||||||
public function installFixtures()
|
public function installFixtures($entity = null)
|
||||||
{
|
{
|
||||||
// @todo REMOVE THIS
|
|
||||||
/*Db::getInstance()->delete('prefix_manufacturer');
|
|
||||||
Db::getInstance()->delete('prefix_manufacturer_lang');
|
|
||||||
Db::getInstance()->delete('prefix_supplier');
|
|
||||||
Db::getInstance()->delete('prefix_supplier_lang');
|
|
||||||
Db::getInstance()->delete('prefix_address');
|
|
||||||
Db::getInstance()->delete('prefix_product');
|
|
||||||
Db::getInstance()->delete('prefix_product_lang');
|
|
||||||
Db::getInstance()->delete('prefix_category', 'id_category <> 1');
|
|
||||||
Db::getInstance()->delete('prefix_category_product');
|
|
||||||
Db::getInstance()->delete('prefix_category_lang', 'id_category <> 1');
|
|
||||||
Db::getInstance()->delete('prefix_scene');
|
|
||||||
Db::getInstance()->delete('prefix_scene_lang');
|
|
||||||
Db::getInstance()->delete('prefix_scene_products');
|
|
||||||
Db::getInstance()->delete('prefix_scene_category');
|
|
||||||
Db::getInstance()->delete('prefix_attribute_group');
|
|
||||||
Db::getInstance()->delete('prefix_attribute_group_lang');
|
|
||||||
Db::getInstance()->delete('prefix_attribute');
|
|
||||||
Db::getInstance()->delete('prefix_attribute_lang');
|
|
||||||
Db::getInstance()->delete('prefix_product_attribute');
|
|
||||||
Db::getInstance()->delete('prefix_product_attribute_combination');
|
|
||||||
Db::getInstance()->delete('prefix_product_attribute_image');
|
|
||||||
Db::getInstance()->delete('prefix_order_message');
|
|
||||||
Db::getInstance()->delete('prefix_order_message_lang');
|
|
||||||
Db::getInstance()->delete('prefix_feature');
|
|
||||||
Db::getInstance()->delete('prefix_feature_lang');
|
|
||||||
Db::getInstance()->delete('prefix_feature_value');
|
|
||||||
Db::getInstance()->delete('prefix_feature_value_lang');
|
|
||||||
Db::getInstance()->delete('prefix_feature_product');
|
|
||||||
Db::getInstance()->delete('prefix_store');
|
|
||||||
Db::getInstance()->delete('prefix_image');
|
|
||||||
Db::getInstance()->delete('prefix_image_lang');
|
|
||||||
Db::getInstance()->delete('prefix_tag');
|
|
||||||
Db::getInstance()->delete('prefix_alias');
|
|
||||||
Db::getInstance()->delete('prefix_customer');
|
|
||||||
Db::getInstance()->delete('prefix_guest');
|
|
||||||
Db::getInstance()->delete('prefix_connections');
|
|
||||||
Db::getInstance()->delete('prefix_customer_group');
|
|
||||||
Db::getInstance()->delete('prefix_cart');
|
|
||||||
Db::getInstance()->delete('prefix_cart_product');
|
|
||||||
Db::getInstance()->delete('prefix_orders');
|
|
||||||
Db::getInstance()->delete('prefix_order_detail');
|
|
||||||
Db::getInstance()->delete('prefix_order_history');
|
|
||||||
Db::getInstance()->delete('prefix_range_price');
|
|
||||||
Db::getInstance()->delete('prefix_range_weight');
|
|
||||||
Db::getInstance()->delete('prefix_delivery');
|
|
||||||
Db::getInstance()->delete('prefix_specific_price');
|
|
||||||
Db::getInstance()->delete('prefix_tag');*/
|
|
||||||
|
|
||||||
// Load class (use fixture class if one exists, or use InstallXmlLoader)
|
// Load class (use fixture class if one exists, or use InstallXmlLoader)
|
||||||
if (file_exists(_PS_INSTALL_FIXTURES_PATH_.'apple/install.php'))
|
if (file_exists(_PS_INSTALL_FIXTURES_PATH_.'apple/install.php'))
|
||||||
{
|
{
|
||||||
@@ -636,13 +613,22 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
foreach (Language::getLanguages(false) as $lang)
|
foreach (Language::getLanguages(false) as $lang)
|
||||||
$languages[$lang['id_lang']] = $lang['iso_code'];
|
$languages[$lang['id_lang']] = $lang['iso_code'];
|
||||||
$xml_loader->setLanguages($languages);
|
$xml_loader->setLanguages($languages);
|
||||||
$xml_loader->populateFromXmlFiles();
|
|
||||||
|
if ($entity)
|
||||||
|
$xml_loader->populateEntity($entity);
|
||||||
|
else
|
||||||
|
$xml_loader->populateFromXmlFiles();
|
||||||
|
|
||||||
if ($errors = $xml_loader->getErrors())
|
if ($errors = $xml_loader->getErrors())
|
||||||
{
|
{
|
||||||
$this->setError($errors);
|
$this->setError($errors);
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// IDS from xmlLoader are stored in order to use them for fixtures
|
||||||
|
$this->xml_loader_ids = $xml_loader->getIds();
|
||||||
|
unset($xml_loader);
|
||||||
|
|
||||||
// Index products in search tables
|
// Index products in search tables
|
||||||
Search::indexation(true);
|
Search::indexation(true);
|
||||||
|
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ function start_install()
|
|||||||
$('.error_log').hide();
|
$('.error_log').hide();
|
||||||
$('#progress_bar').show();
|
$('#progress_bar').show();
|
||||||
$('#progress_bar .installing').show();
|
$('#progress_bar .installing').show();
|
||||||
|
process_pixel = parseInt($('#progress_bar .total').css('width')) / process_steps.length;
|
||||||
|
|
||||||
process_install();
|
process_install();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,11 +54,14 @@ function process_install(step)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
$('#progress_bar .total .progress').animate({'width': '+='+process_percent+'%'}, 500);
|
$('#progress_bar .total .progress').animate({'width': '+='+process_pixel+'px'}, 500);
|
||||||
$('#progress_bar .total span').html(Math.ceil(current_step * process_percent)+'%');
|
$('#progress_bar .total span').html(Math.ceil(current_step * (100 / process_steps.length))+'%');
|
||||||
|
|
||||||
// Process next step
|
// Process next step
|
||||||
process_install(process_steps[current_step]);
|
if (process_steps[current_step].subtasks)
|
||||||
|
process_install_subtasks(process_steps[current_step]);
|
||||||
|
else
|
||||||
|
process_install(process_steps[current_step]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// An error occured during this step
|
// An error occured during this step
|
||||||
@@ -73,6 +78,63 @@ function process_install(step)
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function process_install_subtasks(step)
|
||||||
|
{
|
||||||
|
$('.installing').hide().html(step.lang+' ...').fadeIn('slow');
|
||||||
|
process_install_subtask(step, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
function process_install_subtask(step, current_subtask)
|
||||||
|
{
|
||||||
|
var params = {};
|
||||||
|
params[step.key] = 'true';
|
||||||
|
params['subtask'] = current_subtask;
|
||||||
|
$.each(step.subtasks[current_subtask], function(k, v)
|
||||||
|
{
|
||||||
|
params[k] = v;
|
||||||
|
});
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
url: 'index.php',
|
||||||
|
data: params,
|
||||||
|
dataType: 'json',
|
||||||
|
cache: false,
|
||||||
|
success: function(json)
|
||||||
|
{
|
||||||
|
// No error during this step
|
||||||
|
if (json && json.success === true)
|
||||||
|
{
|
||||||
|
current_subtask++;
|
||||||
|
var subtask_process_pixel = process_pixel / step.subtasks.length;
|
||||||
|
$('#progress_bar .total .progress').animate({'width': '+='+subtask_process_pixel+'px'}, 500);
|
||||||
|
$('#progress_bar .total span').html(Math.ceil((current_step * (100 / process_steps.length)) + Math.ceil(current_subtask * ((100 / process_steps.length) / step.subtasks.length)))+'%');
|
||||||
|
|
||||||
|
if (current_subtask >= step.subtasks.length)
|
||||||
|
{
|
||||||
|
current_step++;
|
||||||
|
$('#process_step_'+step.key).show().addClass('success');
|
||||||
|
if (process_steps[current_step].subtasks)
|
||||||
|
process_install_subtasks(process_steps[current_step]);
|
||||||
|
else
|
||||||
|
process_install(process_steps[current_step]);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
process_install_subtask(step, current_subtask);
|
||||||
|
}
|
||||||
|
// An error occured during this step
|
||||||
|
else
|
||||||
|
{
|
||||||
|
install_error(step, (json) ? json.message : '');
|
||||||
|
}
|
||||||
|
},
|
||||||
|
// An error HTTP (page not found, json not valid, etc.) occured during this step
|
||||||
|
error: function()
|
||||||
|
{
|
||||||
|
install_error(step);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
function install_error(step, errors)
|
function install_error(step, errors)
|
||||||
{
|
{
|
||||||
current_step = 0;
|
current_step = 0;
|
||||||
|
|||||||
@@ -704,7 +704,7 @@ ul#optional_update {list-style-type:none;}
|
|||||||
|
|
||||||
/* STEP 5 ******************************************/
|
/* STEP 5 ******************************************/
|
||||||
#install_process_form{
|
#install_process_form{
|
||||||
min-height: 260px;
|
min-height: 300px;
|
||||||
}
|
}
|
||||||
#progress_bar {
|
#progress_bar {
|
||||||
display: none;
|
display: none;
|
||||||
|
|||||||
@@ -4,7 +4,6 @@
|
|||||||
<!--
|
<!--
|
||||||
var install_is_done = '<?php echo addslashes($this->l('Done!')) ?>';
|
var install_is_done = '<?php echo addslashes($this->l('Done!')) ?>';
|
||||||
var process_steps = <?php echo Tools::jsonEncode($this->process_steps) ?>;
|
var process_steps = <?php echo Tools::jsonEncode($this->process_steps) ?>;
|
||||||
var process_percent = <?php echo 100 / count($this->process_steps) ?>;
|
|
||||||
-->
|
-->
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user