mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-07 16:13:58 +08:00
Merge branch '1.10.x' into issue/8830
This commit is contained in:
27
.github/workflows/build-crowdin-translation-packages.yml
vendored
Normal file
27
.github/workflows/build-crowdin-translation-packages.yml
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
name: Build Crowdin Translation Packages
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '0 6 * * *'
|
||||
|
||||
jobs:
|
||||
build-crowdin-translation-packages:
|
||||
runs-on: ubuntu-24.04
|
||||
|
||||
steps:
|
||||
- name: Orchard CMS
|
||||
uses: andrii-bodnar/crowdin-request-action@ee7a2af9564d8934b5b4a8427185aaaffee0165e # v0.3.0
|
||||
with:
|
||||
route: POST /projects/{projectId}/translations/builds
|
||||
projectId: 46524
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
|
||||
|
||||
- name: Orchard CMS Gallery
|
||||
uses: andrii-bodnar/crowdin-request-action@ee7a2af9564d8934b5b4a8427185aaaffee0165e # v0.3.0
|
||||
with:
|
||||
route: POST /projects/{projectId}/translations/builds
|
||||
projectId: 63766
|
||||
env:
|
||||
CROWDIN_PERSONAL_TOKEN: ${{ secrets.CROWDIN_API_TOKEN }}
|
8
.github/workflows/compile.yml
vendored
8
.github/workflows/compile.yml
vendored
@@ -17,13 +17,13 @@ jobs:
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Restore NuGet Packages
|
||||
run: nuget restore src/Orchard.sln
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@v2
|
||||
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
||||
|
||||
- name: Compile
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:TreatWarningsAsErrors=true -WarnAsError /p:MvcBuildViews=true
|
||||
@@ -69,10 +69,10 @@ jobs:
|
||||
runs-on: windows-2025
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@v4.1.1
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Setup NodeJS
|
||||
uses: actions/setup-node@v4.0.2
|
||||
uses: actions/setup-node@a0853c24544627f65ddf259abe73b1d18a591444 # v5.0.0
|
||||
with:
|
||||
node-version: 7
|
||||
|
||||
|
39
.github/workflows/release-package.yml
vendored
Normal file
39
.github/workflows/release-package.yml
vendored
Normal file
@@ -0,0 +1,39 @@
|
||||
name: Release Package
|
||||
# Builds the release package and uploads it as an artifact.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
release-package:
|
||||
name: Release Package
|
||||
runs-on: Windows-2025
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
|
||||
- name: Restore NuGet Packages
|
||||
run: nuget restore src/Orchard.sln
|
||||
|
||||
- name: Add MSBuild to PATH
|
||||
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
||||
|
||||
- name: Build Precompiled Application
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Precompiled
|
||||
|
||||
- name: Generate Release Package Name
|
||||
id: package-name
|
||||
shell: pwsh
|
||||
run: |
|
||||
$packageName = "Orchard-$('${{ github.ref_name }}'.Replace('/', '_'))-${{ github.sha }}"
|
||||
"package-name=$packageName" >> $Env:GITHUB_OUTPUT
|
||||
|
||||
- name: Upload Release Package
|
||||
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
||||
with:
|
||||
name: ${{ steps.package-name.outputs.package-name }}
|
||||
path: .\build\Precompiled
|
||||
if-no-files-found: error
|
59
.github/workflows/specflow.yml
vendored
Normal file
59
.github/workflows/specflow.yml
vendored
Normal file
@@ -0,0 +1,59 @@
|
||||
name: SpecFlow Tests
|
||||
# Compiles the solution and runs unit tests, as well the SpecFlow tests on the main development branches.
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
push:
|
||||
branches:
|
||||
- 1.10.x
|
||||
- dev
|
||||
schedule:
|
||||
- cron: '0 0 * * 1' # Every Monday midnight.
|
||||
|
||||
jobs:
|
||||
define-matrix:
|
||||
name: Define Strategy Matrix
|
||||
runs-on: ubuntu-24.04
|
||||
outputs:
|
||||
branches: ${{ steps.branches.outputs.branches }}
|
||||
steps:
|
||||
- name: Define Branches
|
||||
id: branches
|
||||
run: |
|
||||
if [ "${{ github.event_name }}" = "schedule" ]; then
|
||||
echo 'branches=["1.10.x", "dev"]' >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
echo 'branches=["${{ github.ref_name }}"]' >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
|
||||
compile:
|
||||
name: SpecFlow Tests
|
||||
needs: define-matrix
|
||||
runs-on: windows-2025
|
||||
strategy:
|
||||
matrix:
|
||||
branch: ${{ fromJSON(needs.define-matrix.outputs.branches) }}
|
||||
fail-fast: false
|
||||
defaults:
|
||||
run:
|
||||
shell: cmd
|
||||
steps:
|
||||
- name: Clone Repository
|
||||
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
|
||||
with:
|
||||
ref: ${{ matrix.branch }}
|
||||
|
||||
- name: Restore NuGet Packages
|
||||
run: nuget restore src/Orchard.sln
|
||||
|
||||
- name: Add msbuild to PATH
|
||||
uses: microsoft/setup-msbuild@6fb02220983dee41ce7ae257b6f4d8f9bf5ed4ce # v2.0.0
|
||||
|
||||
- name: Compile
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Compile /p:MvcBuildViews=true /p:TreatWarningsAsErrors=true -WarnAsError
|
||||
|
||||
- name: Test
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Test
|
||||
|
||||
- name: Spec
|
||||
run: msbuild Orchard.proj /m /v:minimal /t:Spec
|
@@ -4,7 +4,7 @@ using Orchard.Commands;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Indexing.Services;
|
||||
using Orchard.Tasks.Indexing;
|
||||
using Orchard.Utility.Extensions;
|
||||
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
||||
|
||||
namespace Orchard.Indexing.Commands {
|
||||
public class IndexingCommands : DefaultOrchardCommandHandler {
|
||||
@@ -38,15 +38,11 @@ namespace Orchard.Indexing.Commands {
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
|
||||
if (index.ToSafeName() != index) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
}
|
||||
else {
|
||||
var indexProvider = _indexManager.GetSearchIndexProvider();
|
||||
if (indexProvider == null) {
|
||||
Context.Output.WriteLine(T("No indexing service was found. Please enable a module like Lucene."));
|
||||
@@ -61,12 +57,11 @@ namespace Orchard.Indexing.Commands {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CommandName("index update")]
|
||||
[CommandHelp("index update <index>\r\n\t" + "Updates the specified index")]
|
||||
public void Update(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
@@ -78,7 +73,7 @@ namespace Orchard.Indexing.Commands {
|
||||
[CommandName("index rebuild")]
|
||||
[CommandHelp("index rebuild <index> \r\n\t" + "Rebuilds the specified index")]
|
||||
public void Rebuild(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
@@ -91,7 +86,7 @@ namespace Orchard.Indexing.Commands {
|
||||
[CommandHelp("index query <index> /Query:<query>\r\n\t" + "Searches the specified <query> terms in the specified index")]
|
||||
[OrchardSwitches("Query")]
|
||||
public void Search(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
@@ -126,7 +121,7 @@ namespace Orchard.Indexing.Commands {
|
||||
[CommandHelp("index stats <index>\r\n\t" + "Displays some statistics about the search index")]
|
||||
[OrchardSwitches("IndexName")]
|
||||
public void Stats(string index) {
|
||||
if (string.IsNullOrWhiteSpace(index)) {
|
||||
if (!IsValidIndexName(index)) {
|
||||
Context.Output.WriteLine(T("Invalid index name."));
|
||||
return;
|
||||
}
|
||||
@@ -140,11 +135,10 @@ namespace Orchard.Indexing.Commands {
|
||||
}
|
||||
|
||||
[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")]
|
||||
public void Refresh() {
|
||||
int contentItemId;
|
||||
if ( !int.TryParse(ContentItem, out contentItemId) ) {
|
||||
if (!int.TryParse(ContentItem, out int contentItemId)) {
|
||||
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
||||
return;
|
||||
}
|
||||
@@ -152,15 +146,14 @@ namespace Orchard.Indexing.Commands {
|
||||
var contentItem = _contentManager.Get(contentItemId);
|
||||
_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")]
|
||||
[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")]
|
||||
public void Delete() {
|
||||
int contentItemId;
|
||||
if(!int.TryParse(ContentItem, out contentItemId)) {
|
||||
if (!int.TryParse(ContentItem, out int contentItemId)) {
|
||||
Context.Output.WriteLine(T("Invalid content item id. Not an integer."));
|
||||
return;
|
||||
}
|
||||
|
@@ -2,12 +2,12 @@
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Indexing.Services;
|
||||
using Orchard.Indexing.ViewModels;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Security;
|
||||
using Orchard.Indexing.ViewModels;
|
||||
using Orchard.UI.Notify;
|
||||
using Orchard.Utility.Extensions;
|
||||
using static Orchard.Indexing.Helpers.IndexingHelpers;
|
||||
|
||||
namespace Orchard.Indexing.Controllers {
|
||||
public class AdminController : Controller {
|
||||
@@ -50,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);
|
||||
}
|
||||
|
||||
@@ -59,7 +57,7 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
return View("Create", String.Empty);
|
||||
return View("Create");
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Create")]
|
||||
@@ -68,7 +66,7 @@ namespace Orchard.Indexing.Controllers {
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var provider = _indexManager.GetSearchIndexProvider();
|
||||
if (String.IsNullOrWhiteSpace(id) || id.ToSafeName() != id) {
|
||||
if (!IsValidIndexName(id)) {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
return View("Create", id);
|
||||
}
|
||||
@@ -84,7 +82,7 @@ namespace Orchard.Indexing.Controllers {
|
||||
}
|
||||
catch (Exception e) {
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -96,7 +94,12 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
if (IsValidIndexName(id)) {
|
||||
_indexingService.UpdateIndex(id);
|
||||
}
|
||||
else {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
@@ -106,7 +109,12 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
if (IsValidIndexName(id)) {
|
||||
_indexingService.RebuildIndex(id);
|
||||
}
|
||||
else {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
@@ -116,7 +124,12 @@ namespace Orchard.Indexing.Controllers {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage the search index.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
if (IsValidIndexName(id)) {
|
||||
_indexingService.DeleteIndex(id);
|
||||
}
|
||||
else {
|
||||
Services.Notifier.Error(T("Invalid index name."));
|
||||
}
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
|
@@ -0,0 +1,8 @@
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Indexing.Helpers {
|
||||
public static class IndexingHelpers {
|
||||
public static bool IsValidIndexName(string name) =>
|
||||
!string.IsNullOrWhiteSpace(name) && name.ToSafeName() == name;
|
||||
}
|
||||
}
|
@@ -95,6 +95,7 @@
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Commands\IndexingCommands.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Helpers\IndexingHelpers.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Handlers\CreateIndexingTaskHandler.cs" />
|
||||
<Compile Include="Handlers\InfosetFieldIndexingHandler.cs" />
|
||||
|
Reference in New Issue
Block a user