// Improve synchronize tool in new installer
git-svn-id: http://dev.prestashop.com/svn/v1/branches/1.5.x@11487 b9a71923-0436-4b27-9f14-aed3839534dd
This commit is contained in:
+28
-10
@@ -29,21 +29,21 @@ class SynchronizeController extends InstallControllerHttp
|
||||
$this->loader->setLanguages($languages);
|
||||
|
||||
if (Tools::getValue('submit'))
|
||||
$this->synchronizeDatabase();
|
||||
$this->generateSchemas();
|
||||
else if (Tools::getValue('synchronize'))
|
||||
$this->synchronizeEntities();
|
||||
|
||||
if ($this->type == 'demo')
|
||||
$this->loader->setFixturesPath();
|
||||
else
|
||||
$this->loader->setDefaultPath();
|
||||
$this->displayTemplate('index');
|
||||
}
|
||||
|
||||
public function synchronizeDatabase()
|
||||
public function generateSchemas()
|
||||
{
|
||||
if ($this->type == 'demo')
|
||||
{
|
||||
$this->loader->setDefaultPath();
|
||||
$this->loader->generateAllEntityFiles();
|
||||
$this->loader->setFixturesPath();
|
||||
}
|
||||
|
||||
$tables = isset($_POST['tables']) ? (array)$_POST['tables'] : array();
|
||||
$columns = isset($_POST['columns']) ? (array)$_POST['columns'] : array();
|
||||
@@ -52,6 +52,7 @@ class SynchronizeController extends InstallControllerHttp
|
||||
$primaries = isset($_POST['primary']) ? (array)$_POST['primary'] : array();
|
||||
$classes = isset($_POST['class']) ? (array)$_POST['class'] : array();
|
||||
$sqls = isset($_POST['sql']) ? (array)$_POST['sql'] : array();
|
||||
$orders = isset($_POST['order']) ? (array)$_POST['order'] : array();
|
||||
$images = isset($_POST['image']) ? (array)$_POST['image'] : array();
|
||||
|
||||
$entities = array();
|
||||
@@ -70,6 +71,9 @@ class SynchronizeController extends InstallControllerHttp
|
||||
if (isset($sqls[$table]) && $sqls[$table])
|
||||
$config['sql'] = $sqls[$table];
|
||||
|
||||
if (isset($orders[$table]) && $orders[$table])
|
||||
$config['ordersql'] = $orders[$table];
|
||||
|
||||
if (isset($images[$table]) && $images[$table])
|
||||
$config['image'] = $images[$table];
|
||||
|
||||
@@ -89,16 +93,30 @@ class SynchronizeController extends InstallControllerHttp
|
||||
'fields' => $fields,
|
||||
);
|
||||
}
|
||||
$this->loader->generateEntityFiles($entities);
|
||||
|
||||
if ($this->type != 'demo')
|
||||
foreach ($entities as $entity => $info)
|
||||
$this->loader->generateEntitySchema($entity, $info['fields'], $info['config']);
|
||||
|
||||
$this->errors = $this->loader->getErrors();
|
||||
}
|
||||
|
||||
public function synchronizeEntities()
|
||||
{
|
||||
$entities = Tools::getValue('entities');
|
||||
if (isset($entities['common']))
|
||||
{
|
||||
$this->loader->setDefaultPath();
|
||||
$this->loader->generateEntityFiles($entities['common']);
|
||||
}
|
||||
|
||||
if (isset($entities['fixture']))
|
||||
{
|
||||
$this->loader->setFixturesPath();
|
||||
$this->loader->generateAllEntityFiles();
|
||||
$this->loader->setDefaultPath();
|
||||
$this->loader->generateEntityFiles($entities['fixture']);
|
||||
}
|
||||
|
||||
$this->errors = $this->loader->getErrors();
|
||||
$this->loader->setDefaultPath();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user