Skip to content

Commit

Permalink
Merge branch 'develop' into fix/3654
Browse files Browse the repository at this point in the history
  • Loading branch information
burhandodhy authored Feb 26, 2025
2 parents 700d913 + 377fb88 commit 53246dc
Show file tree
Hide file tree
Showing 33 changed files with 13,863 additions and 4,848 deletions.
5 changes: 5 additions & 0 deletions .github/hookdoc-tmpl/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

ElasticPress, a fast and flexible search and query engine for WordPress, enables WordPress to find or “query” relevant content extremely fast through a variety of highly customizable features. WordPress out-of-the-box struggles to analyze content relevancy and can be very slow. ElasticPress supercharges your WordPress website making for happier users and administrators. The plugin even contains features for popular plugins.

**ElasticPress 5.2:** Minimum versions required for ElasticPress 5.2 are:
* [Elasticsearch](https://www.elastic.co) 5.2+
* [WordPress](https://wordpress.org) 6.2+
* [PHP](https://php.net/) 7.4+

**ElasticPress 5.0:** Minimum versions required for ElasticPress 5.0 are:
* [Elasticsearch](https://www.elastic.co) 5.2+
* [WordPress](https://wordpress.org) 6.0+
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
esVersion: ['7.10.1', '8.12.2']
core:
- {name: 'WP latest', version: '', wcVersion: ''}
- {name: 'WP minimum', version: '6.0', wcVersion: '6.4.0'}
- {name: 'WP minimum', version: '6.2', wcVersion: '6.4.0'}

steps:
- name: Checkout
Expand Down Expand Up @@ -79,7 +79,7 @@ jobs:
run: npm run build

- name: Set up database
run: npm run cypress:setup -- --wp-version=${{ matrix.core.version }} --wc-version=${{ matrix.core.wcVersion }}
run: npm run cypress:setup -- --wp-version=${{ matrix.core.version }} --wc-version=${{ matrix.core.wcVersion }} --acf-pro-license='${{ secrets.ACF_PRO_LICENSE_KEY }}'

- name: Test
run: npm run cypress:run -- --env grepTags=${{ matrix.testGroup }}
Expand Down Expand Up @@ -117,7 +117,7 @@ jobs:
testGroup: ['@slow', '-@slow']
core:
- {name: 'WP latest', version: '', wcVersion: ''}
- {name: 'WP minimum', version: '6.0', wcVersion: '6.4.0'}
- {name: 'WP minimum', version: '6.2', wcVersion: '6.4.0'}

steps:
- name: Checkout
Expand Down Expand Up @@ -166,7 +166,7 @@ jobs:
run: npm run build

- name: Set up database
run: npm run cypress:setup -- --ep-host=${{ secrets.EPIO_HOST }} --es-shield='${{ secrets.EPIO_SHIELD }}' --ep-index-prefix=${{ secrets.EPIO_INDEX_PREFIX }} --wp-version=${{ matrix.core.version }} --wc-version=${{ matrix.core.wcVersion }}
run: npm run cypress:setup -- --ep-host=${{ secrets.EPIO_HOST }} --es-shield='${{ secrets.EPIO_SHIELD }}' --ep-index-prefix=${{ secrets.EPIO_INDEX_PREFIX }} --wp-version=${{ matrix.core.version }} --wc-version=${{ matrix.core.wcVersion }} --acf-pro-license='${{ secrets.ACF_PRO_LICENSE_KEY }}'

- name: Test
run: npm run cypress:run -- --env grepTags=${{ matrix.testGroup }}
Expand Down
1 change: 1 addition & 0 deletions .wp-env.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
],
"mappings": {
".htaccess": "./tests/cypress/wordpress-files/.htaccess",
"wp-content/composer.json": "./tests/cypress/wordpress-files/composer.json",
"wp-content/mu-plugins/disable-welcome-guide.php": "./tests/cypress/wordpress-files/test-mu-plugins/disable-welcome-guide.php",
"wp-content/mu-plugins/skip-wp-lookup.php": "./tests/cypress/wordpress-files/test-mu-plugins/skip-wp-lookup.php",
"wp-content/mu-plugins/unique-index-name.php": "./tests/cypress/wordpress-files/test-mu-plugins/unique-index-name.php",
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ ElasticPress, a fast and flexible search and query engine for WordPress, enables
ElasticPress requires these software with the following versions:

* [Elasticsearch](https://www.elastic.co) 5.2+
* [WordPress](https://wordpress.org) 6.0+
* [WordPress](https://wordpress.org) 6.2+
* [PHP](https://php.net/) 7.4+

### Compatibility
Expand Down
2 changes: 1 addition & 1 deletion assets/js/instant-results/components/common/modal.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* External dependencies.
*/
import FocusTrap from 'focus-trap-react';
import { FocusTrap } from 'focus-trap-react';

/**
* WordPress dependencies.
Expand Down
22 changes: 14 additions & 8 deletions assets/js/stats.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable no-new */

import Chart from 'chart.js';
import Chart from 'chart.js/auto';

const { epChartData } = window;

Expand All @@ -25,8 +25,6 @@ const barLabels = [];
const barDocs = [];
const barColors = [];

Chart.defaults.global.legend.labels.usePointStyle = true;

barData.forEach(function (data) {
barLabels.push(data[1].name);
barDocs.push(data[1].docs);
Expand All @@ -36,7 +34,7 @@ barData.forEach(function (data) {
const documentChart = document.getElementById('documentChart');
if (documentChart) {
new Chart(documentChart, {
type: 'horizontalBar',
type: 'bar',
data: {
labels: barLabels,
datasets: [
Expand All @@ -48,8 +46,11 @@ if (documentChart) {
],
},
options: {
legend: {
display: false,
indexAxis: 'y',
plugins: {
legend: {
display: false,
},
},
title: {
display: true,
Expand Down Expand Up @@ -77,8 +78,13 @@ if (queriesTotalChart) {
title: {
display: true,
},
legend: {
position: 'right',
plugins: {
legend: {
position: 'right',
labels: {
usePointStyle: true,
},
},
},
tooltips: {
callbacks: {
Expand Down
35 changes: 24 additions & 11 deletions bin/setup-cypress-env.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,22 +2,26 @@

# cat ./bin/2022-02-15-12-49.sql | ./bin/wp-env-cli tests-wordpress "wp --allow-root db import -"

ACF_PRO_LICENSE_KEY=""
DISPLAY_HELP=0
EP_HOST=""
ES_SHIELD=""
EP_INDEX_PREFIX=""
WP_VERSION=""
WC_VERSION=""
DISPLAY_HELP=0

for opt in "$@"; do
case $opt in
-h=*|--ep-host=*)
--acf-pro-license=*)
ACF_PRO_LICENSE_KEY="${opt#*=}"
;;
-H=*|--ep-host=*)
EP_HOST="${opt#*=}"
;;
-s=*|--es-shield=*)
-S=*|--es-shield=*)
ES_SHIELD="${opt#*=}"
;;
-u=*|--ep-index-prefix=*)
-p=*|--ep-index-prefix=*)
EP_INDEX_PREFIX="${opt#*=}"
;;
-wp=*|--wp-version=*)
Expand All @@ -39,12 +43,13 @@ if [ $DISPLAY_HELP -eq 1 ]; then
echo "Usage: ${0##*/} [OPTIONS...]"
echo
echo "Optional parameters:"
echo "-h=*, --ep-host=* The remote Elasticsearch Host URL."
echo "-s=*, --es-shield=* The Elasticsearch credentials, used in the ES_SHIELD constant."
echo "-u=*, --ep-index-prefix=* The Elasticsearch credentials, used in the EP_INDEX_PREFIX constant."
echo "-W=*, --wp-version=* WordPress Core version."
echo "-w=*, --wc-version=* WooCommerce version."
echo "-h|--help Display this help screen"
echo "--acf-pro-license=* ACF Pro License Key."
echo "-H=*, --ep-host=* The remote Elasticsearch Host URL."
echo "-S=*, --es-shield=* The Elasticsearch credentials, used in the ES_SHIELD constant."
echo "-p=*, --ep-index-prefix=* The Elasticsearch credentials, used in the EP_INDEX_PREFIX constant."
echo "-W=*, --wp-version=* WordPress Core version."
echo "-w=*, --wc-version=* WooCommerce version."
echo "-h|--help Display this help screen"
exit
fi

Expand All @@ -54,7 +59,7 @@ else
./bin/wp-env-cli tests-wordpress "wp --allow-root plugin install woocommerce --activate --version=${WC_VERSION}"
fi

# Set twentytwentyone as the active theme here, as 2025 won't work with WP 6.0
# Set twentytwentyone as the active theme here, as 2025 won't work with WP 6.2
./bin/wp-env-cli tests-wordpress "wp --allow-root theme activate twentytwentyone"

# Fix the debug-bar-elasticpress dependency of ElasticPress
Expand Down Expand Up @@ -90,6 +95,14 @@ if [ ! -z $EP_INDEX_PREFIX ]; then
./bin/wp-env-cli tests-wordpress "wp --allow-root config set EP_INDEX_PREFIX ${EP_INDEX_PREFIX}"
fi

if [ ! -z $ACF_PRO_LICENSE_KEY ]; then
./bin/wp-env-cli tests-wordpress "composer --working-dir=./wp-content config http-basic.connect.advancedcustomfields.com ${ACF_PRO_LICENSE_KEY} https://elasticpress.test"
./bin/wp-env-cli tests-wordpress "composer --working-dir=./wp-content install"
./bin/wp-env-cli tests-wordpress "rm wp-content/auth.json"
./bin/wp-env-cli tests-wordpress "wp --allow-root plugin activate advanced-custom-fields-pro"
./bin/wp-env-cli tests-wordpress "wp --allow-root config set ACF_PRO_LICENSE ${ACF_PRO_LICENSE_KEY}"
fi

./bin/wp-env-cli tests-wordpress "wp --allow-root core multisite-convert"

SITES_COUNT=$(./bin/wp-env-cli tests-wordpress "wp --allow-root site list --format=count")
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@
"10up/phpcs-composer": "dev-trunk",
"wpackagist-plugin/woocommerce":"*",
"phpcompatibility/phpcompatibility-wp": "*",
"brianhenryie/strauss": "^0.14.0",
"yoast/phpunit-polyfills": "^1.0 || ^2.0 || ^3.0",
"brianhenryie/strauss": "^0.21.0",
"yoast/phpunit-polyfills": "^4.0",
"phpunit/phpunit": "^9.0.0"
},
"scripts": {
Expand Down
Loading

0 comments on commit 53246dc

Please sign in to comment.