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);
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" ?>
<HostComponents>
<Components>
<Components>
<Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator">
<Properties>
<!-- Set Value="true" to disable new extensions monitoring -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.ExtensionMonitoringCoordinator">
<Properties>
<!-- Set Value="true" to disable new extensions monitoring -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy.PlacementFileParser">
<Properties>
<!-- Set Value="true" to disable Placement files monitoring (Placement.info) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapePlacementStrategy.PlacementFileParser">
<Properties>
<!-- Set Value="true" to disable Placement files monitoring (Placement.info) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy">
<Properties>
<!-- Set Value="true" to disable template views monitoring (Views\*.cshtml) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.DisplayManagement.Descriptors.ShapeTemplateStrategy.ShapeTemplateBindingStrategy">
<Properties>
<!-- Set Value="true" to disable template views monitoring (Views\*.cshtml) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Folders.ExtensionHarvester">
<Properties>
<!-- Set Value="true" to disable extension folders monitoring (new files in modules and themes) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Folders.ExtensionHarvester">
<Properties>
<!-- Set Value="true" to disable extension folders monitoring (new files in modules and themes) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Compilers.DefaultProjectFileParser">
<Properties>
<!-- Set Value="true" to disable project files monitoring (/Modules/**/*.csproj) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Compilers.DefaultProjectFileParser">
<Properties>
<!-- Set Value="true" to disable project files monitoring (/Modules/**/*.csproj) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
<Properties>
<!-- Set Value="true" to disable source files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
<!-- Set Value="true" to completely disable the Dynamic Extension Loader -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.DynamicExtensionLoader">
<Properties>
<!-- Set Value="true" to disable source files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
<!-- Set Value="true" to completely disable the Dynamic Extension Loader -->
<Property Name="Disabled" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader">
<Properties>
<!-- Set Value="true" to disable pre-compiled files monitoring (~/Modules/**/bin/*.dll) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Environment.Extensions.Loaders.PrecompiledExtensionLoader">
<Properties>
<!-- Set Value="true" to disable pre-compiled files monitoring (~/Modules/**/bin/*.dll) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultDependenciesFolder">
<Properties>
<!-- Set Value="true" to disable the dependencies folder monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultDependenciesFolder">
<Properties>
<!-- Set Value="true" to disable the dependencies folder monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultExtensionDependenciesManager">
<Properties>
<!-- Set Value="true" to disable compiled dependencides files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.FileSystems.Dependencies.DefaultExtensionDependenciesManager">
<Properties>
<!-- Set Value="true" to disable compiled dependencides files monitoring -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Localization.Services.DefaultLocalizedStringManager">
<Properties>
<!-- Set Value="true" to disable localization files monitoring (*.po) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Localization.Services.DefaultLocalizedStringManager">
<Properties>
<!-- Set Value="true" to disable localization files monitoring (*.po) -->
<Property Name="DisableMonitoring" Value="false"/>
</Properties>
</Component>
<Component Type="Orchard.Caching.DefaultParallelCacheContext">
<Properties>
<!-- Set Value="true" to disable parallel cache resolution -->
<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>
<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.Caching.DefaultParallelCacheContext">
<Properties>
<!-- Set Value="true" to disable parallel cache resolution -->
<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>

View File

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

View File

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

View File

@@ -16,7 +16,11 @@ namespace Orchard.Autoroute {
.Attachable()
.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() {
@@ -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."));
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 Orchard.Autoroute.Models;
using Orchard.ContentManagement;
using Orchard.Data;
namespace Orchard.Autoroute.Services {
public class PathResolutionService : IPathResolutionService {
private readonly IContentManager _contentManager;
IRepository<AutoroutePartRecord> _autorouteRepository;
public PathResolutionService(IContentManager contentManager) {
public PathResolutionService(
IRepository<AutoroutePartRecord> autorouteRepository,
IContentManager contentManager) {
_contentManager = contentManager;
_autorouteRepository = autorouteRepository;
}
public AutoroutePart GetPath(string path) {
return _contentManager.Query<AutoroutePart, AutoroutePartRecord>()
.Where(part => part.DisplayAlias == path)
.Slice(0, 1)
.FirstOrDefault();
var autorouteRecord = _autorouteRepository.Table
.Where(part => part.DisplayAlias == path && part.ContentItemVersionRecord.Latest && part.ContentItemVersionRecord.Published)
.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 JetBrains.Annotations;
using Orchard.Autoroute.Models;
using Orchard.Autoroute.Services;
using Orchard.Blogs.Models;
using Orchard.Caching;
using Orchard.ContentManagement;
using Orchard.Core.Title.Models;
using Orchard.Environment.Configuration;
@@ -17,19 +19,33 @@ namespace Orchard.Blogs.Services {
private readonly ShellSettings _shellSettings;
private readonly IShellDescriptorManager _shellDescriptorManager;
private readonly HashSet<int> _processedBlogParts = new HashSet<int>();
IPathResolutionService _pathResolutionService;
public BlogService(
IContentManager contentManager,
IProcessingEngine processingEngine,
ShellSettings shellSettings,
IShellDescriptorManager shellDescriptorManager) {
IShellDescriptorManager shellDescriptorManager,
IPathResolutionService pathResolutionService) {
_contentManager = contentManager;
_processingEngine = processingEngine;
_shellSettings = shellSettings;
_shellDescriptorManager = shellDescriptorManager;
_pathResolutionService = pathResolutionService;
}
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) {

View File

@@ -183,12 +183,6 @@ namespace Orchard.OutputCache.Filters {
// different tenants with the same urls have different entries
_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
_ignoredUrls = _cacheManager.Get("CacheSettingsPart.IgnoredUrls",
context => {
@@ -417,8 +411,8 @@ namespace Orchard.OutputCache.Filters {
Logger.Debug("Cache item added: " + _cacheItem.CacheKey);
// remove old cache data
_cacheService.RemoveByTag(_invariantCacheKey);
// remove only the current version of the page
_cacheService.RemoveByTag(_cacheKey);
// add data to cache
_cacheStorageProvider.Set(_cacheKey, _cacheItem);
@@ -463,6 +457,7 @@ namespace Orchard.OutputCache.Filters {
null
);
// remove all cached version of the same page
_cacheService.RemoveByTag(invariantCacheKey);
filterContext.Result = new RedirectResult(redirectUrl, ((RedirectResult) filterContext.Result).Permanent);

View File

@@ -26,8 +26,8 @@
</fieldset>
<fieldset>
<label>@T("Ignore no-cache headers")</label>
@Html.TextAreaFor(m => m.IgnoredUrls, new { @class = "text medium" })
<label>@T("Headers")</label>
@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>
</fieldset>

View File

@@ -50,5 +50,19 @@ namespace Orchard.ContentManagement.DataMigrations {
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
_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");
if (File.Exists(optionalShellByNameConfig))
if (File.Exists(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));
}
});
}