Preserve queue filters during migration
This commit is contained in:
@@ -508,6 +508,7 @@ namespace C4IT.DataHistoryProvider
|
||||
// load the global parameters
|
||||
if (!RefreshGlobalConfigurationParameters())
|
||||
return false;
|
||||
InfrastructureConfig.RemoveLegacyActivityFilterConfiguration();
|
||||
|
||||
mainDbConnection = InfrastructureConfig.HistoryDB.Connection;
|
||||
|
||||
|
||||
@@ -121,12 +121,20 @@ namespace C4IT.DataHistoryProvider
|
||||
return false;
|
||||
}
|
||||
|
||||
public override bool DoXmlUpdates(XmlElement xmlRoot, bool withM42Config = false, bool withIntuneConfig = false, bool withMobileDeviceConfig = false, bool withCitrixConfig = false)
|
||||
internal bool RemoveLegacyActivityFilterConfiguration()
|
||||
{
|
||||
// Queue filtering moved to the provider-neutral global ActivityFilters policy.
|
||||
// InstantiateProperties runs first, so the values remain available for the
|
||||
// one-time migration while the obsolete XML is removed.
|
||||
if (!(xmlRoot.SelectSingleNode("Matrix42-WPM") is XmlElement matrix42))
|
||||
// This intentionally runs only after the global configuration was loaded:
|
||||
// DoXmlUpdates runs before InstantiateProperties and would otherwise erase
|
||||
// the values before the one-time migration can read them.
|
||||
if (string.IsNullOrWhiteSpace(FilePath))
|
||||
return false;
|
||||
|
||||
try
|
||||
{
|
||||
var document = new XmlDocument();
|
||||
document.Load(FilePath);
|
||||
if (!(document.DocumentElement?.SelectSingleNode("Matrix42-WPM") is XmlElement matrix42))
|
||||
return false;
|
||||
|
||||
var changed = false;
|
||||
@@ -143,8 +151,16 @@ namespace C4IT.DataHistoryProvider
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
document.Save(FilePath);
|
||||
return changed;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
LogException(exception);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class cDataHistoryConfigDatabase : IConfigNodeValidation
|
||||
|
||||
Reference in New Issue
Block a user