Explorar o código

Compatibility with APCu (For PHP 5.5+), since it slightly different from APC.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3061 a333f486-631f-4898-b8df-5754b55c2be0
dflaven %!s(int64=11) %!d(string=hai) anos
pai
achega
1cfc47e70d
Modificáronse 1 ficheiros con 11 adicións e 2 borrados
  1. 11 2
      core/metamodel.class.php

+ 11 - 2
core/metamodel.class.php

@@ -5248,18 +5248,27 @@ abstract class MetaModel
 			$sEnvironment = MetaModel::GetEnvironmentId();
 		}
 		$aEntries = array();
-		$aCacheUserData = @apc_cache_info('user');
+		if (extension_loaded('apcu'))
+		{
+			// Beware: APCu behaves slightly differently from APC !!
+			$aCacheUserData = @apc_cache_info();
+		}
+		else
+		{
+			$aCacheUserData = @apc_cache_info('user');
+		}
 		if (is_array($aCacheUserData) && isset($aCacheUserData['cache_list']))
 		{ 
 			$sPrefix = 'itop-'.$sEnvironment.'-';
 	
 			foreach($aCacheUserData['cache_list'] as $i => $aEntry)
 			{
-				$sEntryKey = $aEntry['info'];
+				$sEntryKey = array_key_exists('info', $aEntry) ? $aEntry['info'] : $aEntry['key'];
 				if (strpos($sEntryKey, $sPrefix) === 0)
 				{
 					$sCleanKey = substr($sEntryKey, strlen($sPrefix));
 					$aEntries[$sCleanKey] = $aEntry;
+					$aEntries[$sCleanKey]['info'] = $sEntryKey;
 				}
 			}
 		}