From d5c21289bbd912a01b8371017bf596eef881e624 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Marc=20Farr=C3=A9?= <23310825+marc-farre@users.noreply.github.com> Date: Mon, 15 Jul 2024 13:27:21 +0200 Subject: [PATCH] Fix rebuilding the search index with Grunt (since 1.16.0) (#7116) * Fix rebuilding the search index with Grunt (since 1.16.0) * Add PR ID to changelog --- CHANGELOG.md | 1 + Gruntfile.js | 32 ++++++++++++++++---------------- 2 files changed, 17 insertions(+), 16 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 604ccc812d..e9438b9d60 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ HumHub Changelog - Fix #7102: Fix content search with word ending with hyphen - Fix #7104: Missing `--text-color-default` CSS variable - Enh #7105: Add an external link icon to the "Install Updates" button to avoid thinking it updates the modules directly +- Fix #7116: Fix rebuilding the search index with Grunt (since 1.16.0) 1.16.1 (July 1, 2024) --------------------- diff --git a/Gruntfile.js b/Gruntfile.js index 00dd5ac8f7..ba302a5bdb 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -6,11 +6,11 @@ module.exports = function (grunt) { var cssMinAssetcfg = {}; cssMinAssetcfg[grunt.option('to')] = [grunt.option('from')]; - var isWin = function() { + var isWin = function () { return (process.platform === "win32"); }; - var cmdSep = function() { + var cmdSep = function () { return isWin() ? '&' : ';'; }; @@ -19,7 +19,7 @@ module.exports = function (grunt) { clean: ["assets/*"], shell: { buildAssets: { - command: function() { + command: function () { let rm = isWin() ? 'del' : 'rm'; let sep = cmdSep(); let delAssets = isWin() ? '(For /D %i in (static\\assets\\*.*) do (rmdir %i /S /Q))' : `${rm} -rf static/assets/*/`; @@ -30,18 +30,18 @@ module.exports = function (grunt) { } }, buildSearch: { - command: function() { + command: function () { let sep = cmdSep(); - return `cd protected ${sep} php yii search/rebuild`; + return `cd protected ${sep} php yii content-search/rebuild`; } }, testServer: { command: "php -S localhost:8080 index-test.php" }, testRun: { - command: function() { + command: function () { let sep = cmdSep(); - let moduleName = grunt.option('module') || grunt.option('m') || null; + let moduleName = grunt.option('module') || grunt.option('m') || null; let doBuild = grunt.option('build') || false; let base = process.cwd(); @@ -49,7 +49,7 @@ module.exports = function (grunt) { let rootTestPath = `${base}/protected/humhub/tests`; let testPath = rootTestPath; - if(moduleName) { + if (moduleName) { testPath = `${base}/protected/humhub/modules/${moduleName}/tests`; } @@ -57,10 +57,10 @@ module.exports = function (grunt) { let path = grunt.option('path') || null; let executionPath = ''; - if(suite) { + if (suite) { executionPath = suite; - } else if(path) { - if(path.indexOf('codeception') !== 0) { + } else if (path) { + if (path.indexOf('codeception') !== 0) { path = 'codeception' + ((path.indexOf('/') !== 0) ? '/' : '') + path; } executionPath = path; @@ -69,10 +69,10 @@ module.exports = function (grunt) { let options = grunt.option('options') || ''; options += grunt.option('raw') ? ' --no-ansi' : ''; options += grunt.option('debug') ? ' -d' : ''; - options += grunt.option('env') ? ' --env '+ grunt.option('env') : ''; + options += grunt.option('env') ? ' --env ' + grunt.option('env') : ''; - let build = `cd ${rootTestPath} ${sep} php ${codeceptPath} build`; + let build = `cd ${rootTestPath} ${sep} php ${codeceptPath} build`; let run = `cd ${testPath} ${sep} php ${codeceptPath} run ${executionPath} ${options}`; @@ -80,21 +80,21 @@ module.exports = function (grunt) { } }, buildTheme: { - command: function(name) { + command: function (name) { let theme = name || grunt.option('name') || "HumHub"; let sep = cmdSep(); return `cd themes/${theme}/less ${sep} lessc -x build.less ../css/theme.css`; } }, migrateCreate: { - command: function(name) { + command: function (name) { let migrationName = name || grunt.option('name'); let sep = cmdSep(); return `cd protected ${sep} php yii migrate/create ${migrationName}`; } }, migrateUp: { - command: function(modules) { + command: function (modules) { let includeModuleMigrations = modules || grunt.option('modules') || "1"; let sep = cmdSep(); return `cd protected ${sep} php yii migrate/up --includeModuleMigrations=${includeModuleMigrations}`;