Browse Source

Delay the storage of the dictionary in the cache to allow for its alteration during the initialization of the classes

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@1857 a333f486-631f-4898-b8df-5754b55c2be0
dflaven 13 years ago
parent
commit
7381192e4f
1 changed files with 8 additions and 5 deletions
  1. 8 5
      core/metamodel.class.php

+ 8 - 5
core/metamodel.class.php

@@ -4194,17 +4194,15 @@ abstract class MetaModel
 		// Note: load the dictionary as soon as possible, because it might be
 		//       needed when some error occur
 		$sAppIdentity = 'itop-'.MetaModel::GetEnvironmentId();
+		$bDictInitializedFromData = false;
 		if (!self::$m_bUseAPCCache || !Dict::InCache($sAppIdentity))
 		{
+			$bDictInitializedFromData = true;
 			foreach (self::$m_oConfig->GetDictionaries() as $sModule => $sToInclude)
 			{
 				self::IncludeModule('dictionaries', $sToInclude);
 			}
-			if (self::$m_bUseAPCCache)
-			{
-				Dict::InitCache($sAppIdentity);
-			}
-		}
+		}		
 		// Set the language... after the dictionaries have been loaded!
 		Dict::SetDefaultLanguage(self::$m_oConfig->GetDefaultLanguage());
 
@@ -4307,6 +4305,11 @@ abstract class MetaModel
 			}
 		}
 
+		if (self::$m_bUseAPCCache && $bDictInitializedFromData)
+		{
+			Dict::InitCache($sAppIdentity);
+		}
+		
 		self::$m_sDBName = $sSource;
 		self::$m_sTablePrefix = $sTablePrefix;