Explorar o código

Compiler and co: fixed issue with the reset of the APC cache

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1990 a333f486-631f-4898-b8df-5754b55c2be0
romainq %!s(int64=13) %!d(string=hai) anos
pai
achega
f24724157d
Modificáronse 2 ficheiros con 10 adicións e 10 borrados
  1. 9 9
      core/metamodel.class.php
  2. 1 1
      setup/runtimeenv.class.inc.php

+ 9 - 9
core/metamodel.class.php

@@ -4786,15 +4786,15 @@ abstract class MetaModel
 		return $oInstance;
 		return $oInstance;
 	}
 	}
 
 
-	public static function GetCacheEntries(Config $oConfig = null)
+	public static function GetCacheEntries($sEnvironment = null)
 	{
 	{
 		if (!function_exists('apc_cache_info')) return array();
 		if (!function_exists('apc_cache_info')) return array();
-		if (is_null($oConfig))
+		if (is_null($sEnvironment))
 		{
 		{
-			$oConfig = self::GetConfig();
+			$sEnvironment = MetaModel::GetEnvironmentId();
 		}
 		}
 		$aCacheUserData = apc_cache_info('user');  
 		$aCacheUserData = apc_cache_info('user');  
-		$sPrefix = 'itop-'.MetaModel::GetEnvironmentId().'-';
+		$sPrefix = 'itop-'.$sEnvironment.'-';
 
 
 		$aEntries = array();
 		$aEntries = array();
 		foreach($aCacheUserData['cache_list'] as $i => $aEntry)
 		foreach($aCacheUserData['cache_list'] as $i => $aEntry)
@@ -4809,18 +4809,18 @@ abstract class MetaModel
 		return $aEntries;
 		return $aEntries;
 	}
 	}
 
 
-	public static function ResetCache(Config $oConfig = null)
+	public static function ResetCache($sEnvironment = null)
 	{
 	{
 		if (!function_exists('apc_delete')) return;
 		if (!function_exists('apc_delete')) return;
-		if (is_null($oConfig))
+		if (is_null($sEnvironment))
 		{
 		{
-			$oConfig = self::GetConfig();
+			$sEnvironment = MetaModel::GetEnvironmentId();
 		}
 		}
 
 
-		$sAppIdentity = 'itop-'.MetaModel::GetEnvironmentId();
+		$sAppIdentity = 'itop-'.$sEnvironment;
 		Dict::ResetCache($sAppIdentity);
 		Dict::ResetCache($sAppIdentity);
 
 
-		foreach(self::GetCacheEntries($oConfig) as $sKey => $aAPCInfo)
+		foreach(self::GetCacheEntries($sEnvironment) as $sKey => $aAPCInfo)
 		{
 		{
 			$sAPCKey = $aAPCInfo['info'];
 			$sAPCKey = $aAPCInfo['info'];
 			apc_delete($sAPCKey);
 			apc_delete($sAPCKey);

+ 1 - 1
setup/runtimeenv.class.inc.php

@@ -79,7 +79,7 @@ class RunTimeEnvironment
 		if (!$bUseCache)
 		if (!$bUseCache)
 		{
 		{
 			// Reset the cache for the first use !
 			// Reset the cache for the first use !
-			MetaModel::ResetCache($oConfig);
+			MetaModel::ResetCache($this->sTargetEnv);
 		}
 		}
 	
 	
 		MetaModel::Startup($oConfig, $bModelOnly, $bUseCache);
 		MetaModel::Startup($oConfig, $bModelOnly, $bUseCache);