[+] CORE : Fixed cache_id

This commit is contained in:
gRoussac
2013-11-12 17:09:38 +01:00
parent fc193d5c8b
commit 036e2362c9
16 changed files with 34 additions and 34 deletions
+2 -2
View File
@@ -264,7 +264,7 @@ class AddressCore extends ObjectModel
if(!isset($id_address) || empty($id_address))
return false;
$cache_id = __CLASS__.__FUNCTION__.(int)$id_address;
$cache_id = 'Address::isCountryActiveById_'.(int)$id_address;
if (!Cache::isStored($cache_id))
{
$result = (bool)Db::getInstance(_PS_USE_SQL_SLAVE_)->getvalue('
@@ -328,7 +328,7 @@ class AddressCore extends ObjectModel
{
if (!$id_customer)
return false;
$cache_id = __CLASS__.__FUNCTION__.(int)$id_customer.'-'.(bool)$active;
$cache_id = 'Address::getFirstCustomerAddressId_'.(int)$id_customer.'-'.(bool)$active;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
+4 -4
View File
@@ -277,7 +277,7 @@ class CarrierCore extends ObjectModel
public function getMaxDeliveryPriceByWeight($id_zone)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id.'-'.(int)$id_zone;
$cache_id = 'Carrier::getMaxDeliveryPriceByWeight_'.(int)$this->id.'-'.(int)$id_zone;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT d.`price`
@@ -360,7 +360,7 @@ class CarrierCore extends ObjectModel
public function getMaxDeliveryPriceByPrice($id_zone)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id.'-'.(int)$id_zone;
$cache_id = 'Carrier::getMaxDeliveryPriceByPrice_'.(int)$this->id.'-'.(int)$id_zone;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT d.`price`
@@ -455,7 +455,7 @@ class CarrierCore extends ObjectModel
GROUP BY c.`id_carrier`
ORDER BY c.`position` ASC';
$cache_id = __CLASS__.__FUNCTION__.md5($sql);
$cache_id = 'Carrier::getCarriers_'.md5($sql);
if (!Cache::isStored($cache_id))
{
$carriers = Db::getInstance()->executeS($sql);
@@ -1211,7 +1211,7 @@ class CarrierCore extends ObjectModel
$query->where('pc.id_product = '.(int)$product->id);
$query->where('pc.id_shop = '.(int)$id_shop);
$cache_id = __CLASS__.__FUNCTION__.(int)$product->id.'-'.(int)$id_shop;
$cache_id = 'Carrier::getAvailableCarrierList_'.(int)$product->id.'-'.(int)$id_shop;
if (!Cache::isStored($cache_id))
{
$carriers_for_product = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
+4 -4
View File
@@ -325,7 +325,7 @@ class CartCore extends ObjectModel
if (!CartRule::isFeatureActive() || !$this->id)
return array();
$cache_key = __CLASS__.__FUNCTION__.$this->id.'-'.$filter;
$cache_key = 'Cart::getCartRules_'.$this->id.'-'.$filter;
if (!Cache::isStored($cache_key))
{
$result = Db::getInstance()->executeS('
@@ -368,7 +368,7 @@ class CartCore extends ObjectModel
{
if (!CartRule::isFeatureActive())
return 0;
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id.'-'.(int)$id_cart_rule;
$cache_id = 'Cart::getDiscountsCustomer_'.(int)$this->id.'-'.(int)$id_cart_rule;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('
@@ -636,7 +636,7 @@ class CartCore extends ObjectModel
if (!isset($row['pai_id_image']) || $row['pai_id_image'] == 0)
{
$cache_id = __CLASS__.__FUNCTION__.'-pai_id_image-'.(int)$row['id_product'].'-'.(int)$this->id_lang.'-'.(int)$row['id_shop'];
$cache_id = 'Cart::getProducts_'.'-pai_id_image-'.(int)$row['id_product'].'-'.(int)$this->id_lang.'-'.(int)$row['id_shop'];
if (!Cache::isStored($cache_id))
{
$row2 = Db::getInstance()->getRow('
@@ -1104,7 +1104,7 @@ class CartCore extends ObjectModel
*/
public function orderExists()
{
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id;
$cache_id = 'Cart::orderExists_'.(int)$this->id;
if (!Cache::isStored($cache_id))
{
$result = (bool)Db::getInstance()->getValue('SELECT count(*) FROM `'._DB_PREFIX_.'orders` WHERE `id_cart` = '.(int)$this->id);
+6 -6
View File
@@ -704,7 +704,7 @@ class CategoryCore extends ObjectModel
if (!Validate::isBool($active))
die(Tools::displayError());
$cache_id = __CLASS__.__FUNCTION__.(int)$id_parent.'-'.(int)$id_lang.'-'.(bool)$active.'-'.(int)$id_shop;
$cache_id = 'Category::getChildren_'.(int)$id_parent.'-'.(int)$id_lang.'-'.(bool)$active.'-'.(int)$id_shop;
if (!Cache::isStored($cache_id))
{
$query = 'SELECT c.`id_category`, cl.`name`, cl.`link_rewrite`, category_shop.`id_shop`
@@ -1014,7 +1014,7 @@ class CategoryCore extends ObjectModel
public function getGroups()
{
$groups = array();
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id;
$cache_id = 'Category::getGroups_'.(int)$this->id;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance()->executeS('
@@ -1048,7 +1048,7 @@ class CategoryCore extends ObjectModel
*/
public function checkAccess($id_customer)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id.'-'.$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : '');
$cache_id = 'Category::checkAccess_'.(int)$this->id.'-'.$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : '');
if (!Cache::isStored($cache_id))
{
if (!$id_customer)
@@ -1210,7 +1210,7 @@ class CategoryCore extends ObjectModel
*/
public static function getInterval($id)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$id;
$cache_id = 'Category::getInterval_'.(int)$id;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT nleft, nright, level_depth
@@ -1401,7 +1401,7 @@ class CategoryCore extends ObjectModel
public static function getCategoriesWithoutParent()
{
$cache_id = __CLASS__.__FUNCTION__.(int)Context::getContext()->language->id;
$cache_id = 'Category::getCategoriesWithoutParent_'.(int)Context::getContext()->language->id;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
@@ -1431,7 +1431,7 @@ class CategoryCore extends ObjectModel
{
if (is_null($id_lang))
$id_lang = (int)Context::getContext()->language->id;
$cache_id = __CLASS__.__FUNCTION__.(int)$id_lang;
$cache_id = 'Category::getTopCategory_'.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
$id_category = (int)Db::getInstance()->getValue('
+1 -1
View File
@@ -362,7 +362,7 @@ class CustomerCore extends ObjectModel
{
if (!Validate::isUnsignedId($id_customer))
return true;
$cache_id = __CLASS__.__FUNCTION__.(int)$id_customer;
$cache_id = 'Customer::isBanned_'.(int)$id_customer;
if (!Cache::isStored($cache_id))
{
$result = (bool)!Db::getInstance(_PS_USE_SQL_SLAVE_)->getRow('
+4 -4
View File
@@ -2440,7 +2440,7 @@ class ProductCore extends ObjectModel
{
if (!$context)
$context = Context::getContext();
$cache_id = __CLASS__.__FUNCTION__.(int)$id_product.'-'.(int)$context->shop->id;
$cache_id = 'Product::getOrderStates_'.(int)$id_product.'-'.(int)$context->shop->id;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT image_shop.`id_image`
@@ -2513,7 +2513,7 @@ class ProductCore extends ObjectModel
$cart_quantity = 0;
if ((int)$id_cart)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$id_product.'-'.(int)$id_cart;
$cache_id = 'Product::getPriceStatic_'.(int)$id_product.'-'.(int)$id_cart;
if (!Cache::isStored($cache_id))
{
$sql = 'SELECT SUM(`quantity`)
@@ -4313,7 +4313,7 @@ class ProductCore extends ObjectModel
public function checkAccess($id_customer)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id.'-'.(int)$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : '');
$cache_id = 'Product::checkAccess_'.(int)$this->id.'-'.(int)$id_customer.(!$id_customer ? '-'.(int)Group::getCurrent()->id : '');
if (!Cache::isStored($cache_id))
{
if (!$id_customer)
@@ -4893,7 +4893,7 @@ class ProductCore extends ObjectModel
{
$id_lang = (int)Context::getContext()->language->id;
$id_shop = (int)Context::getContext()->shop->id;
$cache_id = __CLASS__.__FUNCTION__.(int)$id_product.'-'.(int)$id_product_attribute.'-'.(int)$id_lang.'-'.(int)$id_shop;
$cache_id = 'Product::getAttributesParams_'.(int)$id_product.'-'.(int)$id_product_attribute.'-'.(int)$id_lang.'-'.(int)$id_shop;
// if blocklayered module is installed we check if user has set custom attribute name
if (Module::isInstalled('blocklayered') && Module::isEnabled('blocklayered'))
+2 -2
View File
@@ -82,7 +82,7 @@ class StateCore extends ObjectModel
{
if (!$id_state)
return false;
$cache_id = __CLASS__.__FUNCTION__.(int)$id_state;
$cache_id = 'State::getNameById_'.(int)$id_state;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
@@ -105,7 +105,7 @@ class StateCore extends ObjectModel
{
if (empty($state))
return false;
$cache_id = __CLASS__.__FUNCTION__.pSQL($state);
$cache_id = 'State::getNameById_'.pSQL($state);
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('
+1 -1
View File
@@ -190,7 +190,7 @@ class TabCore extends ObjectModel
*/
public static function getTab($id_lang, $id_tab)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$id_lang.'-'.(int)$id_tab;
$cache_id = 'Tab::getTab_'.(int)$id_lang.'-'.(int)$id_tab;
if (!Cache::isStored($cache_id))
{
/* Tabs selection */
+1 -1
View File
@@ -54,7 +54,7 @@ class ZoneCore extends ObjectModel
*/
public static function getZones($active = false)
{
$cache_id = __CLASS__.__FUNCTION__.(bool)$active;
$cache_id = 'Zone::getZones_'.(bool)$active;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
+1 -1
View File
@@ -1864,7 +1864,7 @@ abstract class ModuleCore
*/
public static function getModuleIdByName($name)
{
$cache_id = __CLASS__.__FUNCTION__.pSQL($name);
$cache_id = 'Module::getModuleIdByName_'.pSQL($name);
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('SELECT `id_module` FROM `'._DB_PREFIX_.'module` WHERE `name` = "'.pSQL($name).'"');
+1 -1
View File
@@ -721,7 +721,7 @@ class OrderCore extends ObjectModel
public static function getDiscountsCustomer($id_customer, $id_cart_rule)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$id_customer.'-'.(int)$id_cart_rule;
$cache_id = 'Order::getDiscountsCustomer_'.(int)$id_customer.'-'.(int)$id_cart_rule;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('
+1 -1
View File
@@ -112,7 +112,7 @@ class OrderStateCore extends ObjectModel
*/
public static function getOrderStates($id_lang)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$id_lang;
$cache_id = 'OrderState::getOrderStates_'.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
+1 -1
View File
@@ -187,7 +187,7 @@ class ShopCore extends ObjectModel
public function setUrl()
{
$cache_id = __CLASS__.__FUNCTION__.(int)$this->id;
$cache_id = 'Shop::setUrl_'.(int)$this->id;
if (!Cache::isStored($cache_id))
{
$row = Db::getInstance()->getRow('
+1 -1
View File
@@ -124,7 +124,7 @@ class TaxRuleCore extends ObjectModel
*/
public static function isTaxInUse($id_tax)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$id_tax;
$cache_id = 'TaxRule::isTaxInUse_'.(int)$id_tax;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance()->getValue('SELECT COUNT(*) FROM `'._DB_PREFIX_.'tax_rule` WHERE `id_tax` = '.(int)$id_tax);
+3 -3
View File
@@ -97,7 +97,7 @@ class ProductComment extends ObjectModel
if ($n != null && $n <= 0)
$n = 5;
$cache_id = __CLASS__.__FUNCTION__.(int)$id_product.'-'.(int)$p.'-'.(int)$n.'-'.(int)$id_customer.'-'.(bool)$validate;
$cache_id = 'ProductComment::getByProduct_'.(int)$id_product.'-'.(int)$p.'-'.(int)$n.'-'.(int)$id_customer.'-'.(bool)$validate;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
@@ -124,7 +124,7 @@ class ProductComment extends ObjectModel
*/
public static function getByCustomer($id_product, $id_customer, $get_last = false, $id_guest = false)
{
$cache_id = __CLASS__.__FUNCTION__.(int)$id_product.'-'.(int)$id_customer.'-'.(bool)$get_last.'-'.(int)$id_guest;
$cache_id = 'ProductComment::getByCustomer_'.(int)$id_product.'-'.(int)$id_customer.'-'.(bool)$get_last.'-'.(int)$id_guest;
if (!Cache::isStored($cache_id))
{
$results = Db::getInstance()->executeS('
@@ -214,7 +214,7 @@ class ProductComment extends ObjectModel
if (!Validate::isUnsignedId($id_product))
die(Tools::displayError());
$validate = (int)Configuration::get('PRODUCT_COMMENTS_MODERATE');
$cache_id = __CLASS__.__FUNCTION__.(int)$id_product.'-'.$validate;
$cache_id = 'ProductComment::getCommentNumber_'.(int)$id_product.'-'.$validate;
if (!Cache::isStored($cache_id))
{
$result = (int)Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue('
@@ -160,7 +160,7 @@ class ProductCommentCriterion extends ObjectModel
$alias = 'ps';
}
$cache_id = __CLASS__.__FUNCTION__.(int)$id_product.'-'.(int)$id_lang;
$cache_id = 'ProductCommentCriterion::getByProduct_'.(int)$id_product.'-'.(int)$id_lang;
if (!Cache::isStored($cache_id))
{
$result = Db::getInstance()->executeS('