#6233 - version in config removed
This commit is contained in:
@@ -55,7 +55,7 @@ namespace Umbraco.Configuration.Models
|
||||
public IReadOnlyDictionary<string, INotificationMethod> NotificationMethods => _configurationSection
|
||||
.GetSection("NotificationMethods")
|
||||
.GetChildren()
|
||||
.ToDictionary(x => x.Key, x => (INotificationMethod) new NotificationMethod(x.Key, x));
|
||||
.ToDictionary(x => x.Key, x => (INotificationMethod) new NotificationMethod(x.Key, x), StringComparer.InvariantCultureIgnoreCase);
|
||||
|
||||
public IEnumerable<IDisabledHealthCheck> DisabledChecks => _configurationSection
|
||||
.GetSection("DisabledChecks").GetChildren().Select(
|
||||
@@ -87,7 +87,7 @@ namespace Umbraco.Configuration.Models
|
||||
|
||||
public IReadOnlyDictionary<string, INotificationMethodSettings> Settings => _configurationSection
|
||||
.GetSection("Settings").GetChildren().ToDictionary(x => x.Key,
|
||||
x => (INotificationMethodSettings) new NotificationMethodSettings(x.Key, x.Value));
|
||||
x => (INotificationMethodSettings) new NotificationMethodSettings(x.Key, x.Value), StringComparer.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
||||
private class NotificationMethodSettings : INotificationMethodSettings
|
||||
|
||||
@@ -20,11 +20,6 @@
|
||||
/// <value>The reserved paths.</value>
|
||||
string ReservedPaths { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the configuration status. This will return the version number of the currently installed umbraco instance.
|
||||
/// </summary>
|
||||
string ConfigurationStatus { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the time out in minutes.
|
||||
/// </summary>
|
||||
|
||||
@@ -42,15 +42,5 @@ namespace Umbraco.Core.Configuration
|
||||
/// </remarks>
|
||||
SemVersion SemanticVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the "local" version of the site.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Three things have a version, really: the executing code, the database model,
|
||||
/// and the site/files. The database model version is entirely managed via migrations,
|
||||
/// and changes during an upgrade. The executing code version changes when new code is
|
||||
/// deployed. The site/files version changes during an upgrade.</para>
|
||||
/// </remarks>
|
||||
SemVersion LocalVersion { get; }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -73,23 +73,5 @@ namespace Umbraco.Core.Configuration
|
||||
/// <para>It is the full version of Umbraco, including comments.</para>
|
||||
/// </remarks>
|
||||
public SemVersion SemanticVersion { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the "local" version of the site.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// <para>Three things have a version, really: the executing code, the database model,
|
||||
/// and the site/files. The database model version is entirely managed via migrations,
|
||||
/// and changes during an upgrade. The executing code version changes when new code is
|
||||
/// deployed. The site/files version changes during an upgrade.</para>
|
||||
/// </remarks>
|
||||
public SemVersion LocalVersion
|
||||
{
|
||||
get
|
||||
{
|
||||
var value = _globalSettings.ConfigurationStatus;
|
||||
return value.IsNullOrWhiteSpace() ? null : SemVersion.TryParse(value, out var semver) ? semver : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,13 +28,7 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
{
|
||||
get
|
||||
{
|
||||
// TODO: if UmbracoVersion.Local is null?
|
||||
// it means that there is a database but the web.config version is cleared
|
||||
// that was a "normal" way to force the upgrader to execute, and we would detect the current
|
||||
// version via the DB like DatabaseSchemaResult.DetermineInstalledVersion - magic, do we really
|
||||
// need this now?
|
||||
var currentVersion = (_umbracoVersion.LocalVersion ?? new Semver.SemVersion(0)).ToString();
|
||||
|
||||
//TODO this will always compare the same version now
|
||||
var newVersion = _umbracoVersion.SemanticVersion.ToString();
|
||||
|
||||
string FormatGuidState(string value)
|
||||
@@ -48,6 +42,7 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
|
||||
var currentState = FormatGuidState(_runtimeState.CurrentMigrationState);
|
||||
var newState = FormatGuidState(_runtimeState.FinalMigrationState);
|
||||
var currentVersion = _umbracoVersion.Current;
|
||||
|
||||
var reportUrl = $"https://our.umbraco.com/contribute/releases/compare?from={currentVersion}&to={newVersion}¬es=1";
|
||||
|
||||
|
||||
@@ -115,8 +115,7 @@ namespace Umbraco.Web.Install
|
||||
get
|
||||
{
|
||||
var databaseSettings = _connectionStrings[Constants.System.UmbracoConnectionName];
|
||||
if (_globalSettings.ConfigurationStatus.IsNullOrWhiteSpace()
|
||||
&& databaseSettings.IsConnectionStringConfigured() == false)
|
||||
if (databaseSettings.IsConnectionStringConfigured() == false)
|
||||
{
|
||||
//no version or conn string configured, must be a brand new install
|
||||
return true;
|
||||
|
||||
@@ -125,11 +125,6 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
{
|
||||
//now we have to check if this is really a new install, the db might be configured and might contain data
|
||||
var databaseSettings = _connectionStrings[Constants.System.UmbracoConnectionName];
|
||||
|
||||
//if there's already a version then there should def be a user but in some cases someone may have
|
||||
// left a version number in there but cleared out their db conn string, in that case, it's really a new install.
|
||||
if (_globalSettings.ConfigurationStatus.IsNullOrWhiteSpace() == false && databaseSettings != null) return false;
|
||||
|
||||
if (databaseSettings.IsConnectionStringConfigured() && _databaseBuilder.IsDatabaseConfigured)
|
||||
return _databaseBuilder.HasSomeNonDefaultUser() == false;
|
||||
|
||||
|
||||
@@ -49,10 +49,7 @@ namespace Umbraco.Web.Install.InstallSteps
|
||||
// // for installs, we need to log the super user in
|
||||
// security.PerformLogin(Constants.Security.SuperUserId);
|
||||
// }
|
||||
|
||||
// Update configurationStatus
|
||||
_globalSettings.ConfigurationStatus = _umbracoVersion.SemanticVersion.ToSemanticString();
|
||||
|
||||
|
||||
//reports the ended install
|
||||
_installHelper.InstallStatus(true, "");
|
||||
|
||||
|
||||
@@ -362,9 +362,8 @@ namespace Umbraco.Core.Migrations.Install
|
||||
var hasInstalledVersion = schemaResult.DetermineHasInstalledVersion();
|
||||
//var installedSchemaVersion = schemaResult.DetermineInstalledVersion();
|
||||
//var hasInstalledVersion = !installedSchemaVersion.Equals(new Version(0, 0, 0));
|
||||
|
||||
//If Configuration Status is empty and the determined version is "empty" its a new install - otherwise upgrade the existing
|
||||
if (string.IsNullOrEmpty(_globalSettings.ConfigurationStatus) && !hasInstalledVersion)
|
||||
|
||||
if (!hasInstalledVersion)
|
||||
{
|
||||
if (_runtime.Level == RuntimeLevel.Run)
|
||||
throw new Exception("Umbraco is already configured!");
|
||||
|
||||
@@ -65,16 +65,10 @@ namespace Umbraco.Core.Migrations.Upgrade
|
||||
get
|
||||
{
|
||||
|
||||
// no state in database yet - assume we have something in web.config that makes some sense
|
||||
if (!SemVersion.TryParse(_globalSettings.ConfigurationStatus, out var currentVersion))
|
||||
throw new InvalidOperationException($"Could not get current version from web.config {Constants.AppSettings.ConfigurationStatus} appSetting.");
|
||||
var currentVersion = _umbracoVersion.SemanticVersion;
|
||||
|
||||
// cannot go back in time
|
||||
if (currentVersion > _umbracoVersion.SemanticVersion)
|
||||
throw new InvalidOperationException($"Version {currentVersion} cannot be downgraded to {_umbracoVersion.SemanticVersion}.");
|
||||
|
||||
// only from 7.14.0 and above
|
||||
var minVersion = new SemVersion(7, 14);
|
||||
// only from 8.0.0 and above
|
||||
var minVersion = new SemVersion(8, 0);
|
||||
if (currentVersion < minVersion)
|
||||
throw new InvalidOperationException($"Version {currentVersion} cannot be migrated to {_umbracoVersion.SemanticVersion}."
|
||||
+ $" Please upgrade first to at least {minVersion}.");
|
||||
|
||||
@@ -97,36 +97,36 @@ namespace Umbraco.Core
|
||||
/// </summary>
|
||||
public void DetermineRuntimeLevel(IUmbracoDatabaseFactory databaseFactory, ILogger logger)
|
||||
{
|
||||
var localVersion = _umbracoVersion.LocalVersion; // the local, files, version
|
||||
var codeVersion = SemanticVersion; // the executing code version
|
||||
var connect = false;
|
||||
|
||||
if (localVersion == null)
|
||||
{
|
||||
// there is no local version, we are not installed
|
||||
logger.Debug<RuntimeState>("No local version, need to install Umbraco.");
|
||||
Level = RuntimeLevel.Install;
|
||||
Reason = RuntimeLevelReason.InstallNoVersion;
|
||||
return;
|
||||
}
|
||||
|
||||
if (localVersion < codeVersion)
|
||||
{
|
||||
// there *is* a local version, but it does not match the code version
|
||||
// need to upgrade
|
||||
logger.Debug<RuntimeState>("Local version '{LocalVersion}' < code version '{CodeVersion}', need to upgrade Umbraco.", localVersion, codeVersion);
|
||||
Level = RuntimeLevel.Upgrade;
|
||||
Reason = RuntimeLevelReason.UpgradeOldVersion;
|
||||
}
|
||||
else if (localVersion > codeVersion)
|
||||
{
|
||||
logger.Warn<RuntimeState>("Local version '{LocalVersion}' > code version '{CodeVersion}', downgrading is not supported.", localVersion, codeVersion);
|
||||
|
||||
// in fact, this is bad enough that we want to throw
|
||||
Reason = RuntimeLevelReason.BootFailedCannotDowngrade;
|
||||
throw new BootFailedException($"Local version \"{localVersion}\" > code version \"{codeVersion}\", downgrading is not supported.");
|
||||
}
|
||||
else if (databaseFactory.Configured == false)
|
||||
// var localVersion = _umbracoVersion.LocalVersion; // the local, files, version
|
||||
// var codeVersion = SemanticVersion; // the executing code version
|
||||
var connect = false;
|
||||
//
|
||||
// if (localVersion == null)
|
||||
// {
|
||||
// // there is no local version, we are not installed
|
||||
// logger.Debug<RuntimeState>("No local version, need to install Umbraco.");
|
||||
// Level = RuntimeLevel.Install;
|
||||
// Reason = RuntimeLevelReason.InstallNoVersion;
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (localVersion < codeVersion)
|
||||
// {
|
||||
// // there *is* a local version, but it does not match the code version
|
||||
// // need to upgrade
|
||||
// logger.Debug<RuntimeState>("Local version '{LocalVersion}' < code version '{CodeVersion}', need to upgrade Umbraco.", localVersion, codeVersion);
|
||||
// Level = RuntimeLevel.Upgrade;
|
||||
// Reason = RuntimeLevelReason.UpgradeOldVersion;
|
||||
// }
|
||||
// else if (localVersion > codeVersion)
|
||||
// {
|
||||
// logger.Warn<RuntimeState>("Local version '{LocalVersion}' > code version '{CodeVersion}', downgrading is not supported.", localVersion, codeVersion);
|
||||
//
|
||||
// // in fact, this is bad enough that we want to throw
|
||||
// Reason = RuntimeLevelReason.BootFailedCannotDowngrade;
|
||||
// throw new BootFailedException($"Local version \"{localVersion}\" > code version \"{codeVersion}\", downgrading is not supported.");
|
||||
// }
|
||||
if (databaseFactory.Configured == false)
|
||||
{
|
||||
// local version *does* match code version, but the database is not configured
|
||||
// install - may happen with Deploy/Cloud/etc
|
||||
|
||||
@@ -22,6 +22,13 @@ namespace Umbraco.Web.PublishedCache.NuCache.DataSource
|
||||
// default is 4096, min 2^9 = 512, max 2^16 = 64K
|
||||
FileBlockSize = GetBlockSize(settings),
|
||||
|
||||
|
||||
//HACK: Forces FileOptions to be WriteThrough here: https://github.com/mamift/CSharpTest.Net.Collections/blob/9f93733b3af7ee0e2de353e822ff54d908209b0b/src/CSharpTest.Net.Collections/IO/TransactedCompoundFile.cs#L316-L327,
|
||||
// as the reflection uses otherwise will failed in .NET Core as the "_handle" field in FileStream is renamed to "_fileHandle".
|
||||
StoragePerformance = StoragePerformance.CommitToDisk,
|
||||
|
||||
|
||||
|
||||
// other options?
|
||||
};
|
||||
|
||||
|
||||
@@ -22,7 +22,6 @@ namespace Umbraco.Tests.Common
|
||||
|
||||
var config = Mock.Of<IGlobalSettings>(
|
||||
settings =>
|
||||
settings.ConfigurationStatus == semanticVersion.ToSemanticString() &&
|
||||
settings.UseHttps == false &&
|
||||
settings.HideTopLevelNodeFromPath == false &&
|
||||
settings.TimeOutInMinutes == 20 &&
|
||||
|
||||
@@ -133,10 +133,6 @@ namespace Umbraco.Tests.TestHelpers
|
||||
CreateSqlCeDatabase(); // TODO: faster!
|
||||
}
|
||||
|
||||
// ensure the configuration matches the current version for tests
|
||||
var globalSettingsMock = Mock.Get(Factory.GetInstance<IGlobalSettings>()); //this will modify the IGlobalSettings instance stored in the container
|
||||
globalSettingsMock.Setup(x => x.ConfigurationStatus).Returns(UmbracoVersion.Current.ToString(3));
|
||||
|
||||
using (ProfilingLogger.TraceDuration<TestWithDatabaseBase>("Initialize database."))
|
||||
{
|
||||
InitializeDatabase(); // TODO: faster!
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace Umbraco.Web.Common.Extensions
|
||||
|
||||
IHttpContextAccessor httpContextAccessor = new HttpContextAccessor();
|
||||
services.AddSingleton<IHttpContextAccessor>(httpContextAccessor);
|
||||
var requestCache = new GenericDictionaryRequestAppCache(() => httpContextAccessor.HttpContext.Items);
|
||||
var requestCache = new GenericDictionaryRequestAppCache(() => httpContextAccessor.HttpContext?.Items);
|
||||
|
||||
services.AddUmbracoCore(webHostEnvironment,
|
||||
umbContainer,
|
||||
|
||||
@@ -59,6 +59,9 @@ namespace Umbraco.Web.Common.Runtime
|
||||
|
||||
composition.RegisterUnique<AngularJsonMediaTypeFormatter>();
|
||||
|
||||
// register the umbraco context factory
|
||||
composition.RegisterUnique<IUmbracoContextFactory, UmbracoContextFactory>();
|
||||
|
||||
//register the install components
|
||||
//NOTE: i tried to not have these registered if we weren't installing or upgrading but post install when the site restarts
|
||||
//it still needs to use the install controller so we can't do that
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Umbraco.Examine.Lucene\Umbraco.Examine.Lucene.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Persistance.SqlCe\Umbraco.Persistance.SqlCe.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.PublishedCache.NuCache\Umbraco.PublishedCache.NuCache.csproj" />
|
||||
<ProjectReference Include="..\Umbraco.Web.BackOffice\Umbraco.Web.BackOffice.csproj" />
|
||||
@@ -49,6 +50,7 @@
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Microsoft.AspNetCore.Mvc.NewtonsoftJson" Version="3.1.3" />
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.7.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -1,7 +1,4 @@
|
||||
{
|
||||
"ConnectionStrings": {
|
||||
"umbracoDbDSN": ""
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
{
|
||||
"ConnectionStrings": {},
|
||||
"ConnectionStrings": {
|
||||
"umbracoDbDSN": "Data Source=|DataDirectory|\\Umbraco.sdf;Flush Interval=1;"
|
||||
},
|
||||
"Logging": {
|
||||
"LogLevel": {
|
||||
"Default": "Information",
|
||||
@@ -117,4 +119,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user