mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-09 03:04:43 +08:00
Fixed an issue with old aliases being kept in memory.
This commit is contained in:
@@ -73,7 +73,7 @@ namespace Orchard.Autoroute.Handlers {
|
||||
}
|
||||
|
||||
// Update the home alias to point to this item being published.
|
||||
_homeAliasService.SetHomeAlias(part);
|
||||
_homeAliasService.PublishHomeAlias(part);
|
||||
}
|
||||
|
||||
_autorouteService.Value.PublishAlias(part);
|
||||
|
||||
@@ -113,23 +113,6 @@ namespace Orchard.Autoroute.Services {
|
||||
}
|
||||
|
||||
public void RemoveAliases(AutoroutePart part) {
|
||||
//// https://github.com/OrchardCMS/Orchard/issues/5137
|
||||
//// If the alias of the specified part is empty while not being the homepage,
|
||||
//// we need to make sure we are not removing all empty aliases in order to prevent losing the homepage content item being the homepage.
|
||||
//if (String.IsNullOrWhiteSpace(part.Path)) {
|
||||
// if (!IsHomePage(part)) {
|
||||
// // The item being removed is NOT the homepage, so we need to make sure we're not removing the alias for the homepage.
|
||||
// var aliasRecordId = GetHomePageAliasRecordId();
|
||||
|
||||
// // Remove all aliases EXCEPT for the alias of the homepage.
|
||||
// _aliasStorage.Remove(x => x.Path == part.Path && x.Source == AliasSource && x.Id != aliasRecordId);
|
||||
|
||||
// // Done.
|
||||
// return;
|
||||
// }
|
||||
//}
|
||||
|
||||
//// Safe to delete all aliases for the specified part since it is definitely not the homepage.
|
||||
_aliasService.Delete(part.Path, AliasSource);
|
||||
}
|
||||
|
||||
|
||||
@@ -37,16 +37,18 @@ namespace Orchard.Autoroute.Services {
|
||||
return homePage;
|
||||
}
|
||||
|
||||
public void SetHomeAlias(IContent content) {
|
||||
public void PublishHomeAlias(IContent content) {
|
||||
var routeValues = _contentManager.GetItemMetadata(content).DisplayRouteValues;
|
||||
SetHomeAlias(routeValues);
|
||||
PublishHomeAlias(routeValues);
|
||||
}
|
||||
|
||||
public void SetHomeAlias(string route) {
|
||||
public void PublishHomeAlias(string route) {
|
||||
_aliasService.DeleteBySource(AliasSource);
|
||||
_aliasService.Set(HomeAlias, route, AliasSource);
|
||||
}
|
||||
|
||||
public void SetHomeAlias(RouteValueDictionary route) {
|
||||
public void PublishHomeAlias(RouteValueDictionary route) {
|
||||
_aliasService.DeleteBySource(AliasSource);
|
||||
_aliasService.Set(HomeAlias, route, AliasSource);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ namespace Orchard.Autoroute.Services {
|
||||
RouteValueDictionary GetHomeRoute();
|
||||
int? GetHomePageId();
|
||||
IContent GetHomePage(VersionOptions version = null);
|
||||
void SetHomeAlias(IContent content);
|
||||
void SetHomeAlias(string route);
|
||||
void SetHomeAlias(RouteValueDictionary route);
|
||||
void PublishHomeAlias(IContent content);
|
||||
void PublishHomeAlias(string route);
|
||||
void PublishHomeAlias(RouteValueDictionary route);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user