mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-08-23 22:20:28 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
commit
f57a9ad2e3
@ -51,7 +51,7 @@ namespace Orchard.Tests.DataMigration {
|
||||
.Column("Firstname", DbType.String, column => column.WithLength(255))
|
||||
.Column("Lastname", DbType.String, column => column.WithPrecision(0).WithScale(1)))
|
||||
.CreateTable("Address", table => table
|
||||
.VersionedContentPartRecord()
|
||||
.ContentPartVersionRecord()
|
||||
.Column("City", DbType.String)
|
||||
.Column("ZIP", DbType.Int32, column => column.Unique())
|
||||
.Column("UserId", DbType.Int32, column => column.NotNull()))
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@ -68,7 +68,7 @@ namespace Orchard.Tests.Environment.Extensions {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsCompatibleWithReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
public bool IsCompatibleWithModuleReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@ -68,7 +68,7 @@ namespace Orchard.Tests.Environment.Extensions {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public bool IsCompatibleWithReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
public bool IsCompatibleWithModuleReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
|
@ -7,15 +7,14 @@ namespace Orchard.Core.Common.DataMigrations {
|
||||
public int Create() {
|
||||
//CREATE TABLE Common_BodyRecord (Id INTEGER not null, Text TEXT, Format TEXT, ContentItemRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("BodyRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartVersionRecord()
|
||||
.Column<string>("Text")
|
||||
.Column<string>("Format")
|
||||
.Column<int>("ContentItemRecord_id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Common_CommonRecord (Id INTEGER not null, OwnerId INTEGER, CreatedUtc DATETIME, PublishedUtc DATETIME, ModifiedUtc DATETIME, Container_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommonRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<int>("OwnerId")
|
||||
.Column<DateTime>("CreatedUtc")
|
||||
.Column<DateTime>("PublishedUtc")
|
||||
@ -25,20 +24,18 @@ namespace Orchard.Core.Common.DataMigrations {
|
||||
|
||||
//CREATE TABLE Common_CommonVersionRecord (Id INTEGER not null, CreatedUtc DATETIME, PublishedUtc DATETIME, ModifiedUtc DATETIME, ContentItemRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommonVersionRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartVersionRecord()
|
||||
.Column<DateTime>("CreatedUtc")
|
||||
.Column<DateTime>("PublishedUtc")
|
||||
.Column<DateTime>("ModifiedUtc")
|
||||
.Column<int>("ContentItemRecord_id")
|
||||
);
|
||||
|
||||
//CREATE TABLE Common_RoutableRecord (Id INTEGER not null, Title TEXT, Slug TEXT, Path TEXT, ContentItemRecord_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("RoutableRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartVersionRecord()
|
||||
.Column<string>("Title")
|
||||
.Column<string>("Slug")
|
||||
.Column<string>("Path")
|
||||
.Column<int>("ContentItemRecord_id")
|
||||
);
|
||||
|
||||
return 0010;
|
||||
|
@ -18,18 +18,18 @@ namespace Orchard.Core.Contents {
|
||||
public string MenuName { get { return "admin"; } }
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
//var contentTypeDefinitions = _contentDefinitionManager.ListTypeDefinitions().OrderBy(d => d.Name);
|
||||
var contentTypeDefinitions = _contentDefinitionManager.ListTypeDefinitions().OrderBy(d => d.Name);
|
||||
|
||||
//builder.Add(T("Content"), "1", menu => {
|
||||
// menu.Add(T("Manage Content"), "1.2", item => item.Action("List", "Admin", new {area = "Orchard.ContentTypes"}));
|
||||
//foreach (var contentTypeDefinition in contentTypeDefinitions) {
|
||||
// var ci = _contentManager.New(contentTypeDefinition.Name);
|
||||
// var cim = _contentManager.GetItemMetadata(ci);
|
||||
// var createRouteValues = cim.CreateRouteValues;
|
||||
// if (createRouteValues.Any())
|
||||
// menu.Add(T("Create New {0}", contentTypeDefinition.DisplayName), "1.3", item => item.Action(cim.CreateRouteValues["Action"] as string, cim.CreateRouteValues["Controller"] as string, cim.CreateRouteValues));
|
||||
//}
|
||||
//});
|
||||
builder.Add(T("Content"), "1", menu => {
|
||||
menu.Add(T("Manage Content"), "1.2", item => item.Action("List", "Admin", new { area = "Contents" }));
|
||||
foreach (var contentTypeDefinition in contentTypeDefinitions) {
|
||||
var ci = _contentManager.New(contentTypeDefinition.Name);
|
||||
var cim = _contentManager.GetItemMetadata(ci);
|
||||
var createRouteValues = cim.CreateRouteValues;
|
||||
if (createRouteValues.Any())
|
||||
menu.Add(T("Create New {0}", contentTypeDefinition.DisplayName), "1.3", item => item.Action(cim.CreateRouteValues["Action"] as string, cim.CreateRouteValues["Controller"] as string, cim.CreateRouteValues));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
@ -48,10 +48,17 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
const int pageSize = 20;
|
||||
var skip = (Math.Max(model.Page ?? 0, 1) - 1) * pageSize;
|
||||
|
||||
var query = _contentManager.Query(VersionOptions.Latest);
|
||||
var query = _contentManager.Query(VersionOptions.Latest, _contentDefinitionManager.ListTypeDefinitions().Select(ctd => ctd.Name).ToArray());
|
||||
|
||||
if (!string.IsNullOrEmpty(model.Id)) {
|
||||
query = query.ForType(model.Id);
|
||||
if (!string.IsNullOrEmpty(model.TypeName)) {
|
||||
var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(model.TypeName);
|
||||
if (contentTypeDefinition == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
model.TypeDisplayName = !string.IsNullOrWhiteSpace(contentTypeDefinition.DisplayName)
|
||||
? contentTypeDefinition.DisplayName
|
||||
: contentTypeDefinition.Name;
|
||||
query = query.ForType(model.TypeName);
|
||||
}
|
||||
|
||||
var contentItems = query.Slice(skip, pageSize);
|
||||
@ -148,6 +155,18 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
return RedirectToAction("Edit", new RouteValueDictionary { { "Id", contentItem.Id } });
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Remove")]
|
||||
public ActionResult RemovePOST(int id, string returnUrl) {
|
||||
var contentItem = _contentManager.Get(id);
|
||||
if (contentItem != null)
|
||||
_contentManager.Remove(contentItem);
|
||||
|
||||
if (!String.IsNullOrEmpty(returnUrl))
|
||||
return Redirect(returnUrl);
|
||||
|
||||
return RedirectToAction("List");
|
||||
}
|
||||
|
||||
private void PrepareEditorViewModel(ContentItemViewModel itemViewModel) {
|
||||
if (string.IsNullOrEmpty(itemViewModel.TemplateName)) {
|
||||
itemViewModel.TemplateName = "Items/Contents.Item";
|
||||
|
@ -1,11 +1,12 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.Core.Contents.ViewModels {
|
||||
public class ListContentsViewModel : BaseViewModel {
|
||||
public string Id { get; set; }
|
||||
public string TypeName { get { return Id; } }
|
||||
public string TypeDisplayName { get; set; }
|
||||
public int? Page { get; set; }
|
||||
public IList<Entry> Entries { get; set; }
|
||||
|
||||
|
@ -0,0 +1,7 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<ListContentTypesViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<h1><%:Html.TitleForPage(T("Create New Content").ToString())%></h1>
|
||||
<%:Html.UnorderedList(
|
||||
Model.Types,
|
||||
(ctd, i) => MvcHtmlString.Create(string.Format("<p>{0}</p>", Html.ActionLink(ctd.Name, "Create", new { Area = "Contents", Id = ctd.Name }))),
|
||||
"contentTypes")%>
|
@ -1,11 +0,0 @@
|
||||
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ListContentTypesViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<% Html.AddTitleParts(T("Create Content").ToString()); %>
|
||||
<p>
|
||||
Create content</p>
|
||||
<ul>
|
||||
<% foreach (var t in Model.Types) {%>
|
||||
<li>
|
||||
<%:Html.ActionLink(t.Name, "Create", new RouteValueDictionary{{"Area","Contents"},{"Id",t.Name}}) %></li>
|
||||
<%} %>
|
||||
</ul>
|
37
src/Orchard.Web/Core/Contents/Views/Admin/List.ascx
Normal file
37
src/Orchard.Web/Core/Contents/Views/Admin/List.ascx
Normal file
@ -0,0 +1,37 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.Core.Contents.ViewModels.ListContentsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.ContentManagement.Aspects"%>
|
||||
<%@ Import Namespace="Orchard.ContentManagement"%>
|
||||
<%@ Import Namespace="Orchard.Utility.Extensions" %>
|
||||
<h1><%:Html.TitleForPage(T("Manage {0} Content", !string.IsNullOrEmpty(Model.TypeDisplayName) ? Model.TypeDisplayName : T("all").Text).ToString())%></h1>
|
||||
<div class="manage">
|
||||
<%:Html.ActionLink(!string.IsNullOrEmpty(Model.TypeDisplayName) ? T("Add new {0} content", Model.TypeDisplayName).Text : T("Add new content").Text, "Create", new { }, new { @class = "button primaryAction" })%>
|
||||
</div>
|
||||
<ul class="contentItems"><%
|
||||
foreach (var entry in Model.Entries) { %>
|
||||
<li>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3><%:entry.ContentItem.Is<IRoutableAspect>()
|
||||
? Html.ActionLink(entry.ContentItem.As<IRoutableAspect>().Title, "Edit", new { id = entry.ContentItem.Id })
|
||||
: MvcHtmlString.Create(string.Format("[title display template needed] (content type == \"{0}\")", entry.ContentItem.TypeDefinition.Name)) %></h3>
|
||||
<ul class="pageStatus">
|
||||
<li>
|
||||
<%:T("Last modified: {0}",
|
||||
entry.ContentItem.Is<ICommonAspect>() && entry.ContentItem.As<ICommonAspect>().ModifiedUtc.HasValue
|
||||
? Html.DateTimeRelative(entry.ContentItem.As<ICommonAspect>().ModifiedUtc.Value, T)
|
||||
: T("unknown"))%>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
<div class="related">
|
||||
<%:Html.ActionLink(T("Edit").ToString(), "Edit", new { id = entry.ContentItem.Id }, new { title = T("Edit").ToString() })%><%: T(" | ")%>
|
||||
<% using (Html.BeginFormAntiForgeryPost(Url.Action("Remove", new { id = entry.ContentItem.Id }), FormMethod.Post, new { @class = "inline link" })) { %>
|
||||
<button type="submit" class="linkButton" title="<%: T("Remove") %>"><%: T("Remove") %></button>
|
||||
<%:Html.Hidden("returnUrl", ViewContext.RequestContext.HttpContext.Request.ToUrlString())%><%
|
||||
} %>
|
||||
</div>
|
||||
<div style="clear:both;"></div>
|
||||
</div>
|
||||
</li><%
|
||||
} %>
|
||||
</ul>
|
@ -1,32 +0,0 @@
|
||||
<%@ Page Language="C#" Inherits="Orchard.Mvc.ViewPage<ListContentsViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Contents.ViewModels" %>
|
||||
<% Html.AddTitleParts(T("Browse Contents").ToString()); %>
|
||||
<p>
|
||||
Browse Contents</p>
|
||||
<table>
|
||||
<% foreach (var t in Model.Entries) {%>
|
||||
<tr>
|
||||
<td>
|
||||
<%:t.ContentItem.Id %>.
|
||||
</td>
|
||||
<td>
|
||||
<%:t.ContentItem.ContentType %>
|
||||
</td>
|
||||
<td>
|
||||
ver #<%:t.ContentItem.Version %>
|
||||
</td>
|
||||
<td>
|
||||
<%if (t.ContentItemMetadata.DisplayRouteValues != null) {%>
|
||||
<%:Html.ActionLink(t.ContentItemMetadata.DisplayText, t.ContentItemMetadata.DisplayRouteValues["Action"].ToString(), t.ContentItemMetadata.DisplayRouteValues)%>
|
||||
<%}%>
|
||||
</td>
|
||||
<td>
|
||||
<%if (t.ContentItemMetadata.EditorRouteValues != null) {%>
|
||||
<%:Html.ActionLink("edit", t.ContentItemMetadata.EditorRouteValues["Action"].ToString(), t.ContentItemMetadata.EditorRouteValues)%>
|
||||
<%}%>
|
||||
</td>
|
||||
</tr>
|
||||
<%} %>
|
||||
</table>
|
||||
<p>
|
||||
<%:Html.ActionLink("Create new item", "Create", "Admin", new RouteValueDictionary{{"Area","Contents"},{"Id",Model.Id}}, new Dictionary<string, object>()) %></p>
|
@ -6,7 +6,7 @@ namespace Orchard.Core.Localization.DataMigrations {
|
||||
public int Create() {
|
||||
//CREATE TABLE Localization_LocalizedRecord (Id INTEGER not null, CultureId INTEGER, MasterContentItemId INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("LocalizedRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<int>("CultureId")
|
||||
.Column<int>("MasterContentItemId")
|
||||
);
|
||||
|
@ -6,13 +6,13 @@ namespace Orchard.Core.Navigation.DataMigrations {
|
||||
public int Create() {
|
||||
//CREATE TABLE Navigation_MenuItemRecord (Id INTEGER not null, Url TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("MenuItemRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Url")
|
||||
);
|
||||
|
||||
//CREATE TABLE Navigation_MenuPartRecord (Id INTEGER not null, MenuText TEXT, MenuPosition TEXT, OnMainMenu INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("MenuPartRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("MenuText")
|
||||
.Column<string>("MenuPosition")
|
||||
.Column<bool>("OnMainMenu")
|
||||
|
@ -210,10 +210,10 @@
|
||||
<Content Include="Common\Views\EditorTemplates\Parts\Common.Container.ascx" />
|
||||
<Content Include="Common\Views\EditorTemplates\PlainTextEditor.ascx" />
|
||||
<Content Include="Contents\Module.txt" />
|
||||
<Content Include="Contents\Views\Admin\List.aspx" />
|
||||
<Content Include="Contents\Views\Admin\Edit.aspx" />
|
||||
<Content Include="Contents\Views\Admin\CreatableTypeList.aspx" />
|
||||
<Content Include="Contents\Views\Admin\CreatableTypeList.ascx" />
|
||||
<Content Include="Contents\Views\Admin\Create.aspx" />
|
||||
<Content Include="Contents\Views\Admin\List.ascx" />
|
||||
<Content Include="Contents\Views\DisplayTemplates\Items\Contents.Item.ascx" />
|
||||
<Content Include="Contents\Views\EditorTemplates\Items\Contents.Item.ascx" />
|
||||
<Content Include="Contents\Views\Item\Preview.aspx" />
|
||||
|
@ -82,7 +82,7 @@ namespace Orchard.Core.Settings.DataMigrations {
|
||||
|
||||
//CREATE TABLE Settings_SiteSettingsRecord (Id INTEGER not null, SiteSalt TEXT, SiteName TEXT, SuperUser TEXT, PageTitleSeparator TEXT, HomePage TEXT, SiteCulture TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("SiteSettingsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("SiteSalt")
|
||||
.Column<string>("SiteName")
|
||||
.Column<string>("SuperUser")
|
||||
|
@ -1,5 +1,6 @@
|
||||
.site-cultures {
|
||||
font-size:1.2em;
|
||||
font-size:1.4em;
|
||||
line-height:1.8em;
|
||||
overflow:auto;
|
||||
}
|
||||
.site-cultures li {
|
||||
@ -14,5 +15,5 @@
|
||||
}
|
||||
.site-cultures div {
|
||||
float:left;
|
||||
width:6em;
|
||||
width:8em;
|
||||
}
|
@ -1,18 +1,19 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<SiteCulturesViewModel>" %>
|
||||
<%@ Import Namespace="Orchard.Core.Settings.ViewModels" %><%
|
||||
Html.RegisterStyle("admin.css"); %>
|
||||
<h1><%:Html.TitleForPage(T("Supported Cultures").ToString()) %></h1>
|
||||
<h1><%:Html.TitleForPage(T("Cultures").ToString()) %></h1>
|
||||
<p class="breadcrumb"><%:Html.ActionLink(T("Manage Settings").Text, "index") %><%:T(" > ") %><%:T("Supported Cultures")%></p>
|
||||
<h2><%:T("Cultures this site supports") %></h2>
|
||||
<h3><%:T("Available Cultures") %></h3>
|
||||
<% using (Html.BeginFormAntiForgeryPost("AddCulture")) { %>
|
||||
<%:Html.ValidationSummary() %>
|
||||
<fieldset class="addCulture">
|
||||
<label for="CultureName"><%:T("Add a culture...") %></label>
|
||||
<%:Html.DropDownList("CultureName", new SelectList(Model.AvailableSystemCultures.OrderBy(s => s), Model.CurrentCulture))%>
|
||||
<button class="primaryAction" type="submit"><%:T("Add") %></button>
|
||||
</fieldset>
|
||||
<% } %>
|
||||
<h3><%:T("Cultures this site supports") %></h3>
|
||||
<%: Html.UnorderedList(
|
||||
Model.SiteCultures.OrderBy(s => s),
|
||||
(s, i) => Html.DisplayFor(scvm => s, s == Model.CurrentCulture ? "CurrentCulture" : "RemovableCulture", ""),
|
||||
"site-cultures", "culture", "odd")%>
|
||||
<% using (Html.BeginFormAntiForgeryPost("AddCulture")) { %>
|
||||
<%:Html.ValidationSummary() %>
|
||||
<fieldset>
|
||||
<label for="CultureName"><%:T("Add a culture...") %></label>
|
||||
<%:Html.DropDownList("CultureName", new SelectList(Model.AvailableSystemCultures.OrderBy(s => s), Model.CurrentCulture)) %>
|
||||
<button class="primaryAction" type="submit"><%:T("Add") %></button>
|
||||
</fieldset>
|
||||
<% } %>
|
||||
"site-cultures", "culture", "odd")%>
|
@ -11,7 +11,7 @@ namespace Futures.Widgets.DataMigrations {
|
||||
|
||||
//CREATE TABLE Futures_Widgets_WidgetRecord (Id INTEGER not null, Zone TEXT, Position TEXT, Scope_id INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("WidgetRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Zone")
|
||||
.Column<string>("Position")
|
||||
.Column<int>("Scope_id")
|
||||
|
@ -13,7 +13,7 @@ namespace Orchard.Comments.DataMigrations {
|
||||
|
||||
//CREATE TABLE Orchard_Comments_CommentRecord (Id INTEGER not null, Author TEXT, SiteName TEXT, UserName TEXT, Email TEXT, Status TEXT, CommentDateUtc DATETIME, CommentText TEXT, CommentedOn INTEGER, CommentedOnContainer INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommentRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Author")
|
||||
.Column<string>("SiteName")
|
||||
.Column<string>("UserName")
|
||||
@ -27,7 +27,7 @@ namespace Orchard.Comments.DataMigrations {
|
||||
|
||||
//CREATE TABLE Orchard_Comments_CommentSettingsRecord (Id INTEGER not null, ModerateComments INTEGER, EnableSpamProtection INTEGER, AkismetKey TEXT, AkismetUrl TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("CommentSettingsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("ModerateComments")
|
||||
.Column<bool>("EnableSpamProtection")
|
||||
.Column<string>("AkismetKey")
|
||||
@ -36,7 +36,7 @@ namespace Orchard.Comments.DataMigrations {
|
||||
|
||||
//CREATE TABLE Orchard_Comments_HasCommentsRecord (Id INTEGER not null, CommentsShown INTEGER, CommentsActive INTEGER, primary key (Id));
|
||||
SchemaBuilder.CreateTable("HasCommentsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("CommentsShown")
|
||||
.Column<bool>("CommentsActive")
|
||||
);
|
||||
|
@ -32,6 +32,7 @@ namespace Orchard.DevTools.Commands {
|
||||
string dataMigrationsPath = HostingEnvironment.MapPath("~/Modules/" + extension.Name + "/DataMigrations/");
|
||||
string dataMigrationPath = dataMigrationsPath + extension.DisplayName + "DataMigration.cs";
|
||||
string templatesPath = HostingEnvironment.MapPath("~/Modules/Orchard.DevTools/ScaffoldingTemplates/");
|
||||
string moduleCsProjPath = HostingEnvironment.MapPath(string.Format("~/Modules/{0}/{0}.csproj", extension.Name));
|
||||
if ( !Directory.Exists(dataMigrationsPath) ) {
|
||||
Directory.CreateDirectory(dataMigrationsPath);
|
||||
}
|
||||
@ -55,7 +56,20 @@ namespace Orchard.DevTools.Commands {
|
||||
dataMigrationText = dataMigrationText.Replace("$$ClassName$$", extension.DisplayName);
|
||||
dataMigrationText = dataMigrationText.Replace("$$Commands$$", stringWriter.ToString());
|
||||
File.WriteAllText(dataMigrationPath, dataMigrationText);
|
||||
Context.Output.WriteLine(T("Data migration created successfully in Module {0}", extension.DisplayName));
|
||||
|
||||
string projectFileText = File.ReadAllText(moduleCsProjPath);
|
||||
// The string searches in solution/project files can be made aware of comment lines.
|
||||
if ( projectFileText.Contains("<Compile Include") ) {
|
||||
string compileReference = string.Format("<Compile Include=\"{0}\" />\r\n ", "DataMigrations\\" + extension.DisplayName + "DataMigration.cs");
|
||||
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("<Compile Include"), compileReference);
|
||||
}
|
||||
else {
|
||||
string itemGroupReference = string.Format("</ItemGroup>\r\n <ItemGroup>\r\n <Compile Include=\"{0}\" />\r\n ", "DataMigrations\\" + extension.DisplayName + "DataMigration.cs");
|
||||
projectFileText = projectFileText.Insert(projectFileText.LastIndexOf("</ItemGroup>"), itemGroupReference);
|
||||
}
|
||||
File.WriteAllText(moduleCsProjPath, projectFileText);
|
||||
|
||||
Context.Output.WriteLine(T("Data migration created successfully in Module {0}", extension.Name));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -4,9 +4,11 @@ using Orchard.Localization;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
using Orchard.Themes;
|
||||
using Orchard.UI.Notify;
|
||||
using Orchard.UI.Admin;
|
||||
|
||||
namespace Orchard.DevTools.Controllers {
|
||||
[Themed]
|
||||
[Admin]
|
||||
public class HomeController : Controller {
|
||||
private readonly INotifier _notifier;
|
||||
|
||||
|
@ -5,7 +5,7 @@ namespace $$FeatureName$$.DataMigrations {
|
||||
public class $$ClassName$$DataMigration : DataMigrationImpl {
|
||||
|
||||
public int Create() {
|
||||
$$Commands$$
|
||||
$$Commands$$
|
||||
|
||||
return 0100;
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ namespace Orchard.DevTools.Services {
|
||||
}
|
||||
|
||||
public override void Visit(CreateTableCommand command) {
|
||||
_output.WriteLine("// Creating table {0}", command.Name);
|
||||
_output.WriteLine("\t\t\t// Creating table {0}", command.Name);
|
||||
_output.WriteLine("\t\t\tSchemaBuilder.CreateTable(\"{0}\", table => table", command.Name);
|
||||
|
||||
foreach ( var createColumn in command.TableCommands.OfType<CreateColumnCommand>() ) {
|
||||
@ -22,7 +22,7 @@ namespace Orchard.DevTools.Services {
|
||||
var options = new List<string>();
|
||||
|
||||
if ( createColumn.IsPrimaryKey ) {
|
||||
options.Add(string.Format("WithLength({0})", createColumn.Length));
|
||||
options.Add("PrimaryKey()");
|
||||
}
|
||||
|
||||
if ( createColumn.IsUnique ) {
|
||||
@ -33,10 +33,6 @@ namespace Orchard.DevTools.Services {
|
||||
options.Add("NotNull()");
|
||||
}
|
||||
|
||||
if ( createColumn.IsPrimaryKey ) {
|
||||
options.Add("PrimaryKey()");
|
||||
}
|
||||
|
||||
if ( createColumn.Length.HasValue ) {
|
||||
options.Add(string.Format("WithLength({0})", createColumn.Length ));
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace Orchard.Media.DataMigrations {
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Media_MediaSettingsRecord (Id INTEGER not null, RootMediaFolder TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("MediaSettingsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("RootMediaFolder")
|
||||
);
|
||||
|
||||
|
@ -17,7 +17,7 @@
|
||||
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
||||
<li><%:T("Features: {0}", MvcHtmlString.Create(string.Join(", ", module.Features.Select(f => Html.Link(f.Name, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Name.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray()))) %></li>
|
||||
<li> | <%: T("Author: {0}", !string.IsNullOrEmpty(module.Author) ? module.Author : (new []{"Bradley", "Bertrand", "Renaud", "Suha", "Sebastien", "Jon", "Nathan", "Erik"})[(module.DisplayName.Length + (new Random()).Next()) % 7]) %></li><%-- very efficient, I know --%>
|
||||
<li> | <%: T("Website: {0}", !string.IsNullOrEmpty(module.HomePage) ? module.HomePage : T("<a href=\"http://orchardproject.net\">http://orchardproject.net</a>").ToString())%></li>
|
||||
<li> | <%: T("Website: {0}", !string.IsNullOrEmpty(module.HomePage) ? module.HomePage : "http://orchardproject.net")%></li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
@ -5,12 +5,12 @@ namespace Orchard.Sandbox.DataMigrations {
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("SandboxPageRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("Name")
|
||||
);
|
||||
|
||||
SchemaBuilder.CreateTable("SandboxSettingsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("AllowAnonymousEdits")
|
||||
);
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace Orchard.Search.DataMigrations {
|
||||
public int Create() {
|
||||
|
||||
SchemaBuilder.CreateTable("SearchSettingsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<bool>("FilterCulture")
|
||||
.Column<string>("SearchedFields")
|
||||
);
|
||||
|
@ -6,7 +6,7 @@ namespace Orchard.Search.Models {
|
||||
public virtual string SearchedFields { get; set; }
|
||||
|
||||
public SearchSettingsRecord() {
|
||||
FilterCulture = true;
|
||||
FilterCulture = false;
|
||||
SearchedFields = "body, title";
|
||||
}
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ namespace Orchard.Themes.DataMigrations {
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Themes_ThemeRecord (Id INTEGER not null, ThemeName TEXT, DisplayName TEXT, Description TEXT, Version TEXT, Author TEXT, HomePage TEXT, Tags TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ThemeRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("ThemeName")
|
||||
.Column<string>("DisplayName")
|
||||
.Column<string>("Description")
|
||||
@ -18,7 +18,7 @@ namespace Orchard.Themes.DataMigrations {
|
||||
|
||||
//CREATE TABLE Orchard_Themes_ThemeSiteSettingsRecord (Id INTEGER not null, CurrentThemeName TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("ThemeSiteSettingsRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("CurrentThemeName")
|
||||
);
|
||||
|
||||
|
@ -6,7 +6,7 @@ namespace Orchard.Users.DataMigrations {
|
||||
public int Create() {
|
||||
//CREATE TABLE Orchard_Users_UserRecord (Id INTEGER not null, UserName TEXT, Email TEXT, NormalizedUserName TEXT, Password TEXT, PasswordFormat TEXT, PasswordSalt TEXT, primary key (Id));
|
||||
SchemaBuilder.CreateTable("UserRecord", table => table
|
||||
.Column<int>("Id", column => column.PrimaryKey())
|
||||
.ContentPartRecord()
|
||||
.Column<string>("UserName")
|
||||
.Column<string>("Email")
|
||||
.Column<string>("NormalizedUserName")
|
||||
|
@ -397,8 +397,8 @@ label input {
|
||||
}
|
||||
/* todo: (heskew) try to get .text on stuff like .text-box */
|
||||
select, textarea, input.text, input.textMedium, input.text-box {
|
||||
padding:2px;
|
||||
border:1px solid #bdbcbc;
|
||||
padding:1px;
|
||||
border:1px solid #bdbcbc;
|
||||
}
|
||||
input.text, input.textMedium, input.text-box {
|
||||
line-height:1.2em;
|
||||
|
@ -1,9 +1,17 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Localization;
|
||||
|
||||
namespace Orchard.Commands {
|
||||
public class CommandHostEnvironment : IHostEnvironment {
|
||||
public CommandHostEnvironment() {
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public bool IsFullTrust {
|
||||
get { return AppDomain.CurrentDomain.IsFullyTrusted; }
|
||||
}
|
||||
@ -12,12 +20,16 @@ namespace Orchard.Commands {
|
||||
return HostingEnvironment.MapPath(virtualPath);
|
||||
}
|
||||
|
||||
public bool IsAssemblyLoaded(string name) {
|
||||
return AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == name);
|
||||
}
|
||||
|
||||
public void RestartAppDomain() {
|
||||
//Don't restart AppDomain in command line environment
|
||||
ResetSiteCompilation();
|
||||
}
|
||||
|
||||
public void ResetSiteCompilation() {
|
||||
//Don't restart AppDomain in command line environment
|
||||
throw new OrchardCoreException(T("A change of configuration requires the application to be restarted. Running the command again usually solves this problem."));
|
||||
}
|
||||
}
|
||||
}
|
@ -34,14 +34,20 @@ namespace Orchard.Data.Migration.Generator {
|
||||
// get the tables using reflection
|
||||
var tablesField = typeof(Configuration).GetField("tables", BindingFlags.Instance | BindingFlags.NonPublic);
|
||||
var tables = ((IDictionary<string, Table>) tablesField.GetValue(configuration)).Values;
|
||||
|
||||
|
||||
string prefix = feature.Replace(".", "_") + "_";
|
||||
|
||||
foreach(var table in tables.Where(t => parameters.RecordDescriptors.Any(rd => rd.Feature.Descriptor.Name == feature && rd.TableName == t.Name))) {
|
||||
if(drop) {
|
||||
yield return new DropTableCommand(table.Name);
|
||||
string tableName = table.Name;
|
||||
if(tableName.StartsWith(prefix)) {
|
||||
tableName = tableName.Substring(prefix.Length);
|
||||
}
|
||||
|
||||
var command = new CreateTableCommand(table.Name);
|
||||
if(drop) {
|
||||
yield return new DropTableCommand(tableName);
|
||||
}
|
||||
|
||||
var command = new CreateTableCommand(tableName);
|
||||
|
||||
foreach(var column in table.ColumnIterator) {
|
||||
var table1 = table;
|
||||
|
@ -23,16 +23,23 @@ namespace Orchard.Data.Migration.Schema {
|
||||
return Column(columnName, dbType, column);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Defines a primary column as for content parts
|
||||
/// </summary>
|
||||
public CreateTableCommand ContentPartRecord() {
|
||||
/// TODO: Call Column() with necessary information for content part records
|
||||
Column<int>("Id", column => column.PrimaryKey());
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public CreateTableCommand VersionedContentPartRecord() {
|
||||
/// TODO: Call Column() with necessary information for content part records
|
||||
/// <summary>
|
||||
/// Defines a primary column as for versionnable content parts
|
||||
/// </summary>
|
||||
public CreateTableCommand ContentPartVersionRecord() {
|
||||
Column<int>("Id", column => column.PrimaryKey());
|
||||
Column<int>("ContentItemRecord_id");
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Caching;
|
||||
@ -112,7 +112,7 @@ namespace Orchard.Environment.Extensions {
|
||||
.Select(e => context.ProcessedExtensions[e.Name]);
|
||||
|
||||
var activatedExtension = extensionProbes
|
||||
.Where(e => e.Loader.IsCompatibleWithReferences(extension, processedModuleReferences))
|
||||
.Where(e => e.Loader.IsCompatibleWithModuleReferences(extension, processedModuleReferences))
|
||||
.FirstOrDefault();
|
||||
|
||||
var previousDependency = context.PreviousDependencies.Where(d => StringComparer.OrdinalIgnoreCase.Equals(d.Name, extension.Name)).FirstOrDefault();
|
||||
|
@ -25,7 +25,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
return null;
|
||||
}
|
||||
|
||||
public virtual bool IsCompatibleWithReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
public virtual bool IsCompatibleWithModuleReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -57,9 +57,5 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
public virtual IEnumerable<string> GetWebFormVirtualDependencies(DependencyDescriptor dependency) {
|
||||
return Enumerable.Empty<string>();
|
||||
}
|
||||
|
||||
protected static bool IsAssemblyLoaded(string moduleName) {
|
||||
return AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == moduleName);
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using Orchard.Caching;
|
||||
@ -29,7 +29,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
Assembly LoadReference(DependencyReferenceDescriptor reference);
|
||||
void ReferenceActivated(ExtensionLoadingContext context, ExtensionReferenceProbeEntry referenceEntry);
|
||||
void ReferenceDeactivated(ExtensionLoadingContext context, ExtensionReferenceProbeEntry referenceEntry);
|
||||
bool IsCompatibleWithReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references);
|
||||
bool IsCompatibleWithModuleReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references);
|
||||
|
||||
ExtensionProbeEntry Probe(ExtensionDescriptor descriptor);
|
||||
ExtensionEntry Load(ExtensionDescriptor descriptor);
|
||||
|
@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -15,16 +15,19 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
/// extension directory.
|
||||
/// </summary>
|
||||
public class PrecompiledExtensionLoader : ExtensionLoaderBase {
|
||||
private readonly IHostEnvironment _hostEnvironment;
|
||||
private readonly IAssemblyProbingFolder _assemblyProbingFolder;
|
||||
private readonly IVirtualPathProvider _virtualPathProvider;
|
||||
private readonly IVirtualPathMonitor _virtualPathMonitor;
|
||||
|
||||
public PrecompiledExtensionLoader(IDependenciesFolder dependenciesFolder,
|
||||
public PrecompiledExtensionLoader(
|
||||
IHostEnvironment hostEnvironment,
|
||||
IDependenciesFolder dependenciesFolder,
|
||||
IAssemblyProbingFolder assemblyProbingFolder,
|
||||
IVirtualPathProvider virtualPathProvider,
|
||||
IVirtualPathMonitor virtualPathMonitor)
|
||||
: base(dependenciesFolder) {
|
||||
|
||||
_hostEnvironment = hostEnvironment;
|
||||
_assemblyProbingFolder = assemblyProbingFolder;
|
||||
_virtualPathProvider = virtualPathProvider;
|
||||
_virtualPathMonitor = virtualPathMonitor;
|
||||
@ -53,7 +56,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
});
|
||||
|
||||
// We need to restart the appDomain if the assembly is loaded
|
||||
if (IsAssemblyLoaded(dependency.Name)) {
|
||||
if (_hostEnvironment.IsAssemblyLoaded(dependency.Name)) {
|
||||
Logger.Information("ExtensionRemoved: Module \"{0}\" is removed and its assembly is loaded, forcing AppDomain restart", dependency.Name);
|
||||
ctx.RestartAppDomain = true;
|
||||
}
|
||||
@ -72,7 +75,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
ctx.CopyActions.Add(() => _assemblyProbingFolder.StoreAssembly(extension.Name, sourceFileName));
|
||||
|
||||
// We need to restart the appDomain if the assembly is loaded
|
||||
if (IsAssemblyLoaded(extension.Name)) {
|
||||
if (_hostEnvironment.IsAssemblyLoaded(extension.Name)) {
|
||||
Logger.Information("ExtensionRemoved: Module \"{0}\" is activated with newer file and its assembly is loaded, forcing AppDomain restart", extension.Name);
|
||||
ctx.RestartAppDomain = true;
|
||||
}
|
||||
@ -88,7 +91,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
});
|
||||
|
||||
// We need to restart the appDomain if the assembly is loaded
|
||||
if (IsAssemblyLoaded(extension.Name)) {
|
||||
if (_hostEnvironment.IsAssemblyLoaded(extension.Name)) {
|
||||
Logger.Information("ExtensionDeactivated: Module \"{0}\" is deactivated and its assembly is loaded, forcing AppDomain restart", extension.Name);
|
||||
ctx.RestartAppDomain = true;
|
||||
}
|
||||
@ -110,7 +113,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
context.CopyActions.Add(() => _assemblyProbingFolder.StoreAssembly(referenceEntry.Name, sourceFileName));
|
||||
|
||||
// We need to restart the appDomain if the assembly is loaded
|
||||
if (IsAssemblyLoaded(referenceEntry.Name)) {
|
||||
if (_hostEnvironment.IsAssemblyLoaded(referenceEntry.Name)) {
|
||||
Logger.Information("ReferenceActivated: Reference \"{0}\" is activated with newer file and its assembly is loaded, forcing AppDomain restart", referenceEntry.Name);
|
||||
context.RestartAppDomain = true;
|
||||
}
|
||||
@ -143,7 +146,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
} );
|
||||
}
|
||||
|
||||
public override bool IsCompatibleWithReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
public override bool IsCompatibleWithModuleReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
// A pre-compiled module is _not_ compatible with a dynamically loaded module
|
||||
// because a pre-compiled module usually references a pre-compiled assembly binary
|
||||
// which will have a different identity (i.e. name) from the dynamic module.
|
||||
|
@ -10,12 +10,17 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
/// file can be found in the "App_Data/Dependencies" folder.
|
||||
/// </summary>
|
||||
public class ProbingExtensionLoader : ExtensionLoaderBase {
|
||||
private readonly IHostEnvironment _hostEnvironment;
|
||||
private readonly IDependenciesFolder _dependenciesFolder;
|
||||
private readonly IAssemblyProbingFolder _assemblyProbingFolder;
|
||||
|
||||
public ProbingExtensionLoader(IDependenciesFolder dependenciesFolder, IAssemblyProbingFolder assemblyProbingFolder)
|
||||
public ProbingExtensionLoader(
|
||||
IHostEnvironment hostEnvironment,
|
||||
IDependenciesFolder dependenciesFolder,
|
||||
IAssemblyProbingFolder assemblyProbingFolder)
|
||||
: base(dependenciesFolder) {
|
||||
|
||||
_hostEnvironment = hostEnvironment;
|
||||
_dependenciesFolder = dependenciesFolder;
|
||||
_assemblyProbingFolder = assemblyProbingFolder;
|
||||
Logger = NullLogger.Instance;
|
||||
@ -42,7 +47,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
});
|
||||
|
||||
// We need to restart the appDomain if the assembly is loaded
|
||||
if (IsAssemblyLoaded(dependency.Name)) {
|
||||
if (_hostEnvironment.IsAssemblyLoaded(dependency.Name)) {
|
||||
Logger.Information("ExtensionRemoved: Module \"{0}\" is removed and its assembly is loaded, forcing AppDomain restart", dependency.Name);
|
||||
ctx.RestartAppDomain = true;
|
||||
}
|
||||
@ -58,14 +63,14 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
});
|
||||
|
||||
// We need to restart the appDomain if the assembly is loaded
|
||||
if (IsAssemblyLoaded(extension.Name)) {
|
||||
if (_hostEnvironment.IsAssemblyLoaded(extension.Name)) {
|
||||
Logger.Information("ExtensionDeactivated: Module \"{0}\" is deactivated and its assembly is loaded, forcing AppDomain restart", extension.Name);
|
||||
ctx.RestartAppDomain = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public override bool IsCompatibleWithReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
public override bool IsCompatibleWithModuleReferences(ExtensionDescriptor extension, IEnumerable<ExtensionProbeEntry> references) {
|
||||
// A pre-compiled module is _not_ compatible with a dynamically loaded module
|
||||
// because a pre-compiled module usually references a pre-compiled assembly binary
|
||||
// which will have a different identity (i.e. name) from the dynamic module.
|
||||
|
@ -45,6 +45,7 @@ namespace Orchard.Environment.Extensions.Loaders {
|
||||
Logger.Information("ExtensionRemoved: Deleting assembly \"{0}\" from bin directory (AppDomain will restart)", moduleName);
|
||||
File.Delete(_virtualPathProvider.MapPath(assemblyPath));
|
||||
});
|
||||
ctx.RestartAppDomain = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Hosting;
|
||||
using Orchard.Services;
|
||||
@ -13,6 +14,8 @@ namespace Orchard.Environment {
|
||||
bool IsFullTrust { get; }
|
||||
string MapPath(string virtualPath);
|
||||
|
||||
bool IsAssemblyLoaded(string name);
|
||||
|
||||
void RestartAppDomain();
|
||||
void ResetSiteCompilation();
|
||||
}
|
||||
@ -32,6 +35,10 @@ namespace Orchard.Environment {
|
||||
return HostingEnvironment.MapPath(virtualPath);
|
||||
}
|
||||
|
||||
public bool IsAssemblyLoaded(string name) {
|
||||
return AppDomain.CurrentDomain.GetAssemblies().Any(a => a.GetName().Name == name);
|
||||
}
|
||||
|
||||
public void RestartAppDomain() {
|
||||
ResetSiteCompilation();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user