AB#6233 - Cleanup / Fixes from review

This commit is contained in:
Bjarke Berg
2020-05-05 14:28:01 +02:00
parent ecc596c483
commit 13197eb5ff
17 changed files with 51 additions and 36 deletions

View File

@@ -164,7 +164,7 @@ namespace Umbraco.Web.Compose
// only perform this one time ever
LazyInitializer.EnsureInitialized(ref _tasks, ref _started, ref _locker, () =>
{
var serverAddress = _runtime.ApplicationUrl?.ToString();
var serverAddress = _runtime.ApplicationUrl.ToString();
return new[]
{

View File

@@ -20,11 +20,11 @@ namespace Umbraco.Web.Composing.CompositionExtensions
composition.Register<DatabaseUpgradeStep>(Lifetime.Scope);
// TODO: Add these back once we have a compatible Starter kit
// composition.Register<InstallSetupStep, StarterKitDownloadStep>(Lifetime.Scope);
// composition.Register<InstallSetupStep, StarterKitInstallStep>(Lifetime.Scope);
// composition.Register<InstallSetupStep, StarterKitCleanupStep>(Lifetime.Scope);
// composition.Register<StarterKitDownloadStep>(Lifetime.Scope);
// composition.Register<StarterKitInstallStep>(Lifetime.Scope);
// composition.Register<StarterKitCleanupStep>(Lifetime.Scope);
composition.Register<InstallSetupStep, SetUmbracoVersionStep>(Lifetime.Scope);
composition.Register<SetUmbracoVersionStep>(Lifetime.Scope);
composition.Register<InstallStepCollection>();
composition.Register<InstallHelper>();

View File

@@ -59,7 +59,7 @@ namespace Umbraco.Web.Install.InstallSteps
_userService.Save(admin);
//TODO: This needs to be reintroduced, when members are compatible with ASP.NET Core Identity.
//TODO: This needs to be reintroduced, when users are compatible with ASP.NET Core Identity.
// var userManager = _httpContextAccessor.GetRequiredHttpContext().GetOwinContext().GetBackOfficeUserManager();
// var membershipUser = await userManager.FindByIdAsync(Constants.Security.SuperUserId.ToString());
// if (membershipUser == null)

View File

@@ -27,6 +27,7 @@ namespace Umbraco.Web.Install.InstallSteps
public override Task<InstallSetupResult> ExecuteAsync(object model)
{
//TODO: This needs to be reintroduced, when users are compatible with ASP.NET Core Identity.
// var security = _umbracoContextAccessor.GetRequiredUmbracoContext().Security;
// if (security.IsAuthenticated() == false && _globalSettings.ConfigurationStatus.IsNullOrWhiteSpace())
// {

View File

@@ -5,14 +5,4 @@
string ProviderName { get; }
void Create();
}
public class NoopEmbeddedDatabaseCreator : IEmbeddedDatabaseCreator
{
public string ProviderName => Constants.DatabaseProviders.SqlServer;
public void Create()
{
}
}
}

View File

@@ -0,0 +1,12 @@
namespace Umbraco.Core.Persistence
{
public class NoopEmbeddedDatabaseCreator : IEmbeddedDatabaseCreator
{
public string ProviderName => Constants.DatabaseProviders.SqlServer;
public void Create()
{
}
}
}

View File

@@ -28,7 +28,6 @@ namespace Umbraco.Web.BackOffice.Controllers
// GET
public IActionResult Index()
{
_umbracoApplicationLifetime.Restart(); //TODO remove
return View();
}

View File

@@ -1,5 +1,6 @@
using System.Collections.Generic;
using Microsoft.AspNetCore.Mvc.ViewFeatures;
using Semver;
namespace Umbraco.Web
@@ -9,6 +10,7 @@ namespace Umbraco.Web
public const string TokenUmbracoPath = "UmbracoPath";
public const string TokenInstallApiBaseUrl = "InstallApiBaseUrl";
public const string TokenUmbracoBaseFolder = "UmbracoBaseFolder";
public const string TokenUmbracoVersion = "UmbracoVersion";
public const string TokenExternalSignInError = "ExternalSignInError";
public const string TokenPasswordResetCode = "PasswordResetCode";
@@ -48,6 +50,15 @@ namespace Umbraco.Web
{
viewData[TokenUmbracoBaseFolder] = value;
}
public static void SetUmbracoVersion(this ViewDataDictionary viewData, SemVersion version)
{
viewData[TokenUmbracoVersion] = version;
}
public static SemVersion GetUmbracoVersion(this ViewDataDictionary viewData)
{
return (SemVersion) viewData[TokenUmbracoVersion];
}
public static IEnumerable<string> GetExternalSignInError(this ViewDataDictionary viewData)
{

View File

@@ -24,6 +24,7 @@ namespace Umbraco.Web.Common.Install
private readonly IRuntimeState _runtime;
private readonly IGlobalSettings _globalSettings;
private readonly IHostingEnvironment _hostingEnvironment;
private readonly IUmbracoVersion _umbracoVersion;
private readonly IRuntimeMinifier _runtimeMinifier;
public InstallController(
@@ -32,7 +33,8 @@ namespace Umbraco.Web.Common.Install
IRuntimeState runtime,
IGlobalSettings globalSettings,
IRuntimeMinifier runtimeMinifier,
IHostingEnvironment hostingEnvironment)
IHostingEnvironment hostingEnvironment,
IUmbracoVersion umbracoVersion)
{
_umbracoContextAccessor = umbracoContextAccessor;
_installHelper = installHelper;
@@ -40,6 +42,7 @@ namespace Umbraco.Web.Common.Install
_globalSettings = globalSettings;
_runtimeMinifier = runtimeMinifier;
_hostingEnvironment = hostingEnvironment;
_umbracoVersion = umbracoVersion;
}
[HttpGet]
@@ -64,12 +67,14 @@ namespace Umbraco.Web.Common.Install
}
}
// gen the install base url
// gen the install base urlAddUmbracoCore
ViewData.SetInstallApiBaseUrl(Url.GetUmbracoApiService("GetSetup", "InstallApi", "UmbracoInstall").TrimEnd("GetSetup"));
// get the base umbraco folder
ViewData.SetUmbracoBaseFolder(_hostingEnvironment.ToAbsolute(_globalSettings.UmbracoPath));
ViewData.SetUmbracoVersion(_umbracoVersion.SemanticVersion);
_installHelper.InstallStatus(false, "");
// always ensure full path (see NOTE in the class remarks)

