Post merge - Move files into correct locations

This commit is contained in:
Bjarke Berg
2020-02-20 08:33:28 +01:00
parent e96d094c71
commit 79ee20a45b
7 changed files with 30 additions and 30 deletions

View File

@@ -1,15 +1,21 @@
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Text;
using System.Threading.Tasks;
using Umbraco.Core.Models;
using Umbraco.Core.Serialization;
namespace Umbraco.Core.Persistence.Repositories.Implement
{
internal class InstallationRepository : IInstallationRepository
public class InstallationRepository : IInstallationRepository
{
private readonly IJsonSerializer _jsonSerializer;
private static HttpClient _httpClient;
private const string RestApiInstallUrl = "https://our.umbraco.com/umbraco/api/Installation/Install";
public InstallationRepository(IJsonSerializer jsonSerializer)
{
_jsonSerializer = jsonSerializer;
}
public async Task SaveInstallLogAsync(InstallLog installLog)
{
@@ -18,7 +24,9 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (_httpClient == null)
_httpClient = new HttpClient();
await _httpClient.PostAsync(RestApiInstallUrl, installLog, new JsonMediaTypeFormatter());
var content = new StringContent(_jsonSerializer.Serialize(installLog), Encoding.UTF8, "application/json");
await _httpClient.PostAsync(RestApiInstallUrl, content);
}
// this occurs if the server for Our is down or cannot be reached
catch (HttpRequestException)

View File

@@ -1,16 +1,22 @@
using System.Net.Http;
using System.Net.Http.Formatting;
using System.Text;
using System.Threading.Tasks;
using Semver;
using Umbraco.Core.Models;
using Umbraco.Core.Serialization;
namespace Umbraco.Core.Persistence.Repositories.Implement
{
internal class UpgradeCheckRepository : IUpgradeCheckRepository
public class UpgradeCheckRepository : IUpgradeCheckRepository
{
private readonly IJsonSerializer _jsonSerializer;
private static HttpClient _httpClient;
private const string RestApiUpgradeChecklUrl = "https://our.umbraco.com/umbraco/api/UpgradeCheck/CheckUpgrade";
public UpgradeCheckRepository(IJsonSerializer jsonSerializer)
{
_jsonSerializer = jsonSerializer;
}
public async Task<UpgradeResult> CheckUpgradeAsync(SemVersion version)
{
@@ -19,8 +25,11 @@ namespace Umbraco.Core.Persistence.Repositories.Implement
if (_httpClient == null)
_httpClient = new HttpClient();
var task = await _httpClient.PostAsync(RestApiUpgradeChecklUrl, new CheckUpgradeDto(version), new JsonMediaTypeFormatter());
var result = await task.Content.ReadAsAsync<UpgradeResult>();
var content = new StringContent(_jsonSerializer.Serialize(new CheckUpgradeDto(version)), Encoding.UTF8, "application/json");
var task = await _httpClient.PostAsync(RestApiUpgradeChecklUrl,content);
var json = await task.Content.ReadAsStringAsync();
var result = _jsonSerializer.Deserialize<UpgradeResult>(json);
return result ?? new UpgradeResult("None", "", "");
}

View File

@@ -6,7 +6,7 @@ using Umbraco.Core.Services;
namespace Umbraco.Core
{
internal class UpgradeService : IUpgradeService
public class UpgradeService : IUpgradeService
{
private readonly IUpgradeCheckRepository _upgradeCheckRepository;

View File

@@ -42,16 +42,11 @@ namespace Umbraco.Web.Editors
_umbracoVersion.Current.Build, _umbracoVersion.Comment);
var result = await _upgradeService.CheckUpgrade(version);
return new UpgradeCheckResponse(result.UpgradeType, result.Comment, result.UpgradeUrl);
return new UpgradeCheckResponse(result.UpgradeType, result.Comment, result.UpgradeUrl, _umbracoVersion);
}
catch (System.Net.WebException)
catch
{
//this occurs if the server is down or cannot be reached
return null;
}
catch (System.Web.Services.Protocols.SoapException)
{
//this occurs if the server has a timeout
//We don't want to crash due to this
return null;
}
}

View File

@@ -1,4 +1,4 @@
using System.IO;
using System;
using System.Web;
namespace Umbraco.Web
@@ -9,7 +9,7 @@ namespace Umbraco.Web
{
var httpContext = httpContextAccessor.HttpContext;
if(httpContext is null) throw new IOException("HttpContext is null");
if(httpContext is null) throw new InvalidOperationException("HttpContext is null");
return httpContext;
}

View File

@@ -647,13 +647,6 @@
</Compile>
<Compile Include="UmbracoApplication.cs" />
<Compile Include="UmbracoInjectedModule.cs" />
<Compile Include="Web References\org.umbraco.update\Reference.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Reference.map</DependentUpon>
</Compile>
<Compile Include="UriUtility.cs" />
<Compile Include="UmbracoAuthorizedHttpHandler.cs" />
<Compile Include="UmbracoHttpHandler.cs" />
<Compile Include="UmbracoWebService.cs">
<SubType>Component</SubType>
@@ -685,11 +678,6 @@
<None Include="..\Umbraco.Web.UI\Views\web.config">
<Link>Mvc\web.config</Link>
</None>
<None Include="Web References\org.umbraco.update\UpgradeResult.datasource">
<DependentUpon>Reference.map</DependentUpon>
</None>
<None Include="Web References\org.umbraco.update\UpgradeResult1.datasource">
<DependentUpon>Reference.map</DependentUpon>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>