diff --git a/src/Orchard.Core.Tests/Common/BbcodeFilterTests.cs b/src/Orchard.Core.Tests/Common/BbcodeFilterTests.cs
index 0172995b1..984ac276d 100644
--- a/src/Orchard.Core.Tests/Common/BbcodeFilterTests.cs
+++ b/src/Orchard.Core.Tests/Common/BbcodeFilterTests.cs
@@ -34,5 +34,28 @@ namespace Orchard.Core.Tests.Common {
var processed = _filter.ProcessContent(text, null);
Assert.That(processed, Is.EqualTo("foo bar 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"));
+ }
+
+
}
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Config/HostComponents.config b/src/Orchard.Web/Config/HostComponents.config
index f3e4edfcc..e9a565fa1 100644
--- a/src/Orchard.Web/Config/HostComponents.config
+++ b/src/Orchard.Web/Config/HostComponents.config
@@ -1,100 +1,98 @@
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
diff --git a/src/Orchard.Web/Core/Common/Services/BbcodeFilter.cs b/src/Orchard.Web/Core/Common/Services/BbcodeFilter.cs
index 4ec096980..a6c7aea40 100644
--- a/src/Orchard.Web/Core/Common/Services/BbcodeFilter.cs
+++ b/src/Orchard.Web/Core/Common/Services/BbcodeFilter.cs
@@ -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
@@ -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
diff --git a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs
index d9c41d94b..3df6028a7 100644
--- a/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs
+++ b/src/Orchard.Web/Modules/Orchard.Alias/Implementation/Updater/AliasUpdater.cs
@@ -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();
+ }
}
}
}
diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Migrations.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Migrations.cs
index 3b1df16d1..ec0783942 100644
--- a/src/Orchard.Web/Modules/Orchard.Autoroute/Migrations.cs
+++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Migrations.cs
@@ -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;
+ }
}
}
\ No newline at end of file
diff --git a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/PathResolutionService.cs b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/PathResolutionService.cs
index 22cf06e50..e46be3167 100644
--- a/src/Orchard.Web/Modules/Orchard.Autoroute/Services/PathResolutionService.cs
+++ b/src/Orchard.Web/Modules/Orchard.Autoroute/Services/PathResolutionService.cs
@@ -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 _autorouteRepository;
- public PathResolutionService(IContentManager contentManager) {
+ public PathResolutionService(
+ IRepository autorouteRepository,
+ IContentManager contentManager) {
_contentManager = contentManager;
+ _autorouteRepository = autorouteRepository;
}
public AutoroutePart GetPath(string path) {
- return _contentManager.Query()
- .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();
}
}
}
diff --git a/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs b/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs
index 8dd9f563a..b468a8536 100644
--- a/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs
+++ b/src/Orchard.Web/Modules/Orchard.Blogs/Services/BlogService.cs
@@ -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 _processedBlogParts = new HashSet();
+ 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().Where(r => r.DisplayAlias == path).ForPart().Slice(0, 1).FirstOrDefault();
+ var blog = _pathResolutionService.GetPath(path);
+
+ if (blog == null) {
+ return null;
+ }
+
+ if (!blog.Has()) {
+ return null;
+ }
+
+ return blog.As();
}
public ContentItem Get(int id, VersionOptions versionOptions) {
diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
index fc8475815..dea8cec14 100644
--- a/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
+++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Filters/OutputCacheFilter.cs
@@ -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);
diff --git a/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Admin/Index.cshtml b/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Admin/Index.cshtml
index 9c0baa578..a48406908 100644
--- a/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Admin/Index.cshtml
+++ b/src/Orchard.Web/Modules/Orchard.OutputCache/Views/Admin/Index.cshtml
@@ -26,8 +26,8 @@
diff --git a/src/Orchard/ContentManagement/DataMigrations/FrameworkDataMigration.cs b/src/Orchard/ContentManagement/DataMigrations/FrameworkDataMigration.cs
index 5a562864f..1dbd202c8 100644
--- a/src/Orchard/ContentManagement/DataMigrations/FrameworkDataMigration.cs
+++ b/src/Orchard/ContentManagement/DataMigrations/FrameworkDataMigration.cs
@@ -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;
+ }
+
}
}
\ No newline at end of file
diff --git a/src/Orchard/Environment/ShellBuilders/ShellContainerFactory.cs b/src/Orchard/Environment/ShellBuilders/ShellContainerFactory.cs
index 1666756e3..c27e860e4 100644
--- a/src/Orchard/Environment/ShellBuilders/ShellContainerFactory.cs
+++ b/src/Orchard/Environment/ShellBuilders/ShellContainerFactory.cs
@@ -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));
+ }
});
}