Skip to content

Commit c66b32a

Browse files
committed
Theme inheritance (Final). NOTE: please perform a migrations downgrade to 'NewRes' in order to get the newest resource strings.
1 parent 4ed63cf commit c66b32a

20 files changed

Lines changed: 392 additions & 151 deletions

File tree

src/Libraries/SmartStore.Core/Collections/TopologicalSorter.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,10 @@ public static int[] SortIndexesTopological<T>(this ITopologicSortable<T>[] items
7171
{
7272
for (int j = 0; j < items[i].DependsOn.Length; j++)
7373
{
74-
sorter.AddEdge(i, indexes[items[i].DependsOn[j]]);
74+
if (indexes.ContainsKey(items[i].DependsOn[j]))
75+
{
76+
sorter.AddEdge(i, indexes[items[i].DependsOn[j]]);
77+
}
7578
}
7679
}
7780
}

src/Libraries/SmartStore.Core/Packaging/ExtensionDescriptor.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
namespace SmartStore.Core.Packaging
66
{
77

8-
internal class ExtensionDescriptor
8+
public class ExtensionDescriptor
99
{
1010
/// <summary>
1111
/// Virtual path base, "~/Themes" or "~/Plugins"

src/Libraries/SmartStore.Core/Packaging/NuGet/ExtensionReferenceRepository.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public ThemeReferenceRepository(IProjectSystem project, IPackageRepository sourc
9090
: base(project, sourceRepository)
9191
{
9292
_themeRegistry = themeRegistry;
93-
_themeManifests = _themeRegistry.GetThemeManifests();
93+
_themeManifests = _themeRegistry.GetThemeManifests(true);
9494
}
9595

9696
public override IQueryable<IPackage> GetPackages()

src/Libraries/SmartStore.Core/Packaging/PackageInfo.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ public class PackageInfo
1212
public string Version { get; set; }
1313
public string Type { get; set; }
1414
public string Path { get; set; }
15+
public ExtensionDescriptor ExtensionDescriptor { get; set; }
1516
}
1617
}

src/Libraries/SmartStore.Core/Packaging/PackageInstaller.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,11 @@ protected PackageInfo InstallPackage(IPackage package, IPackageRepository packag
118118

119119
// check if the new package is compatible with current SmartStore version
120120
var descriptor = package.GetExtensionDescriptor(packageInfo.Type);
121-
121+
122122
if (descriptor != null)
123123
{
124+
packageInfo.ExtensionDescriptor = descriptor;
125+
124126
if (!PluginManager.IsAssumedCompatible(descriptor.MinAppVersion))
125127
{
126128
if (previousInstalled)

src/Libraries/SmartStore.Core/Packaging/PackagingUtils.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,14 +74,15 @@ internal static ExtensionDescriptor ConvertToExtensionDescriptor(this PluginDesc
7474
{
7575
ExtensionType = "Plugin",
7676
Location = "~/Plugins",
77+
Path = pluginDescriptor.PhysicalPath,
7778
Id = pluginDescriptor.FolderName,
7879
Author = pluginDescriptor.Author,
7980
MinAppVersion = pluginDescriptor.MinAppVersion,
8081
Version = pluginDescriptor.Version,
8182
Name = pluginDescriptor.FriendlyName,
8283
Description = pluginDescriptor.Description,
8384
WebSite = string.Empty, // TODO: (pkg) Add author url to plugin manifests,
84-
Tags = string.Empty // TODO: (pkg) Add tags to plugin manifests
85+
Tags = string.Empty // TODO: (pkg) Add tags to plugin manifests,
8586
};
8687

8788
return descriptor;
@@ -93,14 +94,15 @@ internal static ExtensionDescriptor ConvertToExtensionDescriptor(this ThemeManif
9394
{
9495
ExtensionType = "Theme",
9596
Location = "~/Themes",
97+
Path = themeManifest.Path,
9698
Id = themeManifest.ThemeName,
9799
Author = themeManifest.Author.HasValue() ? themeManifest.Author : "[Unknown]",
98100
MinAppVersion = SmartStoreVersion.Version, // TODO: (pkg) Add SupportedVersion to theme manifests
99101
Version = new Version(themeManifest.Version),
100102
Name = themeManifest.ThemeTitle,
101103
Description = string.Empty, // TODO: (pkg) Add description to theme manifests
102104
WebSite = string.Empty, // TODO: (pkg) Add author url to theme manifests,
103-
Tags = string.Empty // TODO: (pkg) Add tags to theme manifests
105+
Tags = string.Empty // TODO: (pkg) Add tags to theme manifests,
104106
};
105107

106108
return descriptor;
@@ -126,7 +128,7 @@ internal static ExtensionDescriptor GetExtensionDescriptor(this IPackage package
126128
filePath = Path.Combine(HostingEnvironment.MapPath("~/"), filePath);
127129
if (isTheme)
128130
{
129-
var themeManifest = ThemeManifest.Create(Path.GetDirectoryName(filePath), null);
131+
var themeManifest = ThemeManifest.Create(Path.GetDirectoryName(filePath));
130132
if (themeManifest != null)
131133
{
132134
descriptor = themeManifest.ConvertToExtensionDescriptor();

0 commit comments

Comments
 (0)