Prechádzať zdrojové kódy

APC cache: fixed an issue with cache reset

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1167 a333f486-631f-4898-b8df-5754b55c2be0
romainq 14 rokov pred
rodič
commit
5da7f449f8
1 zmenil súbory, kde vykonal 13 pridanie a 4 odobranie
  1. 13 4
      core/metamodel.class.php

+ 13 - 4
core/metamodel.class.php

@@ -4130,9 +4130,14 @@ abstract class MetaModel
 		}
 	}
 
-	public static function GetCacheEntries($sAppIdentity)
+	public static function GetCacheEntries(Config $oConfig = null)
 	{
 		if (!function_exists('apc_cache_info')) return array();
+		if (is_null($oConfig))
+		{
+			$oConfig = self::GetConfig();
+		}
+		$sAppIdentity = $oConfig->Get('session_name');
 
 		$aCacheUserData = apc_cache_info('user');  
 		$sPrefix = $sAppIdentity.'-';
@@ -4150,14 +4155,18 @@ abstract class MetaModel
 		return $aEntries;
 	}
 
-	public static function ResetCache(Config $oConfig)
+	public static function ResetCache(Config $oConfig = null)
 	{
 		if (!function_exists('apc_delete')) return;
-
+		if (is_null($oConfig))
+		{
+			$oConfig = self::GetConfig();
+		}
 		$sAppIdentity = $oConfig->Get('session_name');
+
 		Dict::ResetCache($sAppIdentity);
 
-		foreach(self::GetCacheEntries($sAppIdentity) as $sKey => $aAPCInfo)
+		foreach(self::GetCacheEntries($oConfig) as $sKey => $aAPCInfo)
 		{
 			$sAPCKey = $aAPCInfo['info'];
 			apc_delete($sAPCKey);