View File

@@ -10,7 +10,7 @@
//dealing with requests:
'request': function (config) {
if (!Umbraco.Sys.ServerVariables.umbracoSettings.umbracoPath) {
if (!Umbraco.Sys.ServerVariablesUmbraco.Sys.ServerVariables.umbracoSettings.umbracoPath) {
// no settings available, we're probably on the login screen
return config;
}

View File

@@ -237,7 +237,7 @@ angular.module("umbraco.install").factory('installerService', function ($rootSco
service.status.feedback = getDescriptionForStepAtIndex(service.status.steps, 0);
service.status.progress = 0;
function processInstallStep(retry) {
function processInstallStep() {
$http.post(Umbraco.Sys.ServerVariables.installApiBaseUrl + "PostPerformInstall", _installerModel)
.then(function (response) {

View File

@@ -1,5 +1,6 @@
angular.module("umbraco.install").controller("Umbraco.Install.UserController", function($scope, installerService) {
$scope.majorVersion = Umbraco.Sys.ServerVariables.application.version;
$scope.passwordPattern = /.*/;
$scope.installer.current.model.subscribeToNewsLetter = false;

View File

@@ -1,7 +1,7 @@
<div ng-controller="Umbraco.Install.UserController">
<h1>Install Umbraco 9</h1>
<h1>Install Umbraco {{majorVersion}}</h1>
<p>Enter your name, email and password to install Umbraco 9 with its default settings, alternatively you can customize your installation</p>
<p>Enter your name, email and password to install Umbraco {{majorVersion}} with its default settings, alternatively you can customize your installation</p>
<form name="myForm" class="form-horizontal" novalidate ng-submit="validateAndInstall();">
@@ -15,7 +15,7 @@
</div>
</div>
<div class="control-group">
<div class="control-group">processInstallStep
<label class="control-label" for="email">Email</label>
<div class="controls">
<input type="email" id="email" name="email" placeholder="you@example.com" val-email required ng-model="installer.current.model.email" />

View File

@@ -5,7 +5,7 @@
*
* @description
* The controller for the doc type creation dialog
*/
*/Umbraco.Sys.ServerVariables
function DocumentTypesCreateController($scope, $location, navigationService, contentTypeResource, formHelper, appState, notificationsService, localizationService, iconHelper) {
$scope.model = {

View File

@@ -1,4 +1,5 @@
@using Umbraco.Web
@using Umbraco.Composing
@{
Layout = null;
}
@@ -67,7 +68,10 @@
Umbraco.Sys = {};
Umbraco.Sys.ServerVariables = {
"installApiBaseUrl": "@ViewData.GetInstallApiBaseUrl()",
"umbracoBaseUrl": "@ViewData.GetUmbracoBaseFolder()"
"umbracoBaseUrl": "@ViewData.GetUmbracoBaseFolder()",
"application": {
version: "@ViewData.GetUmbracoVersion().Major"
}
};
</script>
<script src="lib/lazyload-js/lazyload.min.js"></script>

View File

@@ -1,6 +1,6 @@
{
"ConnectionStrings": {
"umbracoDbDSN": "Data Source=|DataDirectory|\\Umbraco.sdf;Flush Interval=1;"
"umbracoDbDSN": ""
},
"Logging": {
"LogLevel": {
@@ -119,4 +119,4 @@
}
}
}
}
}

View File

@@ -15,8 +15,6 @@ namespace Umbraco.Web
/// </summary>
public class UmbracoContextFactory : IUmbracoContextFactory
{
private static readonly NullWriter NullWriterInstance = new NullWriter();
private readonly IUmbracoContextAccessor _umbracoContextAccessor;
private readonly IPublishedSnapshotService _publishedSnapshotService;
private readonly IVariationContextAccessor _variationContextAccessor;
@@ -87,11 +85,5 @@ namespace Umbraco.Web
return new UmbracoContextReference(umbracoContext, true, _umbracoContextAccessor);
}
// dummy TextWriter that does not write
private class NullWriter : TextWriter
{
public override Encoding Encoding => Encoding.UTF8;
}
}
}