diff --git a/.gitattributes b/.gitattributes index f7fa86e5fc..511d902c43 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,15 +22,11 @@ /.wp-env.json export-ignore /CHANGELOG.md export-ignore /CODE_OF_CONDUCT.md export-ignore -/composer.json export-ignore -/composer.lock export-ignore /CONTRIBUTING.md export-ignore /CREDITS.md export-ignore /gulpfile.babel.js export-ignore /hookdoc-conf.json export-ignore /LICENSE.md export-ignore -/package.json export-ignore -/package-lock.json export-ignore /phpcs.xml export-ignore /phpunit.xml.dist export-ignore /postcss.config.js export-ignore diff --git a/CHANGELOG.md b/CHANGELOG.md index 8476a28386..43bdc8a622 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,19 @@ All notable changes to this project will be documented in this file, per [the Ke ### Security --> +## [5.0.2] - 2024-01-16 + +### Changed +* [Terms] Counts are now calculated with `wp_count_terms()` in `query_db`. Props [@rebeccahum](https://github.com/rebeccahum) via [#3791](https://github.com/10up/ElasticPress/pull/3791). +* Composer and npm files are now part of the final package. Props [@felipeelia](https://github.com/felipeelia) via [#3810](https://github.com/10up/ElasticPress/pull/3810). + +### Fixed +* [WooCommerce] Not use a hard-coded list of order post types. Props [@felipeelia](https://github.com/felipeelia) via [#3807](https://github.com/10up/ElasticPress/pull/3807). +* [Autosuggest] Stop calling the get`-autosuggest-allowed` endpoint to build the REST API schema. Props [@felipeelia](https://github.com/felipeelia) via [#3809](https://github.com/10up/ElasticPress/pull/3809). + +### Security +* Bumped `follow-redirects` from 1.15.3 to 1.15.4. Props [@dependabot](https://github.com/dependabot) via [#3808](https://github.com/10up/ElasticPress/pull/3808). + ## [5.0.1] - 2023-12-12 ### Added @@ -2050,6 +2063,7 @@ This is a bug fix release with some filter additions. - Initial plugin release [Unreleased]: https://github.com/10up/ElasticPress/compare/trunk...develop +[5.0.2]: https://github.com/10up/ElasticPress/compare/5.0.1...5.0.2 [5.0.1]: https://github.com/10up/ElasticPress/compare/5.0.0...5.0.1 [5.0.0]: https://github.com/10up/ElasticPress/compare/4.7.2...5.0.0 [4.7.2]: https://github.com/10up/ElasticPress/compare/4.7.1...4.7.2 diff --git a/elasticpress.php b/elasticpress.php index 647b1e24b7..4265135e26 100644 --- a/elasticpress.php +++ b/elasticpress.php @@ -3,7 +3,7 @@ * Plugin Name: ElasticPress * Plugin URI: https://github.com/10up/ElasticPress * Description: A fast and flexible search and query engine for WordPress. - * Version: 5.0.1 + * Version: 5.0.2 * Requires at least: 6.0 * Requires PHP: 7.4 * Author: 10up @@ -32,7 +32,7 @@ define( 'EP_URL', plugin_dir_url( __FILE__ ) ); define( 'EP_PATH', plugin_dir_path( __FILE__ ) ); define( 'EP_FILE', plugin_basename( __FILE__ ) ); -define( 'EP_VERSION', '5.0.1' ); +define( 'EP_VERSION', '5.0.2' ); define( 'EP_PHP_VERSION_MIN', '7.4' ); diff --git a/includes/classes/Feature/Autosuggest/Autosuggest.php b/includes/classes/Feature/Autosuggest/Autosuggest.php index 9fea317336..c121ae105a 100644 --- a/includes/classes/Feature/Autosuggest/Autosuggest.php +++ b/includes/classes/Feature/Autosuggest/Autosuggest.php @@ -852,8 +852,7 @@ public function intercept_remote_request() { * @since 5.0.0 */ protected function maybe_add_epio_settings_schema() { - $allowed_params = $this->epio_autosuggest_set_and_get(); - if ( empty( $allowed_params ) ) { + if ( ! Utils\is_epio() ) { return; } @@ -900,10 +899,7 @@ protected function set_settings_schema() { ], ]; - if ( Utils\is_epio() ) { - $this->maybe_add_epio_settings_schema(); - return; - } + $this->maybe_add_epio_settings_schema(); $set_in_wp_config = defined( 'EP_AUTOSUGGEST_ENDPOINT' ) && EP_AUTOSUGGEST_ENDPOINT; diff --git a/includes/classes/Feature/WooCommerce/Orders.php b/includes/classes/Feature/WooCommerce/Orders.php index 0301aff448..dd3a7d3c93 100644 --- a/includes/classes/Feature/WooCommerce/Orders.php +++ b/includes/classes/Feature/WooCommerce/Orders.php @@ -106,7 +106,7 @@ public function get_admin_searchable_post_types() { * @return array */ public function allow_meta_keys( $meta, $post ) { - if ( ! in_array( $post->post_type, [ 'shop_order', 'shop_order_refund' ], true ) ) { + if ( ! in_array( $post->post_type, $this->get_supported_post_types(), true ) ) { return $meta; } diff --git a/includes/classes/Indexable/Term/Term.php b/includes/classes/Indexable/Term/Term.php index 4147f57b7b..df11f6b619 100644 --- a/includes/classes/Indexable/Term/Term.php +++ b/includes/classes/Indexable/Term/Term.php @@ -620,14 +620,16 @@ public function prepare_document( $term_id ) { * @return array */ public function query_db( $args ) { - $defaults = [ - 'number' => $this->get_bulk_items_per_page(), - 'offset' => 0, - 'orderby' => 'id', - 'order' => 'desc', - 'taxonomy' => $this->get_indexable_taxonomies(), - 'hide_empty' => false, + 'number' => $this->get_bulk_items_per_page(), + 'offset' => 0, + 'orderby' => 'id', + 'order' => 'desc', + 'taxonomy' => $this->get_indexable_taxonomies(), + 'hide_empty' => false, + 'hierarchical' => false, + 'update_term_meta_cache' => false, + 'cache_results' => false, ]; if ( isset( $args['per_page'] ) ) { @@ -650,23 +652,16 @@ public function query_db( $args ) { unset( $all_query_args['offset'] ); unset( $all_query_args['fields'] ); - /** - * This just seems so inefficient. - * - * @todo Better way to do this? - */ - /** * Filter database arguments for term count query * * @hook ep_term_all_query_db_args - * @param {array} $args Query arguments based to WP_Term_Query + * @param {array} $args Query arguments based to `wp_count_terms()` * @since 3.4 * @return {array} New arguments */ - $all_query = new WP_Term_Query( apply_filters( 'ep_term_all_query_db_args', $all_query_args, $args ) ); - - $total_objects = count( $all_query->terms ); + $total_objects = wp_count_terms( apply_filters( 'ep_term_all_query_db_args', $all_query_args, $args ) ); + $total_objects = ! is_wp_error( $total_objects ) ? (int) $total_objects : 0; if ( ! empty( $args['offset'] ) ) { if ( (int) $args['offset'] >= $total_objects ) { diff --git a/lang/elasticpress.pot b/lang/elasticpress.pot index 7de0c7de09..109d4e4933 100644 --- a/lang/elasticpress.pot +++ b/lang/elasticpress.pot @@ -1,15 +1,15 @@ -# Copyright (C) 2023 10up +# Copyright (C) 2024 10up # This file is distributed under the GPL v2 or later. msgid "" msgstr "" -"Project-Id-Version: ElasticPress 5.0.1\n" +"Project-Id-Version: ElasticPress 5.0.2\n" "Report-Msgid-Bugs-To: https://wordpress.org/support/plugin/elasticpress\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" "MIME-Version: 1.0\n" "Content-Type: text/plain; charset=UTF-8\n" "Content-Transfer-Encoding: 8bit\n" -"POT-Creation-Date: 2023-12-12T13:14:03+00:00\n" +"POT-Creation-Date: 2024-01-16T13:04:02+00:00\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "X-Generator: WP-CLI 2.8.1\n" "X-Domain: elasticpress\n" @@ -567,7 +567,7 @@ msgid "When enabled, a gtag tracking event is fired when an autosuggest result i msgstr "" #: includes/classes/Feature/Autosuggest/Autosuggest.php:128 -#: includes/classes/Feature/Autosuggest/Autosuggest.php:914 +#: includes/classes/Feature/Autosuggest/Autosuggest.php:910 msgid "Endpoint URL" msgstr "" @@ -576,7 +576,7 @@ msgid "Your autosuggest endpoint is set in wp-config.php" msgstr "" #: includes/classes/Feature/Autosuggest/Autosuggest.php:136 -#: includes/classes/Feature/Autosuggest/Autosuggest.php:912 +#: includes/classes/Feature/Autosuggest/Autosuggest.php:908 msgid "This address will be exposed to the public." msgstr "" @@ -598,23 +598,23 @@ msgstr "" #. translators: 1: tag (ElasticPress.io); 2. ; 3: tag (KB article); 4. ; 5: tag (Site Health Debug Section); 6. ; #: includes/classes/Feature/Autosuggest/Autosuggest.php:792 -#: includes/classes/Feature/Autosuggest/Autosuggest.php:868 +#: includes/classes/Feature/Autosuggest/Autosuggest.php:867 msgid "You are directly connected to %1$sElasticPress.io%2$s, ensuring the most performant Autosuggest experience. %3$sLearn more about what this means%4$s or %5$sclick here for debug information%6$s." msgstr "" -#: includes/classes/Feature/Autosuggest/Autosuggest.php:889 +#: includes/classes/Feature/Autosuggest/Autosuggest.php:888 msgid "Input additional selectors where you would like to include autosuggest, separated by a comma. Example: .custom-selector, #custom-id, input[type=\"text\"]" msgstr "" -#: includes/classes/Feature/Autosuggest/Autosuggest.php:891 +#: includes/classes/Feature/Autosuggest/Autosuggest.php:890 msgid "Additional selectors" msgstr "" -#: includes/classes/Feature/Autosuggest/Autosuggest.php:897 +#: includes/classes/Feature/Autosuggest/Autosuggest.php:896 msgid "Enable to fire a gtag tracking event when an autosuggest result is clicked." msgstr "" -#: includes/classes/Feature/Autosuggest/Autosuggest.php:898 +#: includes/classes/Feature/Autosuggest/Autosuggest.php:897 msgid "Trigger Google Analytics events" msgstr "" diff --git a/package-lock.json b/package-lock.json index 7009338511..c381fcc2b3 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "elasticpress", - "version": "5.0.1", + "version": "5.0.2", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "elasticpress", - "version": "5.0.1", + "version": "5.0.2", "license": "GPL-2.0-or-later", "dependencies": { "@10up/component-tooltip": "^2.0.0", @@ -11262,9 +11262,9 @@ } }, "node_modules/follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "dev": true, "funding": [ { @@ -30769,9 +30769,9 @@ } }, "follow-redirects": { - "version": "1.15.3", - "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.3.tgz", - "integrity": "sha512-1VzOtuEM8pC9SFU1E+8KfTjZyMztRsgEfwQl44z8A25uy13jSzTj6dyK2Df52iV0vgHCfBwLhDWevLn95w5v6Q==", + "version": "1.15.4", + "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.15.4.tgz", + "integrity": "sha512-Cr4D/5wlrb0z9dgERpUL3LrmPKVDsETIJhaCMeDfuFYcqa5bldGV6wBsAN6X/vxlXQtFBMrXdXxdL8CbDTGniw==", "dev": true }, "for-each": { diff --git a/package.json b/package.json index e543156366..fa045ca098 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "elasticpress", - "version": "5.0.1", + "version": "5.0.2", "license": "GPL-2.0-or-later", "description": "A fast and flexible search and query engine for WordPress.", "devDependencies": { diff --git a/readme.txt b/readme.txt index 9d9b04b4f2..8a60c1d764 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: 10up, tlovett1, vhauri, tott, felipeelia, oscarssanchez, cmmarslender Tags: performance, slow, search, elasticsearch, fuzzy, facet, aggregation, searching, autosuggest, suggest, elastic, advanced search, woocommerce, related posts, woocommerce Tested up to: 6.4 -Stable tag: 5.0.1 +Stable tag: 5.0.2 License: GPLv2 or later License URI: https://www.gnu.org/licenses/gpl-2.0.html @@ -79,6 +79,22 @@ For sure! Feel free to submit ideas or feedback in general to our [GitHub repo]( == Changelog == += 5.0.2 - 2024-01-16 = + +__Changed:__ + +* [Terms] Counts are now calculated with `wp_count_terms()` in `query_db`. Props [@rebeccahum](https://github.com/rebeccahum). +* Composer and npm files are now part of the final package. Props [@felipeelia](https://github.com/felipeelia). + +__Fixed:__ + +* [WooCommerce] Not use a hard-coded list of order post types. Props [@felipeelia](https://github.com/felipeelia). +* [Autosuggest] Stop calling the get`-autosuggest-allowed` endpoint to build the REST API schema. Props [@felipeelia](https://github.com/felipeelia). + +__Security:__ + +* Bumped `follow-redirects` from 1.15.3 to 1.15.4. Props [@dependabot](https://github.com/dependabot). + = 5.0.1 - 2023-12-12 = __Added:__