Sfoglia il codice sorgente

#267 Fixed a regression due to the change [866]

git-svn-id: http://svn.code.sf.net/p/itop/code/trunk@872 a333f486-631f-4898-b8df-5754b55c2be0
romainq 14 anni fa
parent
commit
2b635736ad
1 ha cambiato i file con 23 aggiunte e 11 eliminazioni
  1. 23 11
      setup/index.php

+ 23 - 11
setup/index.php

@@ -367,6 +367,26 @@ function CheckServerConnection(SetupWebPage $oP, $sDBServer, $sDBUser, $sDBPwd)
 }
 
 /**
+ * Helper function to interpret the name of a module
+ * @param $sModuleId string Identifier of the module, in the form 'name/version'
+ * @return array(name, version)
+ */    
+function GetModuleName($sModuleId)
+{
+	if (preg_match('!^(.*)/(.*)$!', $sModuleId, $aMatches))
+	{
+		$sName = $aMatches[1];
+		$sVersion = $aMatches[2];
+	}
+	else
+	{
+		$sName = $sModuleId;
+		$sVersion = "";
+	}
+	return array($sName, $sVersion);
+}
+
+/**
  * Helper function to initialize the ORM and load the data model
  * from the given file
  * @param $sConfigFileName string The name of the configuration file to load
@@ -446,16 +466,7 @@ function CreateDatabaseStructure(SetupWebPage $oP, Config $oConfig, $sDBName, $s
 	foreach($aSelectedModules as $sModuleId)
 	{
 		$aModuleData = $aAvailableModules[$sModuleId];
-		if (preg_match('!^(.*)/(.*)$!', $sModuleId, $aMatches))
-		{
-			$sName = $aMatches[1];
-			$sVersion = $aMatches[2];
-		}
-		else
-		{
-			$sName = $sModuleId;
-			$sVersion = "";
-		}
+		list($sName, $sVersion) = GetModuleName($sModuleId);
 		$aComments = array();
 		$aComments[] = 'Done by the setup program';
 		if ($aModuleData['mandatory'])
@@ -662,7 +673,8 @@ function BuildConfig(SetupWebpage $oP, Config &$oConfig, $aParamValues)
 		$sDictionaries = array_unique(array_merge($sDictionaries, $aAvailableModules[$sModuleId]['dictionary']));
 		foreach($aAvailableModules[$sModuleId]['settings'] as $sProperty => $value)
 		{
-			$oConfig->SetModuleSetting($sModuleId, $sProperty, $value);
+			list($sName, $sVersion) = GetModuleName($sModuleId);
+			$oConfig->SetModuleSetting($sName, $sProperty, $value);
 		}
 	}
 	$oConfig->SetAddOns($aAddOns);