فهرست منبع

Modules: added a mean to cache data that will be reset upon compilation. To be used in conjunction with ModuleDesign.

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@3877 a333f486-631f-4898-b8df-5754b55c2be0
romainq 9 سال پیش
والد
کامیت
1747be3a44
3فایلهای تغییر یافته به همراه23 افزوده شده و 6 حذف شده
  1. 12 3
      application/utils.inc.php
  2. 6 2
      setup/applicationinstaller.class.inc.php
  3. 5 1
      setup/runtimeenv.class.inc.php

+ 12 - 3
application/utils.inc.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2015 Combodo SARL
+// Copyright (C) 2010-2016 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -20,7 +20,7 @@
 /**
  * Static class utils
  *
- * @copyright   Copyright (C) 2010-2015 Combodo SARL
+ * @copyright   Copyright (C) 2010-2016 Combodo SARL
  * @license     http://opensource.org/licenses/AGPL-3.0
  */
 
@@ -768,7 +768,16 @@ class utils
 			return ITOP_DEFAULT_ENV;
 		}
 	}
-	
+
+	/**
+	 * Returns a path to a folder into which any module can store cache data
+	 * The corresponding folder is created or cleaned upon code compilation
+	 * @return string
+	 */
+	public static function GetCachePath()
+	{
+		return APPROOT.'data/cache-'.self::GetCurrentEnvironment().'/';
+	}
 	/**
 	 * Merge standard menu items with plugin provided menus items
 	 */

+ 6 - 2
setup/applicationinstaller.class.inc.php

@@ -1,5 +1,5 @@
 <?php
-// Copyright (C) 2010-2012 Combodo SARL
+// Copyright (C) 2010-2016 Combodo SARL
 //
 //   This file is part of iTop.
 //
@@ -30,7 +30,7 @@ require_once(APPROOT.'setup/backup.class.inc.php');
  * while displaying a progress bar, or in an unattended manner
  * (for example from the command line), to run all the steps
  * in one go.
- * @copyright   Copyright (C) 2010-2012 Combodo SARL
+ * @copyright   Copyright (C) 2010-2016 Combodo SARL
  * @license     http://opensource.org/licenses/AGPL-3.0
  */
 
@@ -522,6 +522,10 @@ class ApplicationInstaller
 			//$aCompilerLog = $oMFCompiler->GetLog();
 			//SetupPage::log_info(implode("\n", $aCompilerLog));
 			SetupPage::log_info("Data model successfully compiled to '$sTargetPath'.");
+
+			$sCacheDir = APPROOT.'/data/cache-'.$sEnvironment.'/';
+			Setuputils::builddir($sCacheDir);
+			Setuputils::tidydir($sCacheDir);
 		}
 		
 		// Special case to patch a ugly patch in itop-config-mgmt

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

@@ -424,7 +424,11 @@ class RunTimeEnvironment
 			self::MakeDirSafe($sTargetDir);
 			$oMFCompiler = new MFCompiler($oFactory);
 			$oMFCompiler->Compile($sTargetDir, null, $bUseSymLinks);
-			
+
+			$sCacheDir = APPROOT.'data/cache-'.$this->sTargetEnv;
+			Setuputils::builddir($sCacheDir);
+			Setuputils::tidydir($sCacheDir);
+
 			require_once(APPROOT.'/core/dict.class.inc.php');
 			MetaModel::ResetCache(md5(APPROOT).'-'.$this->sTargetEnv);
 		}