Page MenuHomeIn-Portal Phabricator

D405.id1052.diff
No OneTemporary

File Metadata

Created
Wed, Feb 26, 8:59 AM

D405.id1052.diff

Index: branches/5.2.x/core/units/helpers/country_states_helper.php
===================================================================
--- branches/5.2.x/core/units/helpers/country_states_helper.php
+++ branches/5.2.x/core/units/helpers/country_states_helper.php
@@ -50,19 +50,21 @@
*/
function getCountriesWithStates()
{
- static $cache = null;
+ $cache_key = 'countries_with_states[%CountryStateSerial%]';
+ $cache_value = $this->Application->getCache($cache_key);
- if (!isset($cache)) {
+ if ( $cache_value === false ) {
$table_name = $this->Application->getUnitOption('country-state', 'TableName');
$sql = 'SELECT DISTINCT cname.IsoCode, cid.StateCountryId
FROM ' . $table_name . ' cid
JOIN ' . $table_name . ' cname ON cname.CountryStateId = cid.StateCountryId
WHERE cid.StateCountryId IS NOT NULL';
- $cache = $this->Conn->GetCol($sql, 'StateCountryId');
+ $cache_value = $this->Conn->GetCol($sql, 'StateCountryId');
+ $this->Application->setCache($cache_key, $cache_value);
}
- return $cache;
+ return $cache_value;
}
/**

Event Timeline