U4-10626 Detecting deplayoment Id change

This commit is contained in:
Jacek Malinowski
2017-11-02 07:40:53 -07:00
parent eaa8ca5fdc
commit daa0741802
2 changed files with 12 additions and 3 deletions

View File

@@ -278,7 +278,9 @@ namespace Umbraco.Core
}
// ReSharper disable once InconsistentNaming
internal string _umbracoApplicationUrl;
internal string _umbracoApplicationUrl;
internal string _umbracoApplicationDeploymentId;
private Lazy<bool> _configured;
internal MainDom MainDom { get; private set; }

View File

@@ -3,6 +3,7 @@ using System.Web;
using Umbraco.Core.Configuration;
using Umbraco.Core.Configuration.UmbracoSettings;
using Umbraco.Core.IO;
using Umbraco.Core.Logging;
using Umbraco.Core.ObjectResolution;
namespace Umbraco.Core.Sync
@@ -46,8 +47,14 @@ namespace Umbraco.Core.Sync
// settings: for unit tests only
internal static void EnsureApplicationUrl(ApplicationContext appContext, HttpRequestBase request = null, IUmbracoSettingsSection settings = null)
{
// if initialized, return
if (appContext._umbracoApplicationUrl != null) return;
// if initialized and on the same DeploymentId, return
var deplayomentId = Environment.ExpandEnvironmentVariables("%WEBSITE_SITE_NAME%");
if (appContext._umbracoApplicationUrl != null && appContext._umbracoApplicationDeploymentId == deplayomentId) return;
if (appContext._umbracoApplicationDeploymentId != deplayomentId)
LogHelper.Info(typeof(ApplicationUrlHelper), $"DeploymentId changed: {deplayomentId}");
appContext._umbracoApplicationDeploymentId = deplayomentId;
var logger = appContext.ProfilingLogger.Logger;