Skip to content

Commit

Permalink
Merge branch 'develop' into trunk
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia committed Jan 16, 2024
2 parents a34c1fa + 38f2105 commit 4c3e1ca
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 50 deletions.
4 changes: 0 additions & 4 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions elasticpress.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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' );

Expand Down
8 changes: 2 additions & 6 deletions includes/classes/Feature/Autosuggest/Autosuggest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down Expand Up @@ -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;

Expand Down
2 changes: 1 addition & 1 deletion includes/classes/Feature/WooCommerce/Orders.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
29 changes: 12 additions & 17 deletions includes/classes/Indexable/Term/Term.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'] ) ) {
Expand All @@ -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 ) {
Expand Down
20 changes: 10 additions & 10 deletions lang/elasticpress.pot
Original file line number Diff line number Diff line change
@@ -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 <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <[email protected]>\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"
Expand Down Expand Up @@ -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 ""

Expand All @@ -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 ""

Expand All @@ -598,23 +598,23 @@ msgstr ""

#. translators: 1: <a> tag (ElasticPress.io); 2. </a>; 3: <a> tag (KB article); 4. </a>; 5: <a> tag (Site Health Debug Section); 6. </a>;
#: 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: <code>.custom-selector, #custom-id, input[type=\"text\"]</code>"
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 ""

Expand Down
16 changes: 8 additions & 8 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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": {
Expand Down
18 changes: 17 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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:__
Expand Down

0 comments on commit 4c3e1ca

Please sign in to comment.