Merge branch '1.8.x' into 1.x

This commit is contained in:
Sebastien Ros
2014-04-17 13:22:29 -07:00
11 changed files with 198 additions and 108 deletions

View File

@@ -34,5 +34,28 @@ namespace Orchard.Core.Tests.Common {
var processed = _filter.ProcessContent(text, null); var processed = _filter.ProcessContent(text, null);
Assert.That(processed, Is.EqualTo("foo <a href=\"alink\">bar</a> baz")); Assert.That(processed, Is.EqualTo("foo <a href=\"alink\">bar</a> baz"));
} }
[Test]
public void ShouldIgnoreMalformedUrl() {
const string text = "foo [url]bar baz";
var processed = _filter.ProcessContent(text, null);
Assert.That(processed, Is.EqualTo("foo [url]bar baz"));
}
[Test]
public void ShouldIgnoreMalformedUrlWithTitle() {
const string text = "foo [url=alink]bar baz";
var processed = _filter.ProcessContent(text, null);
Assert.That(processed, Is.EqualTo("foo [url=alink]bar baz"));
}
[Test]
public void ShouldIgnoreMalformedImg() {
const string text = "foo [img]bar baz";
var processed = _filter.ProcessContent(text, null);
Assert.That(processed, Is.EqualTo("foo [img]bar baz"));
}
} }
} }

View File

