optimize the System Update process
This commit is contained in:
@ -88,10 +88,10 @@ namespace Oqtane.Controllers
|
||||
|
||||
[HttpGet("upgrade")]
|
||||
[Authorize(Roles = RoleNames.Host)]
|
||||
public Installation Upgrade()
|
||||
public Installation Upgrade(string backup)
|
||||
{
|
||||
var installation = new Installation { Success = true, Message = "" };
|
||||
_installationManager.UpgradeFramework();
|
||||
_installationManager.UpgradeFramework(bool.Parse(backup));
|
||||
return installation;
|
||||
}
|
||||
|
||||
|
@ -380,7 +380,7 @@ namespace Oqtane.Infrastructure
|
||||
File.WriteAllText(assemblyLogPath, JsonSerializer.Serialize(assemblies, new JsonSerializerOptions { WriteIndented = true }));
|
||||
}
|
||||
|
||||
public async Task UpgradeFramework()
|
||||
public async Task UpgradeFramework(bool backup)
|
||||
{
|
||||
string folder = Path.Combine(_environment.ContentRootPath, Constants.PackagesFolder);
|
||||
if (Directory.Exists(folder))
|
||||
@ -448,14 +448,14 @@ namespace Oqtane.Infrastructure
|
||||
// install Oqtane.Upgrade zip package
|
||||
if (File.Exists(upgradepackage))
|
||||
{
|
||||
FinishUpgrade();
|
||||
FinishUpgrade(backup);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void FinishUpgrade()
|
||||
private void FinishUpgrade(bool backup)
|
||||
{
|
||||
// check if updater application exists
|
||||
string Updater = Constants.UpdaterPackageId + ".dll";
|
||||
@ -469,7 +469,7 @@ namespace Oqtane.Infrastructure
|
||||
{
|
||||
WorkingDirectory = folder,
|
||||
FileName = "dotnet",
|
||||
Arguments = Path.Combine(folder, Updater) + " \"" + _environment.ContentRootPath + "\" \"" + _environment.WebRootPath + "\"",
|
||||
Arguments = Path.Combine(folder, Updater) + " \"" + _environment.ContentRootPath + "\" \"" + _environment.WebRootPath + "\" \"" + backup.ToString() + "\"",
|
||||
UseShellExecute = false,
|
||||
ErrorDialog = false,
|
||||
CreateNoWindow = true,
|
||||
|
@ -7,7 +7,7 @@ namespace Oqtane.Infrastructure
|
||||
void InstallPackages();
|
||||
bool UninstallPackage(string PackageName);
|
||||
int RegisterAssemblies();
|
||||
Task UpgradeFramework();
|
||||
Task UpgradeFramework(bool backup);
|
||||
void RestartApplication();
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user