mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
<MSDeploy.iisApp>
|
||||
<iisapp path="Orchard" managedRuntimeVersion="v4.0" managedPipelineMode="Integrated"/>
|
||||
<iisapp path="Orchard" managedRuntimeVersion="v4.0" />
|
||||
<setAcl path="Orchard/App_Data" setAclAccess="Modify" />
|
||||
<setAcl path="Orchard/Media" setAclAccess="Modify" />
|
||||
</MSDeploy.iisApp>
|
||||
|
||||
@@ -21,6 +21,7 @@ namespace Orchard.Environment {
|
||||
private readonly ControllerBuilder _controllerBuilder;
|
||||
private readonly IShellSettingsManager _shellSettingsManager;
|
||||
private readonly IShellContextFactory _shellContextFactory;
|
||||
private readonly IShellDescriptorCache _shellDescriptorCache;
|
||||
private readonly IRunningShellTable _runningShellTable;
|
||||
private readonly IProcessingEngine _processingEngine;
|
||||
private readonly IExtensionLoaderCoordinator _extensionLoaderCoordinator;
|
||||
@@ -32,6 +33,7 @@ namespace Orchard.Environment {
|
||||
public DefaultOrchardHost(
|
||||
IShellSettingsManager shellSettingsManager,
|
||||
IShellContextFactory shellContextFactory,
|
||||
IShellDescriptorCache shellDescriptorCache,
|
||||
IRunningShellTable runningShellTable,
|
||||
IProcessingEngine processingEngine,
|
||||
IExtensionLoaderCoordinator extensionLoaderCoordinator,
|
||||
@@ -40,6 +42,7 @@ namespace Orchard.Environment {
|
||||
|
||||
_shellSettingsManager = shellSettingsManager;
|
||||
_shellContextFactory = shellContextFactory;
|
||||
_shellDescriptorCache = shellDescriptorCache;
|
||||
_runningShellTable = runningShellTable;
|
||||
_processingEngine = processingEngine;
|
||||
_extensionLoaderCoordinator = extensionLoaderCoordinator;
|
||||
@@ -149,6 +152,7 @@ namespace Orchard.Environment {
|
||||
_cacheManager.Get("OrchardHost_Extensions",
|
||||
ctx => {
|
||||
_extensionLoaderCoordinator.MonitorExtensions(ctx.Monitor);
|
||||
_shellDescriptorCache.Monitor(ctx.Monitor);
|
||||
_current = null;
|
||||
return "";
|
||||
});
|
||||
|
||||
@@ -2,13 +2,14 @@
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Xml;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.Environment.Descriptor {
|
||||
/// <summary>
|
||||
/// <summary>
|
||||
/// Single service instance registered at the host level. Provides storage
|
||||
/// and recall of shell descriptor information. Default implementation uses
|
||||
/// app_data, but configured replacements could use other per-host writable location.
|
||||
@@ -26,6 +27,11 @@ namespace Orchard.Environment.Descriptor {
|
||||
/// Loss of storage is expected.
|
||||
/// </summary>
|
||||
void Store(string shellName, ShellDescriptor descriptor);
|
||||
|
||||
/// <summary>
|
||||
/// Monitor changes on the persistent storage.
|
||||
/// </summary>
|
||||
void Monitor(Action<IVolatileToken> monitor);
|
||||
}
|
||||
|
||||
public class ShellDescriptorCache : IShellDescriptorCache {
|
||||
@@ -55,7 +61,7 @@ namespace Orchard.Environment.Descriptor {
|
||||
var serializer = new DataContractSerializer(typeof(ShellDescriptor));
|
||||
var reader = new StringReader(tenantNode.InnerText);
|
||||
using (var xmlReader = XmlReader.Create(reader)) {
|
||||
return (ShellDescriptor) serializer.ReadObject(xmlReader, true);
|
||||
return (ShellDescriptor)serializer.ReadObject(xmlReader, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -73,7 +79,7 @@ namespace Orchard.Environment.Descriptor {
|
||||
XmlNode rootNode = xmlDocument.DocumentElement;
|
||||
foreach (XmlNode tenantNode in rootNode.ChildNodes) {
|
||||
if (String.Equals(tenantNode.Name, name, StringComparison.OrdinalIgnoreCase)) {
|
||||
var serializer = new DataContractSerializer(typeof (ShellDescriptor));
|
||||
var serializer = new DataContractSerializer(typeof(ShellDescriptor));
|
||||
var writer = new StringWriter();
|
||||
using (var xmlWriter = XmlWriter.Create(writer)) {
|
||||
serializer.WriteObject(xmlWriter, descriptor);
|
||||
@@ -98,6 +104,10 @@ namespace Orchard.Environment.Descriptor {
|
||||
_appDataFolder.CreateFile(DescriptorCacheFileName, saveWriter.ToString());
|
||||
}
|
||||
|
||||
public void Monitor(Action<IVolatileToken> monitor) {
|
||||
monitor(_appDataFolder.WhenPathChanges(DescriptorCacheFileName));
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
private void VerifyCacheFile() {
|
||||
@@ -106,8 +116,8 @@ namespace Orchard.Environment.Descriptor {
|
||||
using (XmlWriter xmlWriter = XmlWriter.Create(writer)) {
|
||||
if (xmlWriter != null) {
|
||||
xmlWriter.WriteStartDocument();
|
||||
xmlWriter.WriteStartElement("Tenants");
|
||||
xmlWriter.WriteEndElement();
|
||||
xmlWriter.WriteStartElement("Tenants");
|
||||
xmlWriter.WriteEndElement();
|
||||
xmlWriter.WriteEndDocument();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user