From 14e402878ae12fd9db11f2b43bf6f536d00ec151 Mon Sep 17 00:00:00 2001 From: Niels Hartvig Date: Tue, 10 Jan 2017 14:49:19 +0100 Subject: [PATCH] Merge conflict fixes --- src/Umbraco.Core/Services/MediaService.cs | 38 +++++++++++++++++-- .../Editors/BackOfficeController.cs | 8 ++++ .../Editors/ContentControllerBase.cs | 7 ++++ src/Umbraco.Web/Umbraco.Web.csproj | 13 ++++++- 4 files changed, 62 insertions(+), 4 deletions(-) diff --git a/src/Umbraco.Core/Services/MediaService.cs b/src/Umbraco.Core/Services/MediaService.cs index bd373f1ec0..8e4d98ddb7 100644 --- a/src/Umbraco.Core/Services/MediaService.cs +++ b/src/Umbraco.Core/Services/MediaService.cs @@ -7,19 +7,18 @@ using System.Linq; using System.Text.RegularExpressions; using System.Threading; using System.Xml.Linq; -using Umbraco.Core.Auditing; using Umbraco.Core.Configuration; using Umbraco.Core.Events; +using Umbraco.Core.IO; using Umbraco.Core.Logging; +using Umbraco.Core.Media; using Umbraco.Core.Models; using Umbraco.Core.Models.Rdbms; using Umbraco.Core.Persistence; using Umbraco.Core.Persistence.DatabaseModelDefinitions; using Umbraco.Core.Persistence.Querying; using Umbraco.Core.Persistence.Repositories; -using Umbraco.Core.Persistence.SqlSyntax; using Umbraco.Core.Persistence.UnitOfWork; -using Umbraco.Core.Publishing; namespace Umbraco.Core.Services { @@ -36,6 +35,7 @@ namespace Umbraco.Core.Services private readonly EntityXmlSerializer _entitySerializer = new EntityXmlSerializer(); private readonly IDataTypeService _dataTypeService; private readonly IUserService _userService; + private readonly MediaFileSystem _mediaFileSystem = FileSystemProviderManager.Current.MediaFileSystem; public MediaService(IDatabaseUnitOfWorkProvider provider, RepositoryFactory repositoryFactory, ILogger logger, IEventMessagesFactory eventMessagesFactory, IDataTypeService dataTypeService, IUserService userService) : base(provider, repositoryFactory, logger, eventMessagesFactory) @@ -1325,6 +1325,38 @@ namespace Umbraco.Core.Services } } + public Stream GetMediaFileContentStream(string filepath) + { + if (_mediaFileSystem.FileExists(filepath) == false) + return null; + try + { + return _mediaFileSystem.OpenFile(filepath); + } + catch + { + return null; // deal with race conds + } + } + + public void SetMediaFileContent(string filepath, Stream stream) + { + _mediaFileSystem.AddFile(filepath, stream, true); + } + + public void DeleteMediaFile(string filepath) + { + _mediaFileSystem.DeleteFile(filepath, true); + } + + public void GenerateThumbnails(string filepath, PropertyType propertyType) + { + using (var filestream = _mediaFileSystem.OpenFile(filepath)) + { + _mediaFileSystem.GenerateThumbnails(filestream, filepath, propertyType); + } + } + /// /// Hack: This is used to fix some data if an entity's properties are invalid/corrupt /// diff --git a/src/Umbraco.Web/Editors/BackOfficeController.cs b/src/Umbraco.Web/Editors/BackOfficeController.cs index 50c8b2e82c..376606ff5c 100644 --- a/src/Umbraco.Web/Editors/BackOfficeController.cs +++ b/src/Umbraco.Web/Editors/BackOfficeController.cs @@ -332,6 +332,10 @@ namespace Umbraco.Web.Editors "tagApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl( controller => controller.GetAllTags(null)) }, + { + "templateApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl( + controller => controller.GetById(0)) + }, { "memberTreeBaseUrl", Url.GetUmbracoApiServiceBaseUrl( controller => controller.GetNodes("-1", null)) @@ -360,6 +364,10 @@ namespace Umbraco.Web.Editors "healthCheckBaseUrl", Url.GetUmbracoApiServiceBaseUrl( controller => controller.GetAllHealthChecks()) }, + { + "templateQueryApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl( + controller => controller.PostTemplateQuery(null)) + }, { "codeFileApiBaseUrl", Url.GetUmbracoApiServiceBaseUrl( controller => controller.GetByPath("", "")) diff --git a/src/Umbraco.Web/Editors/ContentControllerBase.cs b/src/Umbraco.Web/Editors/ContentControllerBase.cs index 0cddb6fcd5..cba29060b3 100644 --- a/src/Umbraco.Web/Editors/ContentControllerBase.cs +++ b/src/Umbraco.Web/Editors/ContentControllerBase.cs @@ -97,6 +97,13 @@ namespace Umbraco.Web.Editors var dictionary = new Dictionary(); //add the files if any var files = contentItem.UploadedFiles.Where(x => x.PropertyAlias == property.Alias).ToArray(); + if (files.Length > 0) + { + dictionary.Add("files", files); + // add extra things needed to figure out where to put the files + dictionary.Add("cuid", contentItem.PersistedContent.Key); + dictionary.Add("puid", dboProperty.PropertyType.Key); + } foreach (var file in files) file.FileName = file.FileName.ToSafeFileName(); diff --git a/src/Umbraco.Web/Umbraco.Web.csproj b/src/Umbraco.Web/Umbraco.Web.csproj index 14c3e44dba..f9f6446491 100644 --- a/src/Umbraco.Web/Umbraco.Web.csproj +++ b/src/Umbraco.Web/Umbraco.Web.csproj @@ -133,6 +133,10 @@ ..\packages\Microsoft.AspNet.Identity.Owin.2.2.1\lib\net45\Microsoft.AspNet.Identity.Owin.dll + + ..\packages\Microsoft.AspNet.SignalR.Core.2.2.1\lib\net45\Microsoft.AspNet.SignalR.Core.dll + True + ..\packages\Microsoft.Owin.3.0.1\lib\net45\Microsoft.Owin.dll @@ -186,6 +190,10 @@ + + ..\packages\System.Threading.Tasks.Dataflow.4.6.0\lib\netstandard1.1\System.Threading.Tasks.Dataflow.dll + True + 3.5 @@ -277,6 +285,7 @@ + @@ -328,11 +337,13 @@ + + @@ -504,7 +515,6 @@ - @@ -2208,6 +2218,7 @@ umbraco_org_umbraco_update_CheckForUpgrade + 11.0 $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v11.0