Preserve queue filters during migration
This commit is contained in:
@@ -121,29 +121,45 @@ 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;
|
||||
|
||||
var changed = false;
|
||||
if (matrix42.HasAttribute("ActivityQueueFilter"))
|
||||
try
|
||||
{
|
||||
matrix42.RemoveAttribute("ActivityQueueFilter");
|
||||
changed = true;
|
||||
}
|
||||
var document = new XmlDocument();
|
||||
document.Load(FilePath);
|
||||
if (!(document.DocumentElement?.SelectSingleNode("Matrix42-WPM") is XmlElement matrix42))
|
||||
return false;
|
||||
|
||||
var queues = matrix42.SelectSingleNode("Queues");
|
||||
if (queues != null)
|
||||
var changed = false;
|
||||
if (matrix42.HasAttribute("ActivityQueueFilter"))
|
||||
{
|
||||
matrix42.RemoveAttribute("ActivityQueueFilter");
|
||||
changed = true;
|
||||
}
|
||||
|
||||
var queues = matrix42.SelectSingleNode("Queues");
|
||||
if (queues != null)
|
||||
{
|
||||
matrix42.RemoveChild(queues);
|
||||
changed = true;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
document.Save(FilePath);
|
||||
return changed;
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
matrix42.RemoveChild(queues);
|
||||
changed = true;
|
||||
LogException(exception);
|
||||
return false;
|
||||
}
|
||||
|
||||
return changed;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user