// Some memory optimizations in installer
This commit is contained in:
@@ -307,6 +307,7 @@ class InstallXmlLoader
|
|||||||
}
|
}
|
||||||
|
|
||||||
$this->flushDelayedInserts();
|
$this->flushDelayedInserts();
|
||||||
|
unset($this->cache_xml_entity[$this->path_type][$entity]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -350,11 +351,7 @@ class InstallXmlLoader
|
|||||||
*/
|
*/
|
||||||
protected function loadEntity($entity, $iso = null)
|
protected function loadEntity($entity, $iso = null)
|
||||||
{
|
{
|
||||||
$cache_id = $entity;
|
if (!isset($this->cache_xml_entity[$this->path_type][$entity][$iso]))
|
||||||
if ($iso)
|
|
||||||
$cache_id .= ':'.$iso;
|
|
||||||
|
|
||||||
if (!isset($this->cache_xml_entity[$this->path_type][$cache_id]))
|
|
||||||
{
|
{
|
||||||
$path = $this->data_path.$entity.'.xml';
|
$path = $this->data_path.$entity.'.xml';
|
||||||
if ($iso)
|
if ($iso)
|
||||||
@@ -363,11 +360,11 @@ class InstallXmlLoader
|
|||||||
if (!file_exists($path))
|
if (!file_exists($path))
|
||||||
throw new PrestashopInstallerException('XML data file '.$entity.'.xml not found');
|
throw new PrestashopInstallerException('XML data file '.$entity.'.xml not found');
|
||||||
|
|
||||||
if (!$this->cache_xml_entity[$this->path_type][$cache_id] = @simplexml_load_file($path, 'InstallSimplexmlElement'))
|
if (!$this->cache_xml_entity[$this->path_type][$entity][$iso] = @simplexml_load_file($path, 'InstallSimplexmlElement'))
|
||||||
throw new PrestashopInstallerException('XML data file '.$entity.'.xml invalid');
|
throw new PrestashopInstallerException('XML data file '.$entity.'.xml invalid');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->cache_xml_entity[$this->path_type][$cache_id];
|
return $this->cache_xml_entity[$this->path_type][$entity][$iso];
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -426,6 +423,7 @@ class InstallXmlLoader
|
|||||||
$object->hydrate($data_lang);
|
$object->hydrate($data_lang);
|
||||||
$object->add(true, (isset($xml->fields['null'])) ? true : false);
|
$object->add(true, (isset($xml->fields['null'])) ? true : false);
|
||||||
$entity_id = $object->id;
|
$entity_id = $object->id;
|
||||||
|
unset($object);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -436,6 +434,7 @@ class InstallXmlLoader
|
|||||||
$primary = 'id_'.$entity;
|
$primary = 'id_'.$entity;
|
||||||
else if (strpos((string)$xml->fields['primary'], ',') === false)
|
else if (strpos((string)$xml->fields['primary'], ',') === false)
|
||||||
$primary = (string)$xml->fields['primary'];
|
$primary = (string)$xml->fields['primary'];
|
||||||
|
unset($xml);
|
||||||
|
|
||||||
if ($primary)
|
if ($primary)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -176,6 +176,7 @@ class InstallModelInstall extends InstallAbstractModel
|
|||||||
|
|
||||||
// IDS from xmlLoader are stored in order to use them for fixtures
|
// IDS from xmlLoader are stored in order to use them for fixtures
|
||||||
$this->xml_loader_ids = $xml_loader->getIds();
|
$this->xml_loader_ids = $xml_loader->getIds();
|
||||||
|
unset($xml_loader);
|
||||||
|
|
||||||
// Install custom SQL data (db_data.sql file)
|
// Install custom SQL data (db_data.sql file)
|
||||||
if (file_exists(_PS_INSTALL_DATA_PATH_.'db_data.sql'))
|
if (file_exists(_PS_INSTALL_DATA_PATH_.'db_data.sql'))
|
||||||
|
|||||||
Reference in New Issue
Block a user