[*] CORE : Remove duplicate SQL queries
This commit is contained in:
+12
-6
@@ -54,12 +54,18 @@ class ZoneCore extends ObjectModel
|
||||
*/
|
||||
public static function getZones($active = false)
|
||||
{
|
||||
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'zone`
|
||||
'.($active ? 'WHERE active = 1' : '').'
|
||||
ORDER BY `name` ASC
|
||||
');
|
||||
$cache_id = __CLASS__.__FUNCTION__.(bool)$active;
|
||||
if (!Cache::isStored($cache_id))
|
||||
{
|
||||
$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS('
|
||||
SELECT *
|
||||
FROM `'._DB_PREFIX_.'zone`
|
||||
'.($active ? 'WHERE active = 1' : '').'
|
||||
ORDER BY `name` ASC
|
||||
');
|
||||
Cache::store($cache_id, $result);
|
||||
}
|
||||
return Cache::retrieve($cache_id);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user