// MERGE with 1.4 r7770

This commit is contained in:
rMalie
2011-07-28 09:20:57 +00:00
parent 60b07cacb9
commit c17e7c236d
968 changed files with 26082 additions and 3937 deletions
+22 -9
View File
@@ -49,6 +49,9 @@ class ThemeInstallator extends Module
public function __construct()
{
set_time_limit(0);
ini_set('memory_limit', '2G');
$this->name = 'themeinstallator';
$this->version = '1.4';
$this->author = 'PrestaShop';
@@ -64,7 +67,7 @@ class ThemeInstallator extends Module
private function getTheNativeModules()
{
$xml = @simplexml_load_string(file_get_contents('http://www.prestashop.com/xml/modules_list.xml'));
$xml = simplexml_load_string(Tools::file_get_contents('http://www.prestashop.com/xml/modules_list.xml'));
$natives = array();
if ($xml)
foreach ($xml->modules as $row)
@@ -74,7 +77,7 @@ class ThemeInstallator extends Module
if (count($natives > 0))
return $natives;
// use this list if we can't contact the prestashop.com server
$natives = array('bankwire', 'birthdaypresent', 'blockadvertising', 'blockbestsellers', 'blockcart', 'blockcategories',
$natives = array('bankwire', 'birthdaypresent', 'blockadvertising', 'blockbestsellers', 'blockcart', 'blockcategories', 'blockcms',
'blockcurrencies', 'blockinfos', 'blocklanguages', 'blocklink', 'blockmanufacturer', 'blockmyaccount', 'blocknewproducts',
'blocknewsletter', 'blockpaymentlogo', 'blockpermanentlinks', 'blockrss', 'blocksearch', 'blockspecials', 'blocksupplier',
'blocktags', 'blockuserinfo', 'blockvariouslinks', 'blockviewed', 'blockwishlist', 'canonicalurl', 'cashondelivery', 'cheque',
@@ -89,21 +92,17 @@ class ThemeInstallator extends Module
}
private function deleteDirectory($dirname)
{
self::cleanDirectory($dirname);
rmdir($dirname);
}
private function cleanDirectory($dirname)
{
$files = scandir($dirname);
foreach ($files as $file)
if ($file != '.' AND $file != '..' AND $file != '.svn')
if ($file != '.' AND $file != '..')
{
if (is_dir($dirname.'/'.$file))
self::deleteDirectory($dirname.'/'.$file);
elseif (file_exists($dirname.'/'.$file))
unlink($dirname.'/'.$file);
}
rmdir($dirname);
}
private function recurseCopy($src, $dst)
@@ -149,7 +148,14 @@ class ThemeInstallator extends Module
private function deleteTmpFiles()
{
self::cleanDirectory(_IMPORT_FOLDER_);
if (file_exists(_IMPORT_FOLDER_.'doc'))
self::deleteDirectory(_IMPORT_FOLDER_.'doc');
if (file_exists(_IMPORT_FOLDER_.XMLFILENAME))
unlink(_IMPORT_FOLDER_.XMLFILENAME);
if (file_exists(_IMPORT_FOLDER_.'modules'))
self::deleteDirectory(_IMPORT_FOLDER_.'modules');
if (file_exists(_IMPORT_FOLDER_.'themes'))
self::deleteDirectory(_IMPORT_FOLDER_.'themes');
if (file_exists(_EXPORT_FOLDER_.'archive.zip'))
unlink(_EXPORT_FOLDER_.'archive.zip');
}
@@ -464,9 +470,16 @@ class ThemeInstallator extends Module
$count = -1;
while (isset($hookedModule[++$count]))
if ($hookedModule[$count] == $row)
{
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'hook_module` (`id_module`, `id_shop`, `id_hook`, `position`)
VALUES ('.(int)$obj->id.', '.$shopID.', '.(int)Hook::get($hook[$count]).', '.(int)$position[$count].')');
if ($exceptions[$count])
foreach ($exceptions[$count] as $file_name)
Db::getInstance()->Execute('
INSERT INTO `'._DB_PREFIX_.'hook_module_exceptions` (`id_module`, `id_hook`, `file_name`)
VALUES ('.(int)$obj->id.', '.(int)Hook::get($hook[$count]).', "'.pSQL($file_name).'")');
}
}
if (($val = (int)(Tools::getValue('nativeModules'))) != 1)
{