// Merg// Merge -> revision 8395

This commit is contained in:
rMalie
2011-09-07 16:23:13 +00:00
parent 3c9a1364e8
commit 714c65de56
27 changed files with 2801 additions and 617 deletions
+14 -2
View File
@@ -67,7 +67,16 @@ class AttributeGroupCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
return parent::add($autodate, true);
$return = parent::add($autodate, true);
Module::hookExec('afterSaveAttributeGroup', array('id_attribute_group' => $this->id));
return $return;
}
public function update($nullValues = false)
{
$return = parent::update($nullValues);
Module::hookExec('afterSaveAttributeGroup', array('id_attribute_group' => $this->id));
return $return;
}
/**
@@ -111,7 +120,10 @@ class AttributeGroupCore extends ObjectModel
/* Also delete related attributes */
if (Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'attribute_lang` WHERE `id_attribute` IN (SELECT id_attribute FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id).')') === false OR Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'attribute` WHERE `id_attribute_group` = '.(int)($this->id)) === false)
return false;
return parent::delete();
$return = parent::delete();
if($return)
Module::hookExec('afterDeleteAttributeGroup', array('id_attribute_group' => $this->id));
return $return;
}
/**
+8 -2
View File
@@ -111,7 +111,9 @@ class FeatureCore extends ObjectModel
public function add($autodate = true, $nullValues = false)
{
return parent::add($autodate, true);
$return = parent::add($autodate, true);
Module::hookExec('afterSaveFeature', array('id_feature' => $this->id));
return $return;
}
public function delete()
@@ -121,7 +123,10 @@ class FeatureCore extends ObjectModel
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'feature_value` WHERE `id_feature` = '.(int)($this->id));
/* Also delete related products */
Db::getInstance()->Execute('DELETE FROM `'._DB_PREFIX_.'feature_product` WHERE `id_feature` = '.(int)($this->id));
return parent::delete();
$return = parent::delete();
if($return)
Module::hookExec('afterDeleteFeature', array('id_feature' => $this->id));
return $return;
}
public function update($nullValues = false)
@@ -144,6 +149,7 @@ class FeatureCore extends ObjectModel
Db::getInstance()->AutoExecute(_DB_PREFIX_.$this->table.'_lang', $field, 'UPDATE', '`'.
pSQL($this->identifier).'` = '.(int)$this->id.' AND `id_lang` = '.(int)$field['id_lang']);
}
Module::hookExec('afterSaveFeature', array('id_feature' => $this->id));
return $result;
}
+16 -5
View File
@@ -27,7 +27,7 @@
class UpgraderCore{
const DEFAULT_CHECK_VERSION_DELAY_HOURS = 24;
private static $rss_version_link = 'http://www.prestashop.com/xml/version.xml';
public $rss_version_link = 'http://www.prestashop.com/xml/version.xml';
/**
* link contains hte url where to download the file
*
@@ -40,6 +40,8 @@ class UpgraderCore{
public $version_num;
public $link;
public $autoupgrade;
public $changelog;
public $md5;
public function __get($var)
{
@@ -96,20 +98,26 @@ class UpgraderCore{
$lastCheck = Configuration::get('PS_LAST_VERSION_CHECK');
// if we use the autoupgrade process, we will never refresh it
// except if no check has been done before
if (!($this->autoUpgrade AND $lastCheck) AND ($force OR ($lastCheck < time() - (3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS))) )
if ($force OR ($lastCheck < time() - (3600 * Upgrader::DEFAULT_CHECK_VERSION_DELAY_HOURS)) )
{
libxml_set_streams_context(stream_context_create(array('http' => array('timeout' => 3))));
if ($feed = @simplexml_load_file(self::$rss_version_link))
if ($feed = @simplexml_load_file($this->rss_version_link))
{
$this->version_name = (string)$feed->version->name;
$this->version_num = (string)$feed->version->num;
$this->link = (string)$feed->download->link;
$this->md5 = (string)$feed->download->md5;
$this->changelog = (string)$feed->download->changelog;
$this->autoupgrade = (int)$feed->autoupgrade;
$this->desc = (string)$feed->desc ;
$configLastVersion = array(
'name' => $this->version_name,
'num' => $this->version_num,
'link' => $this->link,
'autoupgrade' => $this->autoupgrade
'md5' => $this->md5,
'autoupgrade' => $this->autoupgrade,
'changelog' => $this->changelog,
'desc' => $this->desc
);
Configuration::updateValue('PS_LAST_VERSION',serialize($configLastVersion));
Configuration::updateValue('PS_LAST_VERSION_CHECK',time());
@@ -117,11 +125,14 @@ class UpgraderCore{
}
else
{
$lastVersionCheck = unserialize(Configuration::get('PS_LAST_VERSION'));
$lastVersionCheck = @unserialize(Configuration::get('PS_LAST_VERSION'));
$this->version_name = $lastVersionCheck['name'];
$this->version_num = $lastVersionCheck['num'];
$this->link = $lastVersionCheck['link'];
$this->autoupgrade = $lastVersionCheck['autoupgrade'];
$this->md5 = $lastVersionCheck['md5'];
$this->desc = $lastVersionCheck['desc'];
$this->changelog = $lastVersionCheck['changelog'];
}
}
// retro-compatibility :