Allow modules to be installed/uninstalled with embedded scripts or IInstallable interface. Fix module uninstall issues.
This commit is contained in:
@ -54,22 +54,20 @@ namespace Oqtane.Controllers
|
||||
{
|
||||
List<Theme> themes = _themes.GetThemes().ToList();
|
||||
Theme theme = themes.Where(item => item.ThemeName == themename).FirstOrDefault();
|
||||
if (theme != null)
|
||||
if (theme != null && Utilities.GetAssemblyName(theme.ThemeName) != "Oqtane.Client")
|
||||
{
|
||||
themename = theme.ThemeName.Substring(0, theme.ThemeName.IndexOf(","));
|
||||
|
||||
string folder = Path.Combine(_environment.WebRootPath, "Themes" , themename);
|
||||
// clean up theme static resource folder
|
||||
string folder = Path.Combine(_environment.WebRootPath, "Themes" , Utilities.GetTypeName(theme.ThemeName));
|
||||
if (Directory.Exists(folder))
|
||||
{
|
||||
Directory.Delete(folder, true);
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Static Resources Removed For {ThemeName}", theme.ThemeName);
|
||||
}
|
||||
|
||||
// remove theme assembly from /bin
|
||||
string binfolder = Path.GetDirectoryName(Assembly.GetEntryAssembly().Location);
|
||||
foreach (string file in Directory.EnumerateFiles(binfolder, themename + "*.dll"))
|
||||
{
|
||||
System.IO.File.Delete(file);
|
||||
}
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Deleted {ThemeName}", themename);
|
||||
System.IO.File.Delete(Path.Combine(binfolder, Utilities.GetAssemblyName(theme.ThemeName) + ".dll"));
|
||||
_logger.Log(LogLevel.Information, this, LogFunction.Delete, "Theme Assembly {Filename} Removed For {ThemeName}", Utilities.GetAssemblyName(theme.ThemeName) + ".dll", themename);
|
||||
|
||||
_installationManager.RestartApplication();
|
||||
}
|
||||
|
Reference in New Issue
Block a user