Merge branch 'development' of https://github.com/PrestaShop/PrestaShop into development
This commit is contained in:
commit
75942074d2
11 files changed
+55
-69
No files matched your search
+9
-14
@@ -831,20 +831,15 @@ class CategoryCore extends ObjectModel
|
|||||||
if (!Validate::isUnsignedId($id_category) || !Validate::isUnsignedId($id_lang))
|
if (!Validate::isUnsignedId($id_category) || !Validate::isUnsignedId($id_lang))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (isset(self::$_links[$id_category.'-'.$id_lang]))
|
if (!isset(self::$_links[$id_category.'-'.$id_lang]))
|
||||||
return self::$_links[$id_category.'-'.$id_lang];
|
self::$_links[$id_category.'-'.$id_lang] = Db::getInstance()->getValue('
|
||||||
|
SELECT cl.`link_rewrite`
|
||||||
$result = Db::getInstance()->getRow('
|
FROM `'._DB_PREFIX_.'category_lang` cl
|
||||||
SELECT cl.`link_rewrite`
|
WHERE `id_lang` = '.(int)$id_lang.'
|
||||||
FROM `'._DB_PREFIX_.'category_lang` cl
|
'.Shop::addSqlRestrictionOnLang('cl').'
|
||||||
WHERE `id_lang` = '.(int)$id_lang.'
|
AND cl.`id_category` = '.(int)$id_category
|
||||||
'.Shop::addSqlRestrictionOnLang('cl').'
|
);
|
||||||
AND cl.`id_category` = '.(int)$id_category
|
return self::$_links[$id_category.'-'.$id_lang];
|
||||||
);
|
|
||||||
|
|
||||||
self::$_links[$id_category.'-'.$id_lang] = $result['link_rewrite'];
|
|
||||||
|
|
||||||
return $result['link_rewrite'];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getLink(Link $link = null)
|
public function getLink(Link $link = null)
|
||||||
|
|||||||
+12
-9
@@ -684,17 +684,20 @@ class ToolsCore
|
|||||||
if ($files = scandir($dirname))
|
if ($files = scandir($dirname))
|
||||||
{
|
{
|
||||||
foreach ($files as $file)
|
foreach ($files as $file)
|
||||||
if ($file != '.' && $file != '..' && $file != '.svn')
|
if ($file != '.' && $file != '..' && $file != '.svn')
|
||||||
{
|
{
|
||||||
if (is_dir($dirname.$file))
|
if (is_dir($dirname.$file))
|
||||||
Tools::deleteDirectory($dirname.$file, true);
|
Tools::deleteDirectory($dirname.$file, true);
|
||||||
elseif (file_exists($dirname.$file))
|
elseif (file_exists($dirname.$file))
|
||||||
unlink($dirname.$file);
|
unlink($dirname.$file);
|
||||||
}
|
}
|
||||||
if ($delete_self)
|
if ($delete_self)
|
||||||
rmdir($dirname);
|
if (!rmdir($dirname))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
}
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Display an error according to an error code
|
* Display an error according to an error code
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function add_order_reference_in_order_payment()
|
|||||||
ON o.id_order = op.id_order');
|
ON o.id_order = op.id_order');
|
||||||
|
|
||||||
if (!is_object($payments))
|
if (!is_object($payments))
|
||||||
return false;
|
return true;
|
||||||
|
|
||||||
$errors = array();
|
$errors = array();
|
||||||
// Populate "order_reference"
|
// Populate "order_reference"
|
||||||
@@ -62,7 +62,7 @@ function add_order_reference_in_order_payment()
|
|||||||
HAVING COUNT(*) > 1');
|
HAVING COUNT(*) > 1');
|
||||||
|
|
||||||
if (!is_object($duplicate_lines))
|
if (!is_object($duplicate_lines))
|
||||||
return false;
|
return true;
|
||||||
|
|
||||||
$order_payments_to_remove = array();
|
$order_payments_to_remove = array();
|
||||||
while ($order_payments = Db::getInstance()->nextRow($duplicate_lines))
|
while ($order_payments = Db::getInstance()->nextRow($duplicate_lines))
|
||||||
|
|||||||
@@ -312,9 +312,6 @@ PRIMARY KEY (`id_scene`, `id_shop`),
|
|||||||
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
) ENGINE=ENGINE_TYPE DEFAULT CHARSET=utf8;
|
||||||
INSERT INTO `PREFIX_scene_shop` (id_shop, id_scene) (SELECT 1, id_scene FROM PREFIX_scene);
|
INSERT INTO `PREFIX_scene_shop` (id_shop, id_scene) (SELECT 1, id_scene FROM PREFIX_scene);
|
||||||
|
|
||||||
ALTER TABLE `PREFIX_delivery` ADD `id_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_delivery`;
|
|
||||||
ALTER TABLE `PREFIX_delivery` ADD `id_group_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_shop`;
|
|
||||||
|
|
||||||
/* PHP:create_multistore(); */;
|
/* PHP:create_multistore(); */;
|
||||||
|
|
||||||
UPDATE `PREFIX_customization` INNER JOIN `PREFIX_orders` USING(id_cart) SET in_cart = 1;
|
UPDATE `PREFIX_customization` INNER JOIN `PREFIX_orders` USING(id_cart) SET in_cart = 1;
|
||||||
@@ -1,5 +1,8 @@
|
|||||||
SET NAMES 'utf8';
|
SET NAMES 'utf8';
|
||||||
|
|
||||||
|
ALTER TABLE `PREFIX_delivery` ADD `id_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_delivery`;
|
||||||
|
ALTER TABLE `PREFIX_delivery` ADD `id_group_shop` INT UNSIGNED NULL DEFAULT NULL AFTER `id_shop`;
|
||||||
|
|
||||||
CREATE TABLE IF NOT EXISTS `PREFIX_module_access` (
|
CREATE TABLE IF NOT EXISTS `PREFIX_module_access` (
|
||||||
`id_profile` int(10) unsigned NOT NULL,
|
`id_profile` int(10) unsigned NOT NULL,
|
||||||
`id_module` int(10) unsigned NOT NULL,
|
`id_module` int(10) unsigned NOT NULL,
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('_PS_VERSION_'))
|
|
||||||
exit;
|
|
||||||
|
|
||||||
function upgrade_module_1_2($object)
|
|
||||||
{
|
|
||||||
return ($object->registerHook('actionObjectCmsUpdateAfter') && $object->registerHook('actionObjectCmsDeleteAfter'));
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('_PS_VERSION_'))
|
|
||||||
exit;
|
|
||||||
|
|
||||||
function upgrade_module_1_0($object)
|
|
||||||
{
|
|
||||||
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct'));
|
|
||||||
}
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('_PS_VERSION_'))
|
|
||||||
exit;
|
|
||||||
|
|
||||||
function upgrade_module_1_0($object)
|
|
||||||
{
|
|
||||||
Configuration::updateValue('BLOCKSPECIALS_NB_CACHES', 20);
|
|
||||||
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct'));
|
|
||||||
}
|
|
||||||
@@ -96,7 +96,6 @@
|
|||||||
height:20px;
|
height:20px;
|
||||||
width:288px;
|
width:288px;
|
||||||
border:1px solid #ccc;
|
border:1px solid #ccc;
|
||||||
background:url(../img/bg_input.png) repeat-x 0 0 #fff
|
|
||||||
}
|
}
|
||||||
#module-blockwishlist-mywishlist #mywishlist p.submit {
|
#module-blockwishlist-mywishlist #mywishlist p.submit {
|
||||||
margin-right:25px;
|
margin-right:25px;
|
||||||
|
|||||||
@@ -1,9 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
if (!defined('_PS_VERSION_'))
|
|
||||||
exit;
|
|
||||||
|
|
||||||
function upgrade_module_1_0($object)
|
|
||||||
{
|
|
||||||
return ($object->registerHook('addproduct') && $object->registerHook('updateproduct') && $object->registerHook('deleteproduct'));
|
|
||||||
}
|
|
||||||
@@ -101,6 +101,16 @@ abstract class Controller extends ControllerCore
|
|||||||
return '<span style="color:green">'.round($n, 2).' Mb</span>';
|
return '<span style="color:green">'.round($n, 2).' Mb</span>';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private function displayPeakMemoryColor($n)
|
||||||
|
{
|
||||||
|
$n /= 1048576;
|
||||||
|
if ($n > 16)
|
||||||
|
return '<span style="color:red">'.round($n, 1).' Mb</span>';
|
||||||
|
if ($n > 12)
|
||||||
|
return '<span style="color:orange">'.round($n, 1).' Mb</span>';
|
||||||
|
return '<span style="color:green">'.round($n, 1).' Mb</span>';
|
||||||
|
}
|
||||||
|
|
||||||
private function displaySQLQueries($n)
|
private function displaySQLQueries($n)
|
||||||
{
|
{
|
||||||
if ($n > 150)
|
if ($n > 150)
|
||||||
@@ -178,10 +188,12 @@ abstract class Controller extends ControllerCore
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
$this->_memory['config'] = memory_get_usage();
|
$this->_memory['config'] = memory_get_usage();
|
||||||
|
$this->_mempeak['config'] = memory_get_peak_usage();
|
||||||
$this->_time['config'] = microtime(true);
|
$this->_time['config'] = microtime(true);
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
$this->_memory['constructor'] = memory_get_usage();
|
$this->_memory['constructor'] = memory_get_usage();
|
||||||
|
$this->_mempeak['constructor'] = memory_get_peak_usage();
|
||||||
$this->_time['constructor'] = microtime(true);
|
$this->_time['constructor'] = microtime(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -189,21 +201,25 @@ abstract class Controller extends ControllerCore
|
|||||||
{
|
{
|
||||||
$this->init();
|
$this->init();
|
||||||
$this->_memory['init'] = memory_get_usage();
|
$this->_memory['init'] = memory_get_usage();
|
||||||
|
$this->_mempeak['init'] = memory_get_peak_usage();
|
||||||
$this->_time['init'] = microtime(true);
|
$this->_time['init'] = microtime(true);
|
||||||
|
|
||||||
if ($this->checkAccess())
|
if ($this->checkAccess())
|
||||||
{
|
{
|
||||||
$this->_memory['checkAccess'] = memory_get_usage();
|
$this->_memory['checkAccess'] = memory_get_usage();
|
||||||
|
$this->_mempeak['checkAccess'] = memory_get_peak_usage();
|
||||||
$this->_time['checkAccess'] = microtime(true);
|
$this->_time['checkAccess'] = microtime(true);
|
||||||
|
|
||||||
if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
|
if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
|
||||||
$this->setMedia();
|
$this->setMedia();
|
||||||
$this->_memory['setMedia'] = memory_get_usage();
|
$this->_memory['setMedia'] = memory_get_usage();
|
||||||
|
$this->_mempeak['setMedia'] = memory_get_peak_usage();
|
||||||
$this->_time['setMedia'] = microtime(true);
|
$this->_time['setMedia'] = microtime(true);
|
||||||
|
|
||||||
// postProcess handles ajaxProcess
|
// postProcess handles ajaxProcess
|
||||||
$this->postProcess();
|
$this->postProcess();
|
||||||
$this->_memory['postProcess'] = memory_get_usage();
|
$this->_memory['postProcess'] = memory_get_usage();
|
||||||
|
$this->_mempeak['postProcess'] = memory_get_peak_usage();
|
||||||
$this->_time['postProcess'] = microtime(true);
|
$this->_time['postProcess'] = microtime(true);
|
||||||
|
|
||||||
if (!empty($this->redirect_after))
|
if (!empty($this->redirect_after))
|
||||||
@@ -212,15 +228,18 @@ abstract class Controller extends ControllerCore
|
|||||||
if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
|
if (!$this->content_only && ($this->display_header || (isset($this->className) && $this->className)))
|
||||||
$this->initHeader();
|
$this->initHeader();
|
||||||
$this->_memory['initHeader'] = memory_get_usage();
|
$this->_memory['initHeader'] = memory_get_usage();
|
||||||
|
$this->_mempeak['initHeader'] = memory_get_peak_usage();
|
||||||
$this->_time['initHeader'] = microtime(true);
|
$this->_time['initHeader'] = microtime(true);
|
||||||
|
|
||||||
$this->initContent();
|
$this->initContent();
|
||||||
$this->_memory['initContent'] = memory_get_usage();
|
$this->_memory['initContent'] = memory_get_usage();
|
||||||
|
$this->_mempeak['initContent'] = memory_get_peak_usage();
|
||||||
$this->_time['initContent'] = microtime(true);
|
$this->_time['initContent'] = microtime(true);
|
||||||
|
|
||||||
if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className)))
|
if (!$this->content_only && ($this->display_footer || (isset($this->className) && $this->className)))
|
||||||
$this->initFooter();
|
$this->initFooter();
|
||||||
$this->_memory['initFooter'] = memory_get_usage();
|
$this->_memory['initFooter'] = memory_get_usage();
|
||||||
|
$this->_mempeak['initFooter'] = memory_get_peak_usage();
|
||||||
$this->_time['initFooter'] = microtime(true);
|
$this->_time['initFooter'] = microtime(true);
|
||||||
|
|
||||||
// default behavior for ajax process is to use $_POST[action] or $_GET[action]
|
// default behavior for ajax process is to use $_POST[action] or $_GET[action]
|
||||||
@@ -264,7 +283,11 @@ abstract class Controller extends ControllerCore
|
|||||||
private function sizeofvar($var)
|
private function sizeofvar($var)
|
||||||
{
|
{
|
||||||
$start_memory = memory_get_usage();
|
$start_memory = memory_get_usage();
|
||||||
$tmp = Tools::unSerialize(serialize($var));
|
try {
|
||||||
|
$tmp = Tools::unSerialize(serialize($var));
|
||||||
|
} catch (Exception $e) {
|
||||||
|
$tmp = strlen((string)$var);
|
||||||
|
}
|
||||||
$size = memory_get_usage() - $start_memory;
|
$size = memory_get_usage() - $start_memory;
|
||||||
return $size;
|
return $size;
|
||||||
}
|
}
|
||||||
@@ -275,11 +298,14 @@ abstract class Controller extends ControllerCore
|
|||||||
|
|
||||||
$this->display();
|
$this->display();
|
||||||
$this->_memory['display'] = memory_get_usage();
|
$this->_memory['display'] = memory_get_usage();
|
||||||
|
$this->_mempeak['display'] = memory_get_peak_usage();
|
||||||
$this->_time['display'] = microtime(true);
|
$this->_time['display'] = microtime(true);
|
||||||
|
|
||||||
if (!$this->ini_get_display_errors())
|
if (!$this->ini_get_display_errors())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
$memory_peak_usage = memory_get_peak_usage();
|
||||||
|
|
||||||
$hr = '<hr style="color:#F5F5F5;margin:2px" />';
|
$hr = '<hr style="color:#F5F5F5;margin:2px" />';
|
||||||
|
|
||||||
$totalSize = 0;
|
$totalSize = 0;
|
||||||
@@ -337,14 +363,14 @@ abstract class Controller extends ControllerCore
|
|||||||
echo '</ul>
|
echo '</ul>
|
||||||
</div>
|
</div>
|
||||||
<div class="rte" style="text-align:left;padding:8px;float:left;margin-left:20px">
|
<div class="rte" style="text-align:left;padding:8px;float:left;margin-left:20px">
|
||||||
<b>Memory peak usage</b>: '.$this->displayMemoryColor(memory_get_peak_usage());
|
<b>Memory peak usage</b>: '.$this->displayPeakMemoryColor($memory_peak_usage);
|
||||||
if (self::$_footer)
|
if (self::$_footer)
|
||||||
{
|
{
|
||||||
echo '<ul>';
|
echo '<ul>';
|
||||||
$last_memory = 0;
|
$last_memory = 0;
|
||||||
foreach ($this->_memory as $k => $memory)
|
foreach ($this->_memory as $k => $memory)
|
||||||
{
|
{
|
||||||
echo '<li>'.$k.': '.$this->displayMemoryColor($memory - $last_memory).'</li>';
|
echo '<li>'.$k.': '.$this->displayMemoryColor($memory - $last_memory).' ('.$this->displayPeakMemoryColor($this->_mempeak[$k]).')</li>';
|
||||||
$last_memory = $memory;
|
$last_memory = $memory;
|
||||||
}
|
}
|
||||||
echo '</ul>';
|
echo '</ul>';
|
||||||
|
|||||||
Reference in new issue
Block a user