Updated plugin list format (#4557)
This commit is contained in:
parent
ea386eaab1
commit
7d8da81b92
@ -154,8 +154,9 @@ void cPluginManager::ReloadPluginsNow(cSettingsRepositoryInterface & a_Settings)
|
|||||||
void cPluginManager::InsertDefaultPlugins(cSettingsRepositoryInterface & a_Settings)
|
void cPluginManager::InsertDefaultPlugins(cSettingsRepositoryInterface & a_Settings)
|
||||||
{
|
{
|
||||||
a_Settings.AddKeyName("Plugins");
|
a_Settings.AddKeyName("Plugins");
|
||||||
a_Settings.AddValue("Plugins", "Plugin", "Core");
|
a_Settings.AddValue("Plugins", "Core", "1");
|
||||||
a_Settings.AddValue("Plugins", "Plugin", "ChatLog");
|
a_Settings.AddValue("Plugins", "ChatLog", "1");
|
||||||
|
a_Settings.AddValue("Plugins", "ProtectionAreas", "0");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1733,22 +1734,40 @@ AStringVector cPluginManager::GetFoldersToLoad(cSettingsRepositoryInterface & a_
|
|||||||
InsertDefaultPlugins(a_Settings);
|
InsertDefaultPlugins(a_Settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the list of plugins to load:
|
|
||||||
AStringVector res;
|
AStringVector res;
|
||||||
auto Values = a_Settings.GetValues("Plugins");
|
|
||||||
for (auto NameValue : Values)
|
// Get the old format plugin list, and migrate it.
|
||||||
|
// Upgrade path added on 2020-03-27
|
||||||
|
auto OldValues = a_Settings.GetValues("Plugins");
|
||||||
|
for (auto NameValue : OldValues)
|
||||||
{
|
{
|
||||||
AString ValueName = NameValue.first;
|
AString ValueName = NameValue.first;
|
||||||
if (ValueName.compare("Plugin") == 0)
|
if (ValueName.compare("Plugin") == 0)
|
||||||
{
|
{
|
||||||
AString PluginFile = NameValue.second;
|
AString PluginFile = NameValue.second;
|
||||||
if (!PluginFile.empty())
|
if (
|
||||||
|
!PluginFile.empty() &&
|
||||||
|
(PluginFile != "0") &&
|
||||||
|
(PluginFile != "1")
|
||||||
|
)
|
||||||
{
|
{
|
||||||
res.push_back(PluginFile);
|
a_Settings.DeleteValue("Plugins", ValueName);
|
||||||
|
a_Settings.SetValue("Plugins", PluginFile, "1");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} // for i - ini values
|
} // for i - ini values
|
||||||
|
|
||||||
|
// Get the list of plugins to load:
|
||||||
|
auto Values = a_Settings.GetValues("Plugins");
|
||||||
|
for (auto NameValue : Values)
|
||||||
|
{
|
||||||
|
AString Enabled = NameValue.second;
|
||||||
|
if (Enabled == "1")
|
||||||
|
{
|
||||||
|
res.push_back(NameValue.first);
|
||||||
|
}
|
||||||
|
} // for i - ini values
|
||||||
|
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user