Skip to content

Commit

Permalink
Merge branch 'develop' into fix-remove-from-index-on-update
Browse files Browse the repository at this point in the history
  • Loading branch information
felipeelia authored Aug 9, 2024
2 parents 0789506 + 4b047c0 commit 3b9e46d
Show file tree
Hide file tree
Showing 18 changed files with 364 additions and 272 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/cypress-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
uses: actions/upload-artifact@v4
if: failure()
with:
name: cypress-artifact-${{ matrix.core.name }}-${{ matrix.testGroup }}
name: cypress-artifact-${{ matrix.esVersion }}-${{ matrix.core.name }}-${{ matrix.testGroup }}
retention-days: 2
path: |
${{ github.workspace }}/tests/cypress/screenshots/
Expand All @@ -98,7 +98,7 @@ jobs:
- name: Stop Elasticsearch
if: always()
run: cd bin/es-docker/ && docker-compose down
run: cd bin/es-docker/ && docker compose down

- name: Test plugin uninstall
if: always()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
run: sudo systemctl start mysql.service

- name: Setup Elasticsearch
run: cd bin/es-docker/ && docker-compose build --build-arg ES_VERSION=${{ matrix.esVersion }} && docker-compose up -d
run: cd bin/es-docker/ && docker compose build --build-arg ES_VERSION=${{ matrix.esVersion }} && docker compose up -d

