mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-24 08:46:48 +08:00
Code styling
This commit is contained in:
@@ -4,7 +4,6 @@ using Orchard.Commands;
|
|||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.Indexing.Services;
|
using Orchard.Indexing.Services;
|
||||||
using Orchard.Tasks.Indexing;
|
using Orchard.Tasks.Indexing;
|
||||||
using Orchard.Utility.Extensions;
|
|
||||||
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
||||||
|
|
||||||
namespace Orchard.Indexing.Commands {
|
namespace Orchard.Indexing.Commands {
|
||||||
@@ -136,11 +135,10 @@ namespace Orchard.Indexing.Commands {
|
|||||||
}
|
}
|
||||||
|
|
||||||
[CommandName("index refresh")]
|
[CommandName("index refresh")]
|
||||||
[CommandHelp("index refresh /ContentItem:<content item id> \r\n\t" + "Refreshes the index for the specifed <content item id>")]
|
[CommandHelp("index refresh /ContentItem:<content item id> \r\n\t" + "Refreshes the index for the specified <content item id>")]
|
||||||
[OrchardSwitches("ContentItem")]
|
[OrchardSwitches("ContentItem")]
|
||||||
public void Refresh() {
|
public void Refresh() {
|
||||||
int contentItemId;
|
if (!int.TryParse(ContentItem, out int contentItemId)) {
|
||||||
if ( !int.TryParse(ContentItem, out contentItemId) ) {
|
|
||||||
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -148,15 +146,14 @@ namespace Orchard.Indexing.Commands {
|
|||||||
var contentItem = _contentManager.Get(contentItemId);
|
var contentItem = _contentManager.Get(contentItemId);
|
||||||
_indexingTaskManager.CreateUpdateIndexTask(contentItem);
|
_indexingTaskManager.CreateUpdateIndexTask(contentItem);
|
||||||
|
|
||||||
Context.Output.WriteLine(T("Content Item marked for reindexing"));
|
Context.Output.WriteLine(T("Content Item marked for re-indexing"));
|
||||||
}
|
}
|
||||||
|
|
||||||
[CommandName("index delete")]
|
[CommandName("index delete")]
|
||||||
[CommandHelp("index delete /ContentItem:<content item id>\r\n\t" + "Deletes the specifed <content item id> from the index")]
|
[CommandHelp("index delete /ContentItem:<content item id>\r\n\t" + "Deletes the specified <content item id> from the index")]
|
||||||
[OrchardSwitches("ContentItem")]
|
[OrchardSwitches("ContentItem")]
|
||||||
public void Delete() {
|
public void Delete() {
|
||||||
int contentItemId;
|
if (!int.TryParse(ContentItem, out int contentItemId)) {
|
||||||
if(!int.TryParse(ContentItem, out contentItemId)) {
|
|
||||||
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,12 +2,11 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Orchard.Indexing.Services;
|
using Orchard.Indexing.Services;
|
||||||
|
using Orchard.Indexing.ViewModels;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
using Orchard.Security;
|
using Orchard.Security;
|
||||||
using Orchard.Indexing.ViewModels;
|
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
using Orchard.Utility.Extensions;
|
|
||||||
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
||||||
|
|
||||||
namespace Orchard.Indexing.Controllers {
|
namespace Orchard.Indexing.Controllers {
|
||||||
@@ -51,8 +50,6 @@ namespace Orchard.Indexing.Controllers {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Services.Notifier.Information(T("The index might be corrupted. If you can't recover click on Rebuild."));
|
|
||||||
|
|
||||||
return View(viewModel);
|
return View(viewModel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -60,7 +57,7 @@ namespace Orchard.Indexing.Controllers {
|
|||||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||||
return new HttpUnauthorizedResult();
|
return new HttpUnauthorizedResult();
|
||||||
|
|
||||||
return View("Create", String.Empty);
|
return View("Create");
|
||||||
}
|
}
|
||||||
|
|
||||||
[HttpPost, ActionName("Create")]
|
[HttpPost, ActionName("Create")]
|
||||||
@@ -85,7 +82,7 @@ namespace Orchard.Indexing.Controllers {
|
|||||||
}
|
}
|
||||||
catch (Exception e) {
|
catch (Exception e) {
|
||||||
Services.Notifier.Error(T("An error occurred while creating the index: {0}", id));
|
Services.Notifier.Error(T("An error occurred while creating the index: {0}", id));
|
||||||
Logger.Error("An error occurred while creatign the index " + id, e);
|
Logger.Error("An error occurred while creating the index " + id, e);
|
||||||
return View("Create", id);
|
return View("Create", id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user