@@ -1,100 +1,98 @@
<?xml version="1.0" encoding="utf-8" ?> <?xml version="1.0" encoding="utf-8" ?>
<HostComponents> <HostComponents>
<Components> <Components>
<Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator"> <Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator">
<Properties> <Properties>
<!-- Set Value="true" to disable new extensions monitoring --> <!-- Set Value="true" to disable new extensions monitoring -->
<Property Name="Disabled" Value="false"/> <Property Name="Disabled" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy.PlacementFileParser"> <Component Type="Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy.PlacementFileParser">
<Properties> <Properties>
<!-- Set Value="true" to disable Placement files monitoring (Placement.info) --> <!-- Set Value="true" to disable Placement files monitoring (Placement.info) -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy"> <Component Type="Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy">
<Properties> <Properties>
<!-- Set Value="true" to disable template views monitoring (Views\*.cshtml) --> <!-- Set Value="true" to disable template views monitoring (Views\*.cshtml) -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Environment.Extensions.Folders.ExtensionHarvester"> <Component Type="Orchard.Environment.Extensions.Folders.ExtensionHarvester">
<Properties> <Properties>
<!-- Set Value="true" to disable extension folders monitoring (new files in modules and themes) --> <!-- Set Value="true" to disable extension folders monitoring (new files in modules and themes) -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Environment.Extensions.Compilers.DefaultProjectFileParser"> <Component Type="Orchard.Environment.Extensions.Compilers.DefaultProjectFileParser">
<Properties> <Properties>
<!-- Set Value="true" to disable project files monitoring (/Modules/**/*.csproj) --> <!-- Set Value="true" to disable project files monitoring (/Modules/**/*.csproj) -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader"> <Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
<Properties> <Properties>
<!-- Set Value="true" to disable source files monitoring --> <!-- Set Value="true" to disable source files monitoring -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
<!-- Set Value="true" to completely disable the Dynamic Extension Loader --> <!-- Set Value="true" to completely disable the Dynamic Extension Loader -->
<Property Name="Disabled" Value="false"/> <Property Name="Disabled" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader"> <Component Type="Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader">
<Properties> <Properties>
<!-- Set Value="true" to disable pre-compiled files monitoring (~/Modules/**/bin/*.dll) --> <!-- Set Value="true" to disable pre-compiled files monitoring (~/Modules/**/bin/*.dll) -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultDependenciesFolder"> <Component Type="Orchard.FileSystems.Dependencies.DefaultDependenciesFolder">
<Properties> <Properties>
<!-- Set Value="true" to disable the dependencies folder monitoring --> <!-- Set Value="true" to disable the dependencies folder monitoring -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultExtensionDependenciesManager"> <Component Type="Orchard.FileSystems.Dependencies.DefaultExtensionDependenciesManager">
<Properties> <Properties>
<!-- Set Value="true" to disable compiled dependencides files monitoring --> <!-- Set Value="true" to disable compiled dependencides files monitoring -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Localization.Services.DefaultLocalizedStringManager"> <Component Type="Orchard.Localization.Services.DefaultLocalizedStringManager">
<Properties> <Properties>
<!-- Set Value="true" to disable localization files monitoring (*.po) --> <!-- Set Value="true" to disable localization files monitoring (*.po) -->
<Property Name="DisableMonitoring" Value="false"/> <Property Name="DisableMonitoring" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Caching.DefaultParallelCacheContext"> <Component Type="Orchard.Caching.DefaultParallelCacheContext">
<Properties> <Properties>
<!-- Set Value="true" to disable parallel cache resolution --> <!-- Set Value="true" to disable parallel cache resolution -->
<Property Name="Disabled" Value="false"/> <Property Name="Disabled" Value="false"/>
</Properties> </Properties>
</Component> </Component>
<Component Type="Orchard.Data.SessionConfigurationCache">
<Properties>
<!-- Set Value="true" to disable session configuration cache (mappings.bin). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Descriptor.ShellDescriptorCache">
<Properties>
<!-- Set Value="true" to disable shell descriptors cache (cache.dat). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Data.SessionConfigurationCache">
<Properties>
<!-- Set Value="true" to disable session configuration cache (mappings.bin). Recommended when using multiple instances. -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
</Components> <Component Type="Orchard.Alias.Implementation.Updater">
<Properties>
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
</Components>
</HostComponents> </HostComponents>

View File

@@ -32,6 +32,11 @@ namespace Orchard.Core.Common.Services {
foreach(var start in allIndexes) { foreach(var start in allIndexes) {
var end = text.IndexOf("[/url]", start, StringComparison.Ordinal); var end = text.IndexOf("[/url]", start, StringComparison.Ordinal);
if (end == -1) {
continue;
}
var url = text.Substring(start + 5 , end - start - 5); var url = text.Substring(start + 5 , end - start - 5);
// substitue [url] by <a> // substitue [url] by <a>
@@ -50,6 +55,11 @@ namespace Orchard.Core.Common.Services {
foreach (var start in allIndexes) { foreach (var start in allIndexes) {
var urlEnd = text.IndexOf("]", start, StringComparison.Ordinal); var urlEnd = text.IndexOf("]", start, StringComparison.Ordinal);
var end = text.IndexOf("[/url]", start, StringComparison.Ordinal); var end = text.IndexOf("[/url]", start, StringComparison.Ordinal);
if (end == -1) {
continue;
}
var url = text.Substring(start + 5, urlEnd - start - 5); var url = text.Substring(start + 5, urlEnd - start - 5);
var title = text.Substring(urlEnd + 1, end - urlEnd - 1); var title = text.Substring(urlEnd + 1, end - urlEnd - 1);
@@ -68,6 +78,11 @@ namespace Orchard.Core.Common.Services {
foreach (var start in allIndexes) { foreach (var start in allIndexes) {
var end = text.IndexOf("[/img]", start, StringComparison.Ordinal); var end = text.IndexOf("[/img]", start, StringComparison.Ordinal);
if (end == -1) {
continue;
}
var url = text.Substring(start + 5, end - start - 5); var url = text.Substring(start + 5, end - start - 5);
// substitue [url] by <a> // substitue [url] by <a>

View File

@@ -14,6 +14,8 @@ namespace Orchard.Alias.Implementation.Updater {
public ILogger Logger { get; set; } public ILogger Logger { get; set; }
public bool Disabled { get; set; }
public AliasHolderUpdater(IAliasHolder aliasHolder, IAliasStorage storage, IAliasUpdateCursor cursor) { public AliasHolderUpdater(IAliasHolder aliasHolder, IAliasStorage storage, IAliasUpdateCursor cursor) {
_aliasHolder = aliasHolder; _aliasHolder = aliasHolder;
_storage = storage; _storage = storage;
@@ -45,7 +47,9 @@ namespace Orchard.Alias.Implementation.Updater {
} }
public void Sweep() { public void Sweep() {
Refresh(); if (!Disabled) {
Refresh();
}
} }
} }
} }

View File

@@ -16,7 +16,11 @@ namespace Orchard.Autoroute {
.Attachable() .Attachable()
.WithDescription("Adds advanced url configuration options to your content type to completely customize the url pattern for a content item.")); .WithDescription("Adds advanced url configuration options to your content type to completely customize the url pattern for a content item."));
return 2; SchemaBuilder.AlterTable("AutoroutePartRecord", table => table
.CreateIndex("IDX_AutoroutePartRecord_DisplayAlias", "DisplayAlias")
);
return 3;
} }
public int UpdateFrom1() { public int UpdateFrom1() {
@@ -24,5 +28,14 @@ namespace Orchard.Autoroute {
.WithDescription("Adds advanced url configuration options to your content type to completely customize the url pattern for a content item.")); .WithDescription("Adds advanced url configuration options to your content type to completely customize the url pattern for a content item."));
return 2; return 2;
} }
public int UpdateFrom2() {
SchemaBuilder.AlterTable("AutoroutePartRecord", table => table
.CreateIndex("IDX_AutoroutePartRecord_DisplayAlias", "DisplayAlias")
);
return 3;
}
} }
} }

View File

@@ -1,20 +1,30 @@
using System.Linq; using System.Linq;
using Orchard.Autoroute.Models; using Orchard.Autoroute.Models;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.Data;
namespace Orchard.Autoroute.Services { namespace Orchard.Autoroute.Services {
public class PathResolutionService : IPathResolutionService { public class PathResolutionService : IPathResolutionService {
private readonly IContentManager _contentManager; private readonly IContentManager _contentManager;
IRepository<AutoroutePartRecord> _autorouteRepository;
public PathResolutionService(IContentManager contentManager) { public PathResolutionService(
IRepository<AutoroutePartRecord> autorouteRepository,
IContentManager contentManager) {
_contentManager = contentManager; _contentManager = contentManager;
_autorouteRepository = autorouteRepository;
} }
public AutoroutePart GetPath(string path) { public AutoroutePart GetPath(string path) {
return _contentManager.Query<AutoroutePart, AutoroutePartRecord>() var autorouteRecord = _autorouteRepository.Table
.Where(part => part.DisplayAlias == path) .Where(part => part.DisplayAlias == path && part.ContentItemVersionRecord.Latest && part.ContentItemVersionRecord.Published)
.Slice(0, 1) .FirstOrDefault();
.FirstOrDefault();
if (autorouteRecord == null) {
return null;
}
return _contentManager.Get(autorouteRecord.Id).As<AutoroutePart>();
} }
} }
} }

View File

@@ -2,7 +2,9 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using Orchard.Autoroute.Models; using Orchard.Autoroute.Models;
using Orchard.Autoroute.Services;
using Orchard.Blogs.Models; using Orchard.Blogs.Models;
using Orchard.Caching;
using Orchard.ContentManagement; using Orchard.ContentManagement;
using Orchard.Core.Title.Models; using Orchard.Core.Title.Models;
using Orchard.Environment.Configuration; using Orchard.Environment.Configuration;
@@ -17,19 +19,33 @@ namespace Orchard.Blogs.Services {
private readonly ShellSettings _shellSettings; private readonly ShellSettings _shellSettings;
private readonly IShellDescriptorManager _shellDescriptorManager; private readonly IShellDescriptorManager _shellDescriptorManager;
private readonly HashSet<int> _processedBlogParts = new HashSet<int>(); private readonly HashSet<int> _processedBlogParts = new HashSet<int>();
IPathResolutionService _pathResolutionService;
public BlogService( public BlogService(
IContentManager contentManager, IContentManager contentManager,
IProcessingEngine processingEngine, IProcessingEngine processingEngine,
ShellSettings shellSettings, ShellSettings shellSettings,
IShellDescriptorManager shellDescriptorManager) { IShellDescriptorManager shellDescriptorManager,
IPathResolutionService pathResolutionService) {
_contentManager = contentManager; _contentManager = contentManager;
_processingEngine = processingEngine; _processingEngine = processingEngine;
_shellSettings = shellSettings; _shellSettings = shellSettings;
_shellDescriptorManager = shellDescriptorManager; _shellDescriptorManager = shellDescriptorManager;
_pathResolutionService = pathResolutionService;
} }
public BlogPart Get(string path) { public BlogPart Get(string path) {
return _contentManager.Query<AutoroutePart, AutoroutePartRecord>().Where(r => r.DisplayAlias == path).ForPart<BlogPart>().Slice(0, 1).FirstOrDefault(); var blog = _pathResolutionService.GetPath(path);
if (blog == null) {
return null;
}
if (!blog.Has<BlogPart>()) {
return null;
}
return blog.As<BlogPart>();
} }
public ContentItem Get(int id, VersionOptions versionOptions) { public ContentItem Get(int id, VersionOptions versionOptions) {

View File

@@ -183,12 +183,6 @@ namespace Orchard.OutputCache.Filters {
// different tenants with the same urls have different entries // different tenants with the same urls have different entries
_varyRequestHeaders.Add("HOST"); _varyRequestHeaders.Add("HOST");
// Set the Vary: Accept-Encoding response header.
// This instructs the proxies to cache two versions of the resource: one compressed, and one uncompressed.
// The correct version of the resource is delivered based on the client request header.
// This is a good choice for applications that are singly homed and depend on public proxies for user locality.
_varyRequestHeaders.Add("Accept-Encoding");
// caches the ignored urls to prevent a query to the settings // caches the ignored urls to prevent a query to the settings
_ignoredUrls = _cacheManager.Get("CacheSettingsPart.IgnoredUrls", _ignoredUrls = _cacheManager.Get("CacheSettingsPart.IgnoredUrls",
context => { context => {
@@ -417,8 +411,8 @@ namespace Orchard.OutputCache.Filters {
Logger.Debug("Cache item added: " + _cacheItem.CacheKey); Logger.Debug("Cache item added: " + _cacheItem.CacheKey);
// remove old cache data // remove only the current version of the page
_cacheService.RemoveByTag(_invariantCacheKey); _cacheService.RemoveByTag(_cacheKey);
// add data to cache // add data to cache
_cacheStorageProvider.Set(_cacheKey, _cacheItem); _cacheStorageProvider.Set(_cacheKey, _cacheItem);
@@ -463,6 +457,7 @@ namespace Orchard.OutputCache.Filters {
null null
); );
// remove all cached version of the same page
_cacheService.RemoveByTag(invariantCacheKey); _cacheService.RemoveByTag(invariantCacheKey);
filterContext.Result = new RedirectResult(redirectUrl, ((RedirectResult) filterContext.Result).Permanent); filterContext.Result = new RedirectResult(redirectUrl, ((RedirectResult) filterContext.Result).Permanent);

View File

@@ -26,8 +26,8 @@
</fieldset> </fieldset>
<fieldset> <fieldset>
<label>@T("Ignore no-cache headers")</label> <label>@T("Headers")</label>
@Html.TextAreaFor(m => m.IgnoredUrls, new { @class = "text medium" }) @Html.CheckBoxFor(m => m.IgnoreNoCache) <label for="@Html.FieldIdFor(m => m.IgnoreNoCache)" class="forcheckbox">@T("Ignore no-cache headers")</label>
<span class="hint">@T("When checked, any request containing a 'Content-Cache: no-cache' header will still return cached values if available.")</span> <span class="hint">@T("When checked, any request containing a 'Content-Cache: no-cache' header will still return cached values if available.")</span>
</fieldset> </fieldset>

View File

@@ -50,5 +50,19 @@ namespace Orchard.ContentManagement.DataMigrations {
return 2; return 2;
} }
public int UpdateFrom2() {
SchemaBuilder.AlterTable("ContentTypeRecord",
table => table
.CreateIndex("IDX_ContentType_Name", "Name")
);
SchemaBuilder.AlterTable("ContentItemVersionRecord",
table => table
.CreateIndex("IDX_ContentItemVersionRecord_Published_Latest", "Published", "Latest")
);
return 3;
}
} }
} }

View File

@@ -126,13 +126,15 @@ namespace Orchard.Environment.ShellBuilders {
// Register code-only registrations specific to a shell // Register code-only registrations specific to a shell
_shellContainerRegistrations.Registrations(builder); _shellContainerRegistrations.Registrations(builder);
var optionalShellConfig = HostingEnvironment.MapPath("~/Config/Sites.config");
if (File.Exists(optionalShellConfig))
builder.RegisterModule(new ConfigurationSettingsReader(ConfigurationSettingsReaderConstants.DefaultSectionName, optionalShellConfig));
var optionalShellByNameConfig = HostingEnvironment.MapPath("~/Config/Sites." + settings.Name + ".config"); var optionalShellByNameConfig = HostingEnvironment.MapPath("~/Config/Sites." + settings.Name + ".config");
if (File.Exists(optionalShellByNameConfig)) if (File.Exists(optionalShellByNameConfig)) {
builder.RegisterModule(new ConfigurationSettingsReader(ConfigurationSettingsReaderConstants.DefaultSectionName, optionalShellByNameConfig)); builder.RegisterModule(new ConfigurationSettingsReader(ConfigurationSettingsReaderConstants.DefaultSectionName, optionalShellByNameConfig));
}
else {
var optionalShellConfig = HostingEnvironment.MapPath("~/Config/Sites.config");
if (File.Exists(optionalShellConfig))
builder.RegisterModule(new ConfigurationSettingsReader(ConfigurationSettingsReaderConstants.DefaultSectionName, optionalShellConfig));
}
}); });
} }