- name: Check ES response
run: curl --connect-timeout 5 --max-time 10 --retry 5 --retry-max-time 40 --retry-all-errors http://127.0.0.1:8890
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ All notable changes to this project will be documented in this file, per [the Ke
### Security
-->

## [5.1.3] - 2024-06-11

### Fixed
* Missing nonces on some sync trigger URLs, making them require a manual interaction from the user. Props [@felipeelia](https://github.com/felipeelia) via [#3933](https://github.com/10up/ElasticPress/pull/3933).

## [5.1.2] - 2024-06-11

**This is a security release affecting all previous versions of ElasticPress.**
Expand Down Expand Up @@ -2123,6 +2128,7 @@ This is a bug fix release with some filter additions.
- Initial plugin release

[Unreleased]: https://github.com/10up/ElasticPress/compare/trunk...develop
[5.1.3]: https://github.com/10up/ElasticPress/compare/5.1.2...5.1.3
[5.1.2]: https://github.com/10up/ElasticPress/compare/5.1.1...5.1.2
[5.1.1]: https://github.com/10up/ElasticPress/compare/5.1.0...5.1.1
[5.1.0]: https://github.com/10up/ElasticPress/compare/5.0.2...5.1.0
Expand Down
2 changes: 1 addition & 1 deletion bin/wp-env-cli
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ function spawnCommandDirectly({ container, command, dockerComposeConfigPath }) {
];

return new Promise((resolve, reject) => {
const childProc = spawn('docker-compose', composeCommand, {
const childProc = spawn('docker compose', composeCommand, {
stdio: 'inherit',
shell: true,
});
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.1.2
* Version: 5.1.3
* 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.1.2' );
define( 'EP_VERSION', '5.1.3' );

define( 'EP_PHP_VERSION_MIN', '7.4' );

Expand Down
12 changes: 2 additions & 10 deletions includes/classes/AdminNotices.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,7 @@ protected function process_auto_activate_sync_notice() {
return false;
}

if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
$url = admin_url( 'network/admin.php?page=elasticpress-sync&do_sync=features' );
} else {
$url = admin_url( 'admin.php?page=elasticpress-sync&do_sync=features' );
}
$url = Utils\get_sync_url( 'features' );

$feature = Features::factory()->get_registered_feature( $auto_activate_sync );

Expand Down Expand Up @@ -250,11 +246,7 @@ protected function process_upgrade_sync_notice() {
return false;
}

if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
$url = admin_url( 'network/admin.php?page=elasticpress-sync&do_sync=upgrade' );
} else {
$url = admin_url( 'admin.php?page=elasticpress-sync&do_sync=upgrade' );
}
$url = Utils\get_sync_url( 'upgrade' );

if ( defined( 'EP_DASHBOARD_SYNC' ) && ! EP_DASHBOARD_SYNC ) {
$html = esc_html__( 'Dashboard sync is disabled. The new version of ElasticPress requires that you delete all data and start a fresh sync using WP-CLI.', 'elasticpress' );
Expand Down
4 changes: 2 additions & 2 deletions includes/partials/install-page.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@

if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
$setup_url = admin_url( 'network/admin.php?page=elasticpress-settings' );
$sync_url = admin_url( 'network/admin.php?page=elasticpress-sync&do_sync=install' );
$dashboard_url = admin_url( 'network/admin.php?page=elasticpress' );
} else {
$setup_url = admin_url( 'admin.php?page=elasticpress-settings' );
$sync_url = admin_url( 'admin.php?page=elasticpress-sync&do_sync=install' );
$dashboard_url = admin_url( 'admin.php?page=elasticpress' );
}

$sync_url = \ElasticPress\Utils\get_sync_url( 'install' );

$skip_install_url = add_query_arg(
[
'ep-skip-install' => 1,
Expand Down
10 changes: 7 additions & 3 deletions includes/utils.php
Original file line number Diff line number Diff line change
Expand Up @@ -767,13 +767,17 @@ function get_asset_info( $slug, $attribute = null ) {
* Return the Sync Page URL.
*
* @since 4.4.0
* @param boolean $do_sync Whether the link should or should not start a resync.
* @param boolean|string $do_sync Whether the link should or should not start a resync. Pass a string to store the reason of the resync.
* @return string
*/
function get_sync_url( bool $do_sync = false ) : string {
function get_sync_url( $do_sync = false ) : string {
$page = 'admin.php?page=elasticpress-sync';
if ( $do_sync ) {
$page .= '&do_sync&ep_sync_nonce=' . wp_create_nonce( 'ep_sync_nonce' );
$page .= '&do_sync';
if ( is_string( $do_sync ) ) {
$page .= '=' . rawurlencode( $do_sync );
}
$page .= '&ep_sync_nonce=' . wp_create_nonce( 'ep_sync_nonce' );
}
return ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) ?
network_admin_url( $page ) :
Expand Down
50 changes: 25 additions & 25 deletions lang/elasticpress.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@
# This file is distributed under the GPL v2 or later.
msgid ""
msgstr ""
"Project-Id-Version: ElasticPress 5.1.2\n"
"Project-Id-Version: ElasticPress 5.1.3\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: 2024-06-11T12:43:16+00:00\n"
"POT-Creation-Date: 2024-06-11T18:04:45+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 @@ -46,111 +46,111 @@ msgid "Autosuggest feature is enabled. If documents feature is enabled, your med
msgstr ""

#. translators: Feature name
#: includes/classes/AdminNotices.php:189
#: includes/classes/AdminNotices.php:185
msgid "Dashboard sync is disabled. The ElasticPress %s feature has been auto-activated! You will need to reindex using WP-CLI for it to work."
msgstr ""

#. translators: 1. Feature name; 2: Sync page URL
#: includes/classes/AdminNotices.php:195
#: includes/classes/AdminNotices.php:191
msgid "The ElasticPress %1$s feature has been auto-activated! You will need to <a href=\"%2$s\">run a sync</a> for it to work."
msgstr ""

#: includes/classes/AdminNotices.php:260
#: includes/classes/AdminNotices.php:252
msgid "Dashboard sync is disabled. The new version of ElasticPress requires that you delete all data and start a fresh sync using WP-CLI."
msgstr ""

#. translators: Sync Page URL
#: includes/classes/AdminNotices.php:264
#: includes/classes/AdminNotices.php:256
msgid "The new version of ElasticPress requires that you <a href=\"%s\">delete all data and start a fresh sync</a>."
msgstr ""

#: includes/classes/AdminNotices.php:269
#: includes/classes/AdminNotices.php:261
msgid "Please note that some ElasticPress functionality may be impaired and/or content may not be searchable until the full sync has been performed."
msgstr ""

#: includes/classes/AdminNotices.php:324
#: includes/classes/AdminNotices.php:316
msgid "Dashboard sync is disabled, but ElasticPress is almost ready to go. Trigger a sync from WP-CLI."
msgstr ""

#. translators: Sync Page URL
#: includes/classes/AdminNotices.php:328
#: includes/classes/AdminNotices.php:320
msgid "ElasticPress is almost ready to go. You just need to <a href=\"%s\">sync your content</a>."
msgstr ""

#. translators: Sync Page URL
#: includes/classes/AdminNotices.php:380
#: includes/classes/AdminNotices.php:372
msgid "ElasticPress is almost ready to go. You just need to <a href=\"%s\">enter your settings</a>."
msgstr ""

#. translators: 1. Current Elasticsearch version; 2. Minimum required ES version
#: includes/classes/AdminNotices.php:437
#: includes/classes/AdminNotices.php:429
msgid "Your Elasticsearch version %1$s is below the minimum required Elasticsearch version %2$s. ElasticPress may or may not work properly."
msgstr ""

#. translators: 1. Current Elasticsearch version; 2. Maximum supported ES version
#: includes/classes/AdminNotices.php:489
#: includes/classes/AdminNotices.php:481
msgid "Your Elasticsearch version %1$s is above the maximum required Elasticsearch version %2$s. ElasticPress may or may not work properly."
msgstr ""

#. translators: Document page URL
#: includes/classes/AdminNotices.php:533
#: includes/classes/AdminNotices.php:525
msgid "Your server software is not supported. To learn more about server compatibility please <a href=\"%s\">visit our documentation</a>."
msgstr ""

#. translators: 1. Current URL with retry parameter; 2. Settings Page URL
#: includes/classes/AdminNotices.php:601
#: includes/classes/AdminNotices.php:593
msgid "There is a problem with connecting to your Elasticsearch host. ElasticPress can <a href=\"%1$s\">try your host again</a>, or you may need to <a href=\"%2$s\">change your settings</a>."
msgstr ""

#. translators: Response Code Number
#: includes/classes/AdminNotices.php:609
#: includes/classes/AdminNotices.php:601
msgid "Response Code: %s"
msgstr ""

#. translators: Response Code Message
#: includes/classes/AdminNotices.php:614
#: includes/classes/AdminNotices.php:606
msgid "Response error: %s"
msgstr ""

#. translators: 1. <em>; 2. </em>
#: includes/classes/AdminNotices.php:676
#: includes/classes/AdminNotices.php:668
msgid "It seems the mapping data in your index does not match the Elasticsearch version used. We recommend to reindex your content using the sync button on the top of the screen or through wp-cli by adding the %1$s--setup%2$s flag"
msgstr ""

#. translators: 1. Current mapping file; 2. Mapping file that should be used
#: includes/classes/AdminNotices.php:683
#: includes/classes/AdminNotices.php:675
msgid "Current mapping: %1$s. Expected mapping: %2$s"
msgstr ""

#. translators: Index Health URL
#: includes/classes/AdminNotices.php:741
#: includes/classes/AdminNotices.php:733
msgid "It looks like one or more of your indices are running on a single node. While this won't prevent you from using ElasticPress, depending on your site's specific needs this can represent a performance issue. Please check the <a href=\"%s\">Index Health</a> page where you can check the health of all of your indices."
msgstr ""

#. translators: Elasticsearch or ElasticPress.io; 2. Link to article; 3. Link to article
#: includes/classes/AdminNotices.php:797
#: includes/classes/AdminNotices.php:789
msgid "Your website content has more public custom fields than %1$s is able to store. Check our articles about <a href=\"%2$s\">Elasticsearch field limitations</a> and <a href=\"%3$s\">how to index just the custom fields you need</a> before trying to sync."
msgstr ""

#: includes/classes/AdminNotices.php:798
#: includes/classes/AdminNotices.php:814
#: includes/classes/AdminNotices.php:790
#: includes/classes/AdminNotices.php:806
#: includes/classes/ElasticsearchErrorInterpreter.php:93
#: includes/classes/StatusReport/ElasticPressIo.php:30
#: assets/js/sync/index.js:269
#: dist/js/sync-script.js:1
msgid "ElasticPress.io"
msgstr ""

#: includes/classes/AdminNotices.php:798
#: includes/classes/AdminNotices.php:814
#: includes/classes/AdminNotices.php:790
#: includes/classes/AdminNotices.php:806
#: includes/classes/ElasticsearchErrorInterpreter.php:93
#: assets/js/sync/index.js:270
#: dist/js/sync-script.js:1
msgid "Elasticsearch"
msgstr ""

#. translators: Elasticsearch or ElasticPress.io; 2. Link to article; 3. Link to article
#: includes/classes/AdminNotices.php:813
#: includes/classes/AdminNotices.php:805
msgid "Your website content seems to have more public custom fields than %1$s is able to store. Check our articles about <a href=\"%2$s\">Elasticsearch field limitations</a> and <a href=\"%3$s\">how to index just the custom fields you need</a> if you receive any errors while syncing."
msgstr ""

Expand Down
Loading

0 comments on commit 3b9e46d

Please sign in to comment.