From 489be44b90b409ca14cdc6cf163bde0077abb77f Mon Sep 17 00:00:00 2001 From: Romain Quetiez Date: Wed, 21 Dec 2011 13:45:07 +0000 Subject: [PATCH] #489 Data synchro: reintegrated the latest improvements from trunk. SVN:1.2[1740] --- application/utils.inc.php | 116 ++- core/config.class.inc.php | 8 + core/dbobject.class.php | 4 +- core/kpi.class.inc.php | 10 + core/metamodel.class.php | 5 +- dictionaries/de.dictionary.itop.core.php | 2 +- dictionaries/dictionary.itop.core.php | 5 +- dictionaries/fr.dictionary.itop.core.php | 2 +- dictionaries/hu.dictionary.itop.core.php | 2 +- dictionaries/it.dictionary.itop.core.php | 964 +++++++++---------- dictionaries/ja.dictionary.itop.ui.php | 8 +- dictionaries/pt_br.dictionary.itop.core.php | 2 +- synchro/priv_sync_chunk.php | 135 +++ synchro/synchro_exec.php | 5 +- synchro/synchro_import.php | 10 +- synchro/synchrodatasource.class.inc.php | 990 +++++++++++++------- test/testlist.inc.php | 4 +- 17 files changed, 1448 insertions(+), 824 deletions(-) create mode 100644 synchro/priv_sync_chunk.php diff --git a/application/utils.inc.php b/application/utils.inc.php index bdd7fce90..a91996b3f 100644 --- a/application/utils.inc.php +++ b/application/utils.inc.php @@ -46,6 +46,7 @@ class utils // Parameters loaded from a file, parameters of the page/command line still have precedence private static $m_aParamsFromFile = null; + private static $m_aParamSource = array(); protected static function LoadParamFile($sParamFile) { @@ -82,6 +83,7 @@ class utils $sParam = $aMatches[1]; $value = trim($aMatches[2]); self::$m_aParamsFromFile[$sParam] = $value; + self::$m_aParamSource[$sParam] = $sParamFile; } } } @@ -99,6 +101,25 @@ class utils } } + /** + * Return the source file from which the parameter has been found, + * usefull when it comes to pass user credential to a process executed + * in the background + * @param $sName Parameter name + * @return The file name if any, or null + */ + public static function GetParamSourceFile($sName) + { + if (array_key_exists($sName, self::$m_aParamSource)) + { + return self::$m_aParamSource[$sName]; + } + else + { + return null; + } + } + public static function IsModeCLI() { $sSAPIName = php_sapi_name(); @@ -152,10 +173,18 @@ class utils public static function Sanitize($value, $defaultValue, $sSanitizationFilter) { - $retValue = self::Sanitize_Internal($value, $sSanitizationFilter); - if ($retValue === false) + if ($value === $defaultValue) { - $retValue = $defaultValue; + // Preserve the real default value (can be used to detect missing mandatory parameters) + $retValue = $value; + } + else + { + $retValue = self::Sanitize_Internal($value, $sSanitizationFilter); + if ($retValue === false) + { + $retValue = $defaultValue; + } } return $retValue; } @@ -601,5 +630,86 @@ class utils } echo "".print_r($aLightTrace, true)."
".print_r($aLightTrace, true)."
The synchronization has been executed, $iErrors errors have been encountered. Click here to see the records being currently in error.
The synchronization has been successfully executed.
The synchronization could not start: \''.$e->getMessage().'\'
Please check its configuration
The synchronization has been interrupted: \''.$e->getMessage().'\'
Please contact the application support team