[+] Project : adding Features detachables in order to improve performance

// clean code
This commit is contained in:
aFolletete
2011-09-03 17:21:32 +00:00
parent a4491c9897
commit 230bebc7c7
51 changed files with 1081 additions and 419 deletions
+18 -2
View File
@@ -59,6 +59,7 @@ class GroupCore extends ObjectModel
protected static $_cacheReduction = array();
protected static $_groupPriceDisplayMethod = array();
protected static $feature_active = null;
protected $webserviceParameters = array();
@@ -127,7 +128,7 @@ class GroupCore extends ObjectModel
self::$_cacheReduction['group'][$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `reduction`
FROM `'._DB_PREFIX_.'group`
WHERE `id_group` = '.$id_group);
WHERE `id_group` = '.(int)$id_group);
}
return self::$_cacheReduction['group'][$id_group];
}
@@ -138,7 +139,7 @@ class GroupCore extends ObjectModel
self::$_groupPriceDisplayMethod[$id_group] = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT `price_display_method`
FROM `'._DB_PREFIX_.'group`
WHERE `id_group` = '.(int)($id_group));
WHERE `id_group` = '.(int)$id_group);
return self::$_groupPriceDisplayMethod[$id_group];
}
@@ -167,6 +168,21 @@ class GroupCore extends ObjectModel
}
return false;
}
/**
* This method is allow to know if a feature is used or active
* @since 1.5.0.1
* @return bool
*/
public static function isFeatureActive()
{
if (self::$feature_active === null)
self::$feature_active = (Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'group`
') > 1);
return self::$feature_active;
}
}