From b2feca5eb50d150844a74b2ddf645c9c0f23d222 Mon Sep 17 00:00:00 2001 From: Denis Flaven Date: Wed, 2 Jul 2014 09:32:05 +0000 Subject: [PATCH] #944 Better initialization of the 'origin' field based on localized comments. SVN:trunk[3238] --- setup/applicationinstaller.class.inc.php | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/setup/applicationinstaller.class.inc.php b/setup/applicationinstaller.class.inc.php index d526700fd..38acc57a9 100644 --- a/setup/applicationinstaller.class.inc.php +++ b/setup/applicationinstaller.class.inc.php @@ -607,9 +607,20 @@ class ApplicationInstaller $sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'csv-interactive' WHERE `userinfo` LIKE '%(CSV)' AND origin = 'interactive'"; CMDBSource::Query($sInit); - // Syncho data sources were identified by the comment at the end (Yes: Synchronisation with a S!!) - $sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'synchro-data-source' WHERE `userinfo` LIKE '%(Synchronisation)'"; + // Syncho data sources were identified by the comment at the end + // Unfortunately the comment is localized, so we have to search for all possible patterns + $sCurrentLanguage = Dict::GetUserLanguage(); + foreach(Dict::GetLanguages() as $sLangCode => $aLang) + { + Dict::SetUserLanguage($sLangCode); + $sSuffix = CMDBSource::Quote('%'.Dict::S('Core:SyncDataExchangeComment')); + $aSuffixes[$sSuffix] = true; + } + Dict::SetUserLanguage($sCurrentLanguage); + $sCondition = "`userinfo` LIKE ".implode(" OR `userinfo` LIKE ", array_keys($aSuffixes)); + + $sInit = "UPDATE `{$sDBPrefix}priv_change` SET `origin` = 'synchro-data-source' WHERE ($sCondition)"; CMDBSource::Query($sInit); SetupPage::log_info("Initialization of '{$sDBPrefix}priv_change.origin' completed.");