Skip to content

Commit

Permalink
Merge pull request dnnsoftware#5510 from bdukes/obsolete-stuff
Browse files Browse the repository at this point in the history
Fix some obsolete method usages
  • Loading branch information
valadas authored Jan 31, 2023
2 parents ef5bf0d + b7d7d0d commit 07741e2
Show file tree
Hide file tree
Showing 27 changed files with 1,570 additions and 1,301 deletions.
8 changes: 2 additions & 6 deletions DNN Platform/Library/Application/Application.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,8 @@ public virtual string SKU
}

/// <summary>Gets the status of the DotnetNuke application.</summary>
/// <remarks>
/// If the value is not be Stable, you will see the exactly status and version in page's title if allow display beta message in host setting.
/// </remarks>
/// <value>
/// The value can be: None, Alpha, Beta, RC, Stable.
/// </value>
/// <remarks>If the value is not be Stable, you will see the exactly status and version in page's title if allow display beta message in host setting.</remarks>
/// <value>The value can be: None, Alpha, Beta, RC, Stable.</value>
[Obsolete("Deprecated in Platform 9.7.0. Use 'DotNetNuke.Abstractions.Application.IApplicationInfo' with Dependency Injection instead. Scheduled for removal in v11.0.0.")]
public ReleaseMode Status { get => (ReleaseMode)(this as IApplicationInfo).Status; }

Expand Down
27 changes: 7 additions & 20 deletions DNN Platform/Library/Application/ApplicationStatusInfo.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace DotNetNuke.Application
{
using System;
Expand All @@ -23,7 +22,7 @@ public class ApplicationStatusInfo : IApplicationStatusInfo
private UpgradeStatus status = UpgradeStatus.Unknown;
private string applicationMapPath;

private IApplicationInfo applicationInfo;
private readonly IApplicationInfo applicationInfo;

/// <summary>Initializes a new instance of the <see cref="ApplicationStatusInfo"/> class.</summary>
/// <param name="applicationInfo">The application info.</param>
Expand Down Expand Up @@ -207,28 +206,22 @@ public int GetLastAppliedIteration(Version version)
}

/// <summary>Determines whether current request is for install.</summary>
/// <returns>
/// <c>true</c> if current request is for install; otherwise, <c>false</c>.
/// </returns>
/// <returns><c>true</c> if current request is for install; otherwise, <c>false</c>.</returns>
private bool IsInstallationURL()
{
string requestURL = HttpContext.Current.Request.RawUrl.ToLowerInvariant().Replace("\\", "/");
return requestURL.Contains("/install.aspx") || requestURL.Contains("/installwizard.aspx");
}

/// <summary>Determines whether has installation date.</summary>
/// <returns>
/// <c>true</c> if has installation date; otherwise, <c>false</c>.
/// </returns>
/// <returns><c>true</c> if has installation date; otherwise, <c>false</c>.</returns>
private bool HasInstallationDate()
{
return Config.GetSetting("InstallationDate") != null;
}

/// <summary>Determines whether has data provider log files.</summary>
/// <returns>
/// <c>true</c> if has data provider log files; otherwise, <c>false</c>.
/// </returns>
/// <returns><c>true</c> if has data provider log files; otherwise, <c>false</c>.</returns>
private bool HasDataProviderLogFiles()
{
Provider currentdataprovider = Config.GetDefaultProvider("data");
Expand All @@ -249,19 +242,15 @@ private bool HasDataProviderLogFiles()

/// <summary>Check whether the modules directory is exists.</summary>
/// <param name="moduleName">Name of the module.</param>
/// <returns>
/// <c>true</c> if the module directory exist, otherwise, <c>false</c>.
/// </returns>
/// <returns><c>true</c> if the module directory exist, otherwise, <c>false</c>.</returns>
private bool ModuleDirectoryExists(string moduleName)
{
string dir = this.ApplicationMapPath + "\\desktopmodules\\" + moduleName;
return Directory.Exists(dir);
}

/// <summary>Determines whether has portal directory except default portal directory in portal path.</summary>
/// <returns>
/// <c>true</c> if has portal directory except default portal directory in portal path; otherwise, <c>false</c>.
/// </returns>
/// <returns><c>true</c> if has portal directory except default portal directory in portal path; otherwise, <c>false</c>.</returns>
private bool HasNonDefaultPortalDirectory()
{
string dir = this.ApplicationMapPath + "\\portals";
Expand All @@ -274,9 +263,7 @@ private bool HasNonDefaultPortalDirectory()
}

/// <summary>Determines whether has InstallVersion set.</summary>
/// <returns>
/// <c>true</c> if has installation date; otherwise, <c>false</c>.
/// </returns>
/// <returns><c>true</c> if has installation date; otherwise, <c>false</c>.</returns>
private bool HasInstallVersion()
{
return Config.GetSetting("InstallVersion") != null;
Expand Down
32 changes: 12 additions & 20 deletions DNN Platform/Library/Common/NavigationManager.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information

namespace DotNetNuke.Common
{
using System.Linq;
Expand All @@ -15,6 +14,7 @@ namespace DotNetNuke.Common
using DotNetNuke.Entities.Tabs;
using DotNetNuke.Services.Localization;

/// <summary>The default <see cref="INavigationManager"/> implementation.</summary>
internal class NavigationManager : INavigationManager
{
private readonly IPortalController portalController;
Expand All @@ -30,8 +30,7 @@ public NavigationManager(IPortalController portalController)
/// <returns>Formatted URL.</returns>
public string NavigateURL()
{
PortalSettings portalSettings = this.portalController.GetCurrentPortalSettings();
return this.NavigateURL(portalSettings.ActiveTab.TabID, Null.NullString);
return this.NavigateURL(TabController.CurrentPage.TabID, Null.NullString);
}

/// <summary>Gets the URL to the given page.</summary>
Expand All @@ -48,8 +47,8 @@ public string NavigateURL(int tabID)
/// <returns>Formatted URL.</returns>
public string NavigateURL(int tabID, bool isSuperTab)
{
IPortalSettings portalSettings = this.portalController.GetCurrentSettings();
string cultureCode = Globals.GetCultureCode(tabID, isSuperTab, portalSettings);
var portalSettings = this.portalController.GetCurrentSettings();
var cultureCode = Globals.GetCultureCode(tabID, isSuperTab, portalSettings);
return this.NavigateURL(tabID, isSuperTab, portalSettings, Null.NullString, cultureCode);
}

Expand All @@ -62,11 +61,8 @@ public string NavigateURL(string controlKey)
{
return Globals.AccessDeniedURL();
}
else
{
PortalSettings portalSettings = this.portalController.GetCurrentPortalSettings();
return this.NavigateURL(portalSettings.ActiveTab.TabID, controlKey);
}

return this.NavigateURL(TabController.CurrentPage.TabID, controlKey);
}

/// <summary>Gets the URL to show the control associated with the given control key.</summary>
Expand All @@ -75,8 +71,7 @@ public string NavigateURL(string controlKey)
/// <returns>Formatted URL.</returns>
public string NavigateURL(string controlKey, params string[] additionalParameters)
{
PortalSettings portalSettings = this.portalController.GetCurrentPortalSettings();
return this.NavigateURL(portalSettings?.ActiveTab?.TabID ?? -1, controlKey, additionalParameters);
return this.NavigateURL(TabController.CurrentPage?.TabID ?? -1, controlKey, additionalParameters);
}

/// <summary>Gets the URL to show the control associated with the given control key on the given page.</summary>
Expand All @@ -85,8 +80,7 @@ public string NavigateURL(string controlKey, params string[] additionalParameter
/// <returns>Formatted URL.</returns>
public string NavigateURL(int tabID, string controlKey)
{
PortalSettings portalSettings = this.portalController.GetCurrentPortalSettings();
return this.NavigateURL(tabID, portalSettings, controlKey, null);
return this.NavigateURL(tabID, this.portalController.GetCurrentSettings(), controlKey, null);
}

/// <summary>Gets the URL to show the given page.</summary>
Expand All @@ -96,8 +90,7 @@ public string NavigateURL(int tabID, string controlKey)
/// <returns>Formatted URL.</returns>
public string NavigateURL(int tabID, string controlKey, params string[] additionalParameters)
{
PortalSettings portalSettings = this.portalController.GetCurrentPortalSettings();
return this.NavigateURL(tabID, portalSettings, controlKey, additionalParameters);
return this.NavigateURL(tabID, this.portalController.GetCurrentSettings(), controlKey, additionalParameters);
}

/// <summary>Gets the URL to show the given page.</summary>
Expand All @@ -108,8 +101,7 @@ public string NavigateURL(int tabID, string controlKey, params string[] addition
/// <returns>Formatted URL.</returns>
public string NavigateURL(int tabID, IPortalSettings settings, string controlKey, params string[] additionalParameters)
{
bool isSuperTab = Globals.IsHostTab(tabID);

var isSuperTab = Globals.IsHostTab(tabID);
return this.NavigateURL(tabID, isSuperTab, settings, controlKey, additionalParameters);
}

Expand All @@ -122,7 +114,7 @@ public string NavigateURL(int tabID, IPortalSettings settings, string controlKey
/// <returns>Formatted URL.</returns>
public string NavigateURL(int tabID, bool isSuperTab, IPortalSettings settings, string controlKey, params string[] additionalParameters)
{
string cultureCode = Globals.GetCultureCode(tabID, isSuperTab, settings);
var cultureCode = Globals.GetCultureCode(tabID, isSuperTab, settings);
return this.NavigateURL(tabID, isSuperTab, settings, controlKey, cultureCode, additionalParameters);
}

Expand Down Expand Up @@ -150,7 +142,7 @@ public string NavigateURL(int tabID, bool isSuperTab, IPortalSettings settings,
/// <returns>Formatted url.</returns>
public string NavigateURL(int tabID, bool isSuperTab, IPortalSettings settings, string controlKey, string language, string pageName, params string[] additionalParameters)
{
string url = tabID == Null.NullInteger ? Globals.ApplicationURL() : Globals.ApplicationURL(tabID);
var url = tabID == Null.NullInteger ? Globals.ApplicationURL() : Globals.ApplicationURL(tabID);
if (!string.IsNullOrEmpty(controlKey))
{
url += "&ctl=" + controlKey;
Expand Down
Loading

0 comments on commit 07741e2

Please sign in to comment.