mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Moving media, appdata, and vpp services into Orchard.FileSystems namespace
--HG-- branch : dev
This commit is contained in:
@@ -1,12 +1,12 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Azure.Storage;
|
||||
using Orchard.Azure.FileSystems.Media;
|
||||
using Microsoft.WindowsAzure;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Configuration;
|
||||
|
||||
namespace Orchard.Azure.Tests.Storage {
|
||||
namespace Orchard.Azure.Tests.FileSystems.Media {
|
||||
[TestFixture]
|
||||
public class AzureBlobStorageProviderTests : AzureVirtualEnvironmentTest {
|
||||
|
||||
@@ -151,4 +151,4 @@ namespace Orchard.Azure.Tests.Storage {
|
||||
Assert.AreEqual(teststring, content);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -56,7 +56,7 @@
|
||||
<Compile Include="AzureVirtualEnvironmentTest.cs" />
|
||||
<Compile Include="Environment\Configuration\AzureShellSettingsManagerTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Storage\AzureBlobStorageProviderTests.cs" />
|
||||
<Compile Include="FileSystems\Media\AzureBlobStorageProviderTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Orchard.Azure\Orchard.Azure.csproj">
|
||||
|
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using Microsoft.WindowsAzure;
|
||||
using Microsoft.WindowsAzure.StorageClient;
|
||||
using System.IO;
|
||||
using Orchard.Storage;
|
||||
using Orchard.FileSystems.Media;
|
||||
|
||||
namespace Orchard.Azure {
|
||||
public class AzureFileSystem {
|
||||
|
@@ -3,8 +3,9 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.FileSystems.AppData;
|
||||
|
||||
namespace Orchard.Azure.Environment.Configuration {
|
||||
namespace Orchard.Azure.FileSystems.AppData {
|
||||
public class AzureAppDataFolder : IAppDataFolder {
|
||||
|
||||
private readonly AzureFileSystem _fs;
|
||||
@@ -62,4 +63,4 @@ namespace Orchard.Azure.Environment.Configuration {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,9 +1,8 @@
|
||||
using Microsoft.WindowsAzure;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Storage;
|
||||
|
||||
namespace Orchard.Azure.Storage {
|
||||
using Orchard.FileSystems.Media;
|
||||
|
||||
namespace Orchard.Azure.FileSystems.Media {
|
||||
public class AzureBlobStorageProvider : AzureFileSystem, IStorageProvider {
|
||||
|
||||
public AzureBlobStorageProvider(ShellSettings shellSettings)
|
||||
@@ -12,6 +11,4 @@ namespace Orchard.Azure.Storage {
|
||||
|
||||
public AzureBlobStorageProvider(ShellSettings shellSettings, CloudStorageAccount storageAccount) : base("media", shellSettings.Name, false, storageAccount) { }
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
@@ -14,13 +14,13 @@
|
||||
</component>
|
||||
|
||||
<component instance-scope="single-instance"
|
||||
type="Orchard.Azure.Storage.AzureBlobStorageProvider, Orchard.Azure"
|
||||
service="Orchard.Storage.IStorageProvider">
|
||||
type="Orchard.Azure.FileSystems.Media.AzureBlobStorageProvider, Orchard.Azure"
|
||||
service="Orchard.FileSystems.Media.IStorageProvider">
|
||||
</component>
|
||||
|
||||
<component instance-scope="single-instance"
|
||||
type="Orchard.Azure.Environment.Configuration.AzureAppDataFolder, Orchard.Azure"
|
||||
service="Orchard.Environment.Configuration.IAppDataFolder">
|
||||
type="Orchard.Azure.FileSystems.AppData.AzureAppDataFolder, Orchard.Azure"
|
||||
service="Orchard.FileSystems.AppData.IAppDataFolder">
|
||||
</component>
|
||||
|
||||
|
||||
|
@@ -51,9 +51,9 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="CloudBlobContainerExtensions.cs" />
|
||||
<Compile Include="Environment\Configuration\AzureAppDataFolder.cs" />
|
||||
<Compile Include="FileSystems\AppData\AzureAppDataFolder.cs" />
|
||||
<Compile Include="Environment\Configuration\AzureShellSettingsManager.cs" />
|
||||
<Compile Include="Storage\AzureBlobStorageProvider.cs" />
|
||||
<Compile Include="FileSystems\Media\AzureBlobStorageProvider.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="AzureFileSystem.cs" />
|
||||
</ItemGroup>
|
||||
|
@@ -6,7 +6,8 @@ using NUnit.Framework;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment;
|
||||
using Autofac;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Tests.Caching {
|
||||
@@ -38,7 +39,7 @@ namespace Orchard.Tests.Caching {
|
||||
|
||||
[Test]
|
||||
public void HostLevelHasAccessToGlobalVolatileProviders() {
|
||||
Assert.That(_hostContainer.Resolve<IVirtualPathProvider>(), Is.Not.Null);
|
||||
Assert.That(_hostContainer.Resolve<IWebSiteFolder>(), Is.Not.Null);
|
||||
Assert.That(_hostContainer.Resolve<IAppDataFolder>(), Is.Not.Null);
|
||||
Assert.That(_hostContainer.Resolve<IClock>(), Is.Not.Null);
|
||||
}
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.AppData;
|
||||
|
||||
namespace Orchard.Tests.Environment.Configuration {
|
||||
[TestFixture]
|
||||
|
@@ -3,7 +3,7 @@ using System.Linq;
|
||||
using Moq;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.AppData;
|
||||
|
||||
namespace Orchard.Tests.Environment.Configuration {
|
||||
[TestFixture]
|
||||
|
@@ -15,10 +15,10 @@ using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Folders;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.Environment.ShellBuilders;
|
||||
using Orchard.Environment.Topology;
|
||||
using Orchard.Environment.Topology.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Mvc;
|
||||
using Orchard.Mvc.ModelBinders;
|
||||
using Orchard.Mvc.Routes;
|
||||
|
@@ -3,9 +3,9 @@ using System.Runtime.Serialization;
|
||||
using System.Xml;
|
||||
using Autofac;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.Environment.Topology;
|
||||
using Orchard.Environment.Topology.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
|
||||
namespace Orchard.Tests.Environment.Topology {
|
||||
[TestFixture]
|
||||
|
@@ -4,7 +4,7 @@ using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using System;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Storage;
|
||||
using Orchard.FileSystems.Media;
|
||||
|
||||
namespace Orchard.Tests.Storage {
|
||||
[TestFixture]
|
||||
|
@@ -5,8 +5,8 @@ using System.Text;
|
||||
using System.Web;
|
||||
using ICSharpCode.SharpZipLib.Zip;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.FileSystems.Media;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Storage;
|
||||
using Orchard.Media.Models;
|
||||
|
||||
namespace Orchard.Media.Services {
|
||||
|
@@ -9,10 +9,10 @@ using Orchard.Core.Settings.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.Environment.ShellBuilders;
|
||||
using Orchard.Environment.Topology;
|
||||
using Orchard.Environment.Topology.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Setup.Services;
|
||||
|
@@ -63,6 +63,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "Orchard.
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Profile", "Orchard.Profile\Orchard.Profile.csproj", "{94E694A2-D140-468D-A277-C5FCE1D13E9B}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Azure", "Azure", "{55E8934A-9C5B-4647-8DE0-50E48B423339}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure", "Orchard.Azure\Orchard.Azure.csproj", "{2505AA84-65A6-43D0-9C27-4F44FD576284}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Web", "Orchard.Azure\Orchard.Azure.Web\Orchard.Azure.Web.csproj", "{0DF8F426-9F30-4918-8F64-A5B40BA12D10}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Azure.Tests", "Orchard.Azure.Tests\Orchard.Azure.Tests.csproj", "{1CC62F45-E6FF-43D5-84BF-509A1085D994}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -177,6 +185,18 @@ Global
|
||||
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{94E694A2-D140-468D-A277-C5FCE1D13E9B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -206,5 +226,8 @@ Global
|
||||
{4AB4B5B6-277E-4FF6-B69B-7AE9E16D2A56} = {383DBA32-4A3E-48D1-AAC3-75377A694452}
|
||||
{33B1BC8D-E292-4972-A363-22056B207156} = {383DBA32-4A3E-48D1-AAC3-75377A694452}
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6} = {E75A4CE4-CAA6-41E4-B951-33ACC60DC77C}
|
||||
{2505AA84-65A6-43D0-9C27-4F44FD576284} = {55E8934A-9C5B-4647-8DE0-50E48B423339}
|
||||
{0DF8F426-9F30-4918-8F64-A5B40BA12D10} = {55E8934A-9C5B-4647-8DE0-50E48B423339}
|
||||
{1CC62F45-E6FF-43D5-84BF-509A1085D994} = {55E8934A-9C5B-4647-8DE0-50E48B423339}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@@ -3,9 +3,9 @@ using System.IO;
|
||||
using NHibernate;
|
||||
using Orchard.Data.Builders;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.Environment.Topology;
|
||||
using Orchard.Environment.Topology.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Data {
|
||||
|
@@ -3,7 +3,7 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Yaml.Serialization;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Environment.Configuration {
|
||||
|
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Folders {
|
||||
public class AreaFolders : ExtensionFolders {
|
||||
public AreaFolders(IEnumerable<string> paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) :
|
||||
base(paths, "Module.txt", true/*isManifestOptional*/, cacheManager, virtualPathProvider) {
|
||||
public AreaFolders(IEnumerable<string> paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) :
|
||||
base(paths, "Module.txt", true/*isManifestOptional*/, cacheManager, webSiteFolder) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -6,7 +6,7 @@ using System.Web.Hosting;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.Extensions.Helpers;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
using Yaml.Grammar;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Folders {
|
||||
@@ -22,28 +22,28 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
private readonly string _extensionType;
|
||||
private readonly bool _manifestIsOptional;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
private readonly IVirtualPathProvider _virtualPathProvider;
|
||||
private readonly IWebSiteFolder _webSiteFolder;
|
||||
|
||||
protected ExtensionFolders(
|
||||
IEnumerable<string> paths,
|
||||
string manifestName,
|
||||
bool manifestIsOptional,
|
||||
ICacheManager cacheManager,
|
||||
IVirtualPathProvider virtualPathProvider) {
|
||||
IWebSiteFolder webSiteFolder) {
|
||||
_paths = paths;
|
||||
_manifestName = manifestName;
|
||||
_extensionType = manifestName == "Theme.txt" ? "Theme" : "Module";
|
||||
_manifestIsOptional = manifestIsOptional;
|
||||
_cacheManager = cacheManager;
|
||||
_virtualPathProvider = virtualPathProvider;
|
||||
_webSiteFolder = webSiteFolder;
|
||||
}
|
||||
|
||||
public IEnumerable<ExtensionDescriptor> AvailableExtensions() {
|
||||
var list = new List<ExtensionDescriptor>();
|
||||
foreach (var locationPath in _paths) {
|
||||
var subfolderPaths = _cacheManager.Get(locationPath, ctx => {
|
||||
ctx.Monitor(_virtualPathProvider.WhenPathChanges(ctx.Key));
|
||||
return _virtualPathProvider.GetSubfolderPaths(ctx.Key);
|
||||
ctx.Monitor(_webSiteFolder.WhenPathChanges(ctx.Key));
|
||||
return _webSiteFolder.ListDirectories(ctx.Key);
|
||||
});
|
||||
foreach (var subfolderPath in subfolderPaths) {
|
||||
var extensionName = Path.GetFileName(subfolderPath.TrimEnd('/', '\\'));
|
||||
@@ -59,9 +59,9 @@ namespace Orchard.Environment.Extensions.Folders {
|
||||
ExtensionDescriptor GetExtensionDescriptor(string locationPath, string extensionName, string manifestPath) {
|
||||
return _cacheManager.Get(manifestPath, context => {
|
||||
|
||||
context.Monitor(_virtualPathProvider.WhenPathChanges(manifestPath));
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(manifestPath));
|
||||
|
||||
var manifestText = _virtualPathProvider.ReadAllText(manifestPath);
|
||||
var manifestText = _webSiteFolder.ReadFile(manifestPath);
|
||||
if (manifestText == null) {
|
||||
if (_manifestIsOptional) {
|
||||
manifestText = string.Format("name: {0}", extensionName);
|
||||
|
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Folders {
|
||||
public class ModuleFolders : ExtensionFolders {
|
||||
public ModuleFolders(IEnumerable<string> paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) :
|
||||
base(paths, "Module.txt", false/*isManifestOptional*/, cacheManager, virtualPathProvider) {
|
||||
public ModuleFolders(IEnumerable<string> paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) :
|
||||
base(paths, "Module.txt", false/*isManifestOptional*/, cacheManager, webSiteFolder) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
|
||||
namespace Orchard.Environment.Extensions.Folders {
|
||||
public class ThemeFolders : ExtensionFolders {
|
||||
public ThemeFolders(IEnumerable<string> paths, ICacheManager cacheManager, IVirtualPathProvider virtualPathProvider) :
|
||||
base(paths, "Theme.txt", false/*manifestIsOptional*/, cacheManager, virtualPathProvider) {
|
||||
public ThemeFolders(IEnumerable<string> paths, ICacheManager cacheManager, IWebSiteFolder webSiteFolder) :
|
||||
base(paths, "Theme.txt", false/*manifestIsOptional*/, cacheManager, webSiteFolder) {
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,11 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Caching;
|
||||
|
||||
namespace Orchard.Environment.FileSystems {
|
||||
public interface IVirtualPathProvider : IVolatileProvider {
|
||||
IEnumerable<string> GetSubfolderPaths(string virtualPath);
|
||||
string ReadAllText(string virtualPath);
|
||||
|
||||
IVolatileToken WhenPathChanges(string path);
|
||||
}
|
||||
}
|
@@ -11,10 +11,11 @@ using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Folders;
|
||||
using Orchard.Environment.Extensions.Loaders;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.Environment.ShellBuilders;
|
||||
using Orchard.Environment.Topology;
|
||||
using Orchard.Events;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.FileSystems.WebSite;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Services;
|
||||
|
||||
@@ -30,7 +31,7 @@ namespace Orchard.Environment {
|
||||
builder.RegisterType<DefaultOrchardEventBus>().As<IEventBus>().SingleInstance();
|
||||
builder.RegisterType<DefaultCacheHolder>().As<ICacheHolder>().SingleInstance();
|
||||
|
||||
RegisterVolatileProvider<DefaultVirtualPathProvider, IVirtualPathProvider>(builder);
|
||||
RegisterVolatileProvider<WebSiteFolder, IWebSiteFolder>(builder);
|
||||
RegisterVolatileProvider<AppDataFolder, IAppDataFolder>(builder);
|
||||
RegisterVolatileProvider<Clock, IClock>(builder);
|
||||
|
||||
|
@@ -2,8 +2,8 @@
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml;
|
||||
using Orchard.Environment.FileSystems;
|
||||
using Orchard.Environment.Topology.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
|
||||
|
@@ -3,7 +3,7 @@ using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web.Hosting;
|
||||
|
||||
namespace Orchard.Environment.FileSystems {
|
||||
namespace Orchard.FileSystems.AppData {
|
||||
public class AppDataFolder : IAppDataFolder {
|
||||
protected string _basePath;
|
||||
|
@@ -1,7 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Caching;
|
||||
|
||||
namespace Orchard.Environment.FileSystems {
|
||||
namespace Orchard.FileSystems.AppData {
|
||||
/// <summary>
|
||||
/// Abstraction of App_Data folder
|
||||
/// Expected to work on physical filesystem, but decouples core
|
@@ -5,15 +5,15 @@ using System.Linq;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Environment.Configuration;
|
||||
|
||||
namespace Orchard.Storage {
|
||||
namespace Orchard.FileSystems.Media {
|
||||
public class FileSystemStorageProvider : IStorageProvider {
|
||||
private readonly string _storagePath;
|
||||
private readonly string _publicPath;
|
||||
|
||||
public FileSystemStorageProvider(ShellSettings settings) {
|
||||
var mediaPath = HostingEnvironment.IsHosted
|
||||
? HostingEnvironment.MapPath("~/Media/") ?? ""
|
||||
: Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media");
|
||||
? HostingEnvironment.MapPath("~/Media/") ?? ""
|
||||
: Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Media");
|
||||
|
||||
_storagePath = Path.Combine(mediaPath, settings.Name);
|
||||
|
||||
@@ -35,10 +35,10 @@ namespace Orchard.Storage {
|
||||
|
||||
static string Fix(string path) {
|
||||
return string.IsNullOrEmpty(path)
|
||||
? ""
|
||||
: Path.DirectorySeparatorChar != '/'
|
||||
? path.Replace('/', Path.DirectorySeparatorChar)
|
||||
: path;
|
||||
? ""
|
||||
: Path.DirectorySeparatorChar != '/'
|
||||
? path.Replace('/', Path.DirectorySeparatorChar)
|
||||
: path;
|
||||
}
|
||||
|
||||
#region Implementation of IStorageProvider
|
||||
@@ -248,4 +248,4 @@ namespace Orchard.Storage {
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
|
||||
namespace Orchard.Storage {
|
||||
namespace Orchard.FileSystems.Media {
|
||||
public interface IStorageFile {
|
||||
string GetPath();
|
||||
string GetName();
|
||||
@@ -19,4 +19,4 @@ namespace Orchard.Storage {
|
||||
/// </summary>
|
||||
Stream OpenWrite();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
using System;
|
||||
|
||||
namespace Orchard.Storage {
|
||||
namespace Orchard.FileSystems.Media {
|
||||
public interface IStorageFolder {
|
||||
string GetPath();
|
||||
string GetName();
|
||||
@@ -8,4 +8,4 @@ namespace Orchard.Storage {
|
||||
DateTime GetLastUpdated();
|
||||
IStorageFolder GetParent();
|
||||
}
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.Storage {
|
||||
namespace Orchard.FileSystems.Media {
|
||||
public interface IStorageProvider : IDependency {
|
||||
string GetPublicUrl(string path);
|
||||
IStorageFile GetFile(string path);
|
||||
@@ -13,4 +13,4 @@ namespace Orchard.Storage {
|
||||
void RenameFile(string path, string newPath);
|
||||
IStorageFile CreateFile(string path);
|
||||
}
|
||||
}
|
||||
}
|
11
src/Orchard/FileSystems/WebSite/IWebSiteFolder.cs
Normal file
11
src/Orchard/FileSystems/WebSite/IWebSiteFolder.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Caching;
|
||||
|
||||
namespace Orchard.FileSystems.WebSite {
|
||||
public interface IWebSiteFolder : IVolatileProvider {
|
||||
IEnumerable<string> ListDirectories(string path);
|
||||
string ReadFile(string path);
|
||||
|
||||
IVolatileToken WhenPathChanges(string path);
|
||||
}
|
||||
}
|
@@ -7,20 +7,20 @@ using System.Web.Hosting;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Environment.FileSystems {
|
||||
public class DefaultVirtualPathProvider : IVirtualPathProvider {
|
||||
namespace Orchard.FileSystems.WebSite {
|
||||
public class WebSiteFolder : IWebSiteFolder {
|
||||
private readonly IClock _clock;
|
||||
private readonly Thunk _thunk;
|
||||
private readonly string _prefix = Guid.NewGuid().ToString("n");
|
||||
private readonly IDictionary<string, Weak<Token>> _tokens = new Dictionary<string, Weak<Token>>();
|
||||
|
||||
|
||||
public DefaultVirtualPathProvider(IClock clock) {
|
||||
public WebSiteFolder(IClock clock) {
|
||||
_clock = clock;
|
||||
_thunk = new Thunk(this);
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetSubfolderPaths(string virtualPath) {
|
||||
public IEnumerable<string> ListDirectories(string virtualPath) {
|
||||
if (!HostingEnvironment.VirtualPathProvider.DirectoryExists(virtualPath))
|
||||
return Enumerable.Empty<string>();
|
||||
|
||||
@@ -31,7 +31,7 @@ namespace Orchard.Environment.FileSystems {
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public string ReadAllText(string virtualPath) {
|
||||
public string ReadFile(string virtualPath) {
|
||||
if (!HostingEnvironment.VirtualPathProvider.FileExists(virtualPath))
|
||||
return null;
|
||||
|
||||
@@ -111,10 +111,10 @@ namespace Orchard.Environment.FileSystems {
|
||||
}
|
||||
|
||||
class Thunk {
|
||||
private readonly Weak<DefaultVirtualPathProvider> _weak;
|
||||
private readonly Weak<WebSiteFolder> _weak;
|
||||
|
||||
public Thunk(DefaultVirtualPathProvider provider) {
|
||||
_weak = new Weak<DefaultVirtualPathProvider>(provider);
|
||||
public Thunk(WebSiteFolder provider) {
|
||||
_weak = new Weak<WebSiteFolder>(provider);
|
||||
}
|
||||
|
||||
public void Signal(string key, object value, CacheItemRemovedReason reason) {
|
@@ -150,9 +150,9 @@
|
||||
<Compile Include="Caching\DefaultCacheManager.cs" />
|
||||
<Compile Include="Caching\ICacheHolder.cs" />
|
||||
<Compile Include="Caching\Weak.cs" />
|
||||
<Compile Include="Environment\FileSystems\DefaultVirtualPathProvider.cs" />
|
||||
<Compile Include="Environment\FileSystems\IAppDataFolder.cs" />
|
||||
<Compile Include="Environment\FileSystems\IVirtualPathProvider.cs" />
|
||||
<Compile Include="FileSystems\WebSite\WebSiteFolder.cs" />
|
||||
<Compile Include="FileSystems\AppData\IAppDataFolder.cs" />
|
||||
<Compile Include="FileSystems\WebSite\IWebSiteFolder.cs" />
|
||||
<Compile Include="Caching\ICache.cs" />
|
||||
<Compile Include="Caching\ICacheManager.cs" />
|
||||
<Compile Include="Caching\IVolatileToken.cs" />
|
||||
@@ -194,7 +194,7 @@
|
||||
<Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyContext.cs" />
|
||||
<Compile Include="Environment\AutofacUtil\DynamicProxy2\DynamicProxyExtensions.cs" />
|
||||
<Compile Include="Environment\AutofacUtil\DynamicProxy2\ConstructorFinderWrapper.cs" />
|
||||
<Compile Include="Environment\FileSystems\AppDataFolder.cs" />
|
||||
<Compile Include="FileSystems\AppData\AppDataFolder.cs" />
|
||||
<Compile Include="Environment\Configuration\ShellSettingsManager.cs" />
|
||||
<Compile Include="Environment\AutofacUtil\ContainerUpdater.cs" />
|
||||
<Compile Include="Environment\ShellBuilders\ShellContextFactory.cs" />
|
||||
@@ -436,10 +436,10 @@
|
||||
<Compile Include="Security\Providers\OrchardMembershipProvider.cs" />
|
||||
<Compile Include="Security\Providers\OrchardRoleProvider.cs" />
|
||||
<Compile Include="Services\Clock.cs" />
|
||||
<Compile Include="Storage\FileSystemStorageProvider.cs" />
|
||||
<Compile Include="Storage\IStorageFile.cs" />
|
||||
<Compile Include="Storage\IStorageFolder.cs" />
|
||||
<Compile Include="Storage\IStorageProvider.cs" />
|
||||
<Compile Include="FileSystems\Media\FileSystemStorageProvider.cs" />
|
||||
<Compile Include="FileSystems\Media\IStorageFile.cs" />
|
||||
<Compile Include="FileSystems\Media\IStorageFolder.cs" />
|
||||
<Compile Include="FileSystems\Media\IStorageProvider.cs" />
|
||||
<Compile Include="UI\Zones\ZoneManager.cs" />
|
||||
<Compile Include="Utility\Extensions\ReadOnlyCollectionExtensions.cs" />
|
||||
<Compile Include="Utility\Extensions\RouteValueDictionaryExtensions.cs" />
|
||||
|
Reference in New Issue
Block a user