Skip to content

Commit b190dad

Browse files
committed
Minor perf optimization in PluginManager
1 parent f817f18 commit b190dad

1 file changed

Lines changed: 4 additions & 10 deletions

File tree

src/Libraries/SmartStore.Core/Plugins/PluginManager.cs

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,12 @@ public static void Initialize()
143143
where !x.IsMatch("bin") && !x.IsMatch("_Backup")
144144
select Path.Combine(pluginFolderPath, x);
145145

146+
var installedPluginSystemNames = PluginFileParser.ParseInstalledPluginsFile();
147+
146148
// now activate all plugins
147149
foreach (var pluginPath in pluginPaths)
148150
{
149-
var result = LoadPluginFromFolder(pluginPath);
151+
var result = LoadPluginFromFolder(pluginPath, installedPluginSystemNames);
150152
if (result != null)
151153
{
152154
if (result.IsIncompatible)
@@ -180,14 +182,6 @@ public static void Initialize()
180182
}
181183
}
182184

183-
public static LoadPluginResult LoadPluginFromFolder(string pluginFolderPath)
184-
{
185-
using (Locker.GetWriteLock())
186-
{
187-
return LoadPluginFromFolder(pluginFolderPath, null);
188-
}
189-
}
190-
191185
private static LoadPluginResult LoadPluginFromFolder(string pluginFolderPath, ICollection<string> installedPluginSystemNames)
192186
{
193187
Guard.ArgumentNotEmpty(() => pluginFolderPath);
@@ -241,7 +235,7 @@ private static LoadPluginResult LoadPluginFromFolder(string pluginFolderPath, IC
241235
}
242236

243237
// set 'Installed' property
244-
descriptor.Installed = installedPluginSystemNames.Any(x => x.Equals(descriptor.SystemName, StringComparison.InvariantCultureIgnoreCase));
238+
descriptor.Installed = installedPluginSystemNames.Contains(descriptor.SystemName);
245239

246240
try
247241
{

0 commit comments

Comments
 (0)