Skip to content

Commit

Permalink
DNN-8695 - Delete more files after installation or upgrade - "DotNetN…
Browse files Browse the repository at this point in the history
…uke.install.config", "DotNetNuke.install.config.resources","InstallWizard.aspx","InstallWizard.aspx.cs","InstallWizard.aspx.designer.cs","UpgradeWizard.aspx","UpgradeWizard.aspx.cs","UpgradeWizard.aspx.designer.cs","Install.aspx","Install.aspx.cs", "Install.aspx.designer.cs".

Abort installation in InstallWizard.aspx if site is already installed. Extra security check prior to creation of super user during install. Extra security check prior to setting default host settings.
  • Loading branch information
ashishpd committed May 26, 2016
1 parent 31d7424 commit 90d414f
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
using DotNetNuke.Common;
using DotNetNuke.Common.Utilities;
using DotNetNuke.Entities.Controllers;
using DotNetNuke.Entities.Users;
using DotNetNuke.Services.FileSystem;
using DotNetNuke.Services.Upgrade.Internals;
using DotNetNuke.Services.Upgrade.Internals.Steps;
Expand Down Expand Up @@ -54,6 +55,15 @@ public override void Execute()
Details = Localization.Localization.GetString("InitHostSetting", LocalInstallResourceFile);
var installConfig = InstallController.Instance.GetInstallConfig();

//if any super user (even deleted) is found - exit
var superUsers = UserController.GetUsers(true, true, Null.NullInteger);
if (superUsers != null && superUsers.Count > 0)
{
Details = "...";
Status = StepStatus.Done;
return;
}

//Need to clear the cache to pick up new HostSettings from the SQLDataProvider script
DataCache.RemoveCache(DataCache.HostSettingsCacheKey);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,15 @@ public override void Execute()
Details = Localization.Localization.GetString("CreateSuperUser", LocalInstallResourceFile);
var installConfig = InstallController.Instance.GetInstallConfig();

//if any super user (even deleted) is found - exit
var superUsers = UserController.GetUsers(true, true, Null.NullInteger);
if (superUsers != null && superUsers.Count > 0)
{
Details = "...";
Status = StepStatus.Done;
return;
}

//Set admin user to be a superuser
var adminSuperUser = UserController.GetUserByName(0, installConfig.SuperUser.UserName);
if (adminSuperUser != null)
Expand Down
27 changes: 23 additions & 4 deletions DNN Platform/Library/Services/Upgrade/Upgrade.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4095,7 +4095,21 @@ public static string CheckUpgrade()
/// -----------------------------------------------------------------------------
public static void DeleteInstallerFiles()
{
var files = new List<string> {"DotNetNuke.install.config", "InstallWizard.aspx", "InstallWizard.aspx.cs"};
var files = new List<string>
{
"DotNetNuke.install.config",
"DotNetNuke.install.config.resources",
"InstallWizard.aspx",
"InstallWizard.aspx.cs",
"InstallWizard.aspx.designer.cs",
"UpgradeWizard.aspx",
"UpgradeWizard.aspx.cs",
"UpgradeWizard.aspx.designer.cs",
"Install.aspx",
"Install.aspx.cs",
"Install.aspx.designer.cs",
};

foreach (var file in files)
{
try
Expand Down Expand Up @@ -4661,9 +4675,14 @@ public static void InstallDNN(string strProviderPath)
// parse Host Settings if available
InitialiseHostSettings(xmlDoc, true);

// parse SuperUser if Available
UserInfo superUser = GetSuperUser(xmlDoc, true);
UserController.CreateUser(ref superUser);
//Create SuperUser only when it's not there (even soft deleted)
var superUsers = UserController.GetUsers(true, true, Null.NullInteger);
if (superUsers == null || superUsers.Count == 0)
{
// parse SuperUser if Available
UserInfo superUser = GetSuperUser(xmlDoc, true);
UserController.CreateUser(ref superUser);
}

// parse File List if available
InstallFiles(xmlDoc, true);
Expand Down
2 changes: 1 addition & 1 deletion DNN Platform/Website/Install/InstallWizard.aspx.cs
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ private static void LaunchAutoInstall()
private static void Install()
{
//bail out early if we are already running
if (_installerRunning || InstallBlocker.Instance.IsInstallInProgress())
if (_installerRunning || InstallBlocker.Instance.IsInstallInProgress() || (Globals.Status != Globals.UpgradeStatus.Install))
return;

var percentForEachStep = 100 / _steps.Count;
Expand Down

0 comments on commit 90d414f

Please sign in to comment.