PluginProbe
ElasticPress / 5.3.5
ElasticPress v5.3.5
5.3.5 5.3.4 3.6.5 3.6.6 4.0.0 4.0.1 4.1.0 4.2.0 4.2.1 4.2.2 4.3.0 4.3.1 4.4.0 4.4.1 4.5.0 4.5.1 4.5.2 4.6.0 4.6.1 4.7.0 4.7.1 4.7.2 5.0.0 5.0.1 5.0.2 All 108 releases
← All changes | includes/classes/AdminNotices.php +55 -30 5.0.25.3.5 View file →
@@ -115,14 +115,8 @@
115 115 if ( ! in_array( $screen, [ 'dashboard', 'settings' ], true ) ) {
116 116 return false;
117 117 }
118 118
119 - if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
120 - $url = admin_url( 'network/admin.php?page=elasticpress&do_sync' );
121 - } else {
122 - $url = admin_url( 'admin.php?page=elasticpress&do_sync' );
123 - }
124 -
125 119 return [
126 120 'html' => sprintf( esc_html__( 'Autosuggest feature is enabled. If documents feature is enabled, your media will also become searchable in the frontend.', 'elasticpress' ) ),
127 121 'type' => 'info',
128 122 'dismiss' => true,
@@ -176,17 +170,13 @@
176 170 if ( $dismiss && ! in_array( $screen, [ 'dashboard', 'settings' ], true ) ) {
177 171 return false;
178 172 }
179 173
180 - if ( isset( $_GET['do_sync'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
174 + if ( Utils\isset_do_sync_parameter() ) {
181 175 return false;
182 176 }
183 177
184 - if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
185 - $url = admin_url( 'network/admin.php?page=elasticpress-sync&do_sync=features' );
186 - } else {
187 - $url = admin_url( 'admin.php?page=elasticpress-sync&do_sync=features' );
188 - }
178 + $url = Utils\get_sync_url( 'features' );
189 179
190 180 $feature = Features::factory()->get_registered_feature( $auto_activate_sync );
191 181
192 182 if ( defined( 'EP_DASHBOARD_SYNC' ) && ! EP_DASHBOARD_SYNC ) {
@@ -251,17 +241,13 @@
251 241 if ( $dismiss && ! in_array( $screen, [ 'dashboard', 'settings' ], true ) ) {
252 242 return false;
253 243 }
254 244
255 - if ( isset( $_GET['do_sync'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
245 + if ( Utils\isset_do_sync_parameter() ) {
256 246 return false;
257 247 }
258 248
259 - if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
260 - $url = admin_url( 'network/admin.php?page=elasticpress-sync&do_sync=upgrade' );
261 - } else {
262 - $url = admin_url( 'admin.php?page=elasticpress-sync&do_sync=upgrade' );
263 - }
249 + $url = Utils\get_sync_url( 'upgrade' );
264 250
265 251 if ( defined( 'EP_DASHBOARD_SYNC' ) && ! EP_DASHBOARD_SYNC ) {
266 252 $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' );
267 253 } else {
@@ -315,9 +301,9 @@
315 301 if ( $dismiss && ! in_array( $screen, [ 'dashboard', 'settings' ], true ) ) {
316 302 return false;
317 303 }
318 304
319 - if ( isset( $_GET['do_sync'] ) ) { // phpcs:ignore WordPress.Security.NonceVerification
305 + if ( Utils\isset_do_sync_parameter() ) {
320 306 return false;
321 307 }
322 308
323 309 if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) {
@@ -532,9 +518,9 @@
532 518 if ( $dismiss ) {
533 519 return false;
534 520 }
535 521
536 - $doc_url = 'https://10up.github.io/ElasticPress/tutorial-compatibility.html';
522 + $doc_url = 'https://www.elasticpress.io/resources/articles/compatibility/';
537 523 $html = sprintf(
538 524 /* translators: Document page URL */
539 525 __( 'Your server software is not supported. To learn more about server compatibility please <a href="%s">visit our documentation</a>.', 'elasticpress' ),
540 526 esc_url( $doc_url )
@@ -594,12 +580,19 @@
594 580 $response_code = get_transient( 'ep_es_info_response_code' );
595 581 $response_error = get_transient( 'ep_es_info_response_error' );
596 582 }
597 583
584 + $retry_url = add_query_arg(
585 + [
586 + 'ep-retry' => 1,
587 + 'ep_retry_nonce' => wp_create_nonce( 'ep_retry_nonce' ),
588 + ]
589 + );
590 +
598 591 $html = sprintf(
599 592 /* translators: 1. Current URL with retry parameter; 2. Settings Page URL */
600 593 __( '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>.', 'elasticpress' ),
601 - esc_url( add_query_arg( 'ep-retry', 1 ) ),
594 + esc_url( $retry_url ),
602 595 esc_url( $url )
603 596 );
604 597
605 598 if ( defined( 'WP_DEBUG' ) && WP_DEBUG ) {
@@ -688,9 +681,8 @@
688 681 'dismiss' => true,
689 682 ];
690 683
691 684 }
692 -
693 685 }
694 686
695 687 /**
696 688 * Single node notification. Shows when index health is yellow.
@@ -794,10 +786,10 @@
794 786 $message = sprintf(
795 787 /* translators: Elasticsearch or ElasticPress.io; 2. Link to article; 3. Link to article */
796 788 __( '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.', 'elasticpress' ),
797 789 Utils\is_epio() ? __( 'ElasticPress.io', 'elasticpress' ) : __( 'Elasticsearch', 'elasticpress' ),
798 - 'https://elasticpress.zendesk.com/hc/en-us/articles/360051401212-I-get-the-error-Limit-of-total-fields-in-index-has-been-exceeded-',
799 - 'https://elasticpress.zendesk.com/hc/en-us/articles/360052019111'
790 + 'https://www.elasticpress.io/resources/articles/i-get-the-error-limit-of-total-fields-in-index-has-been-exceeded/',
791 + 'https://www.elasticpress.io/resources/articles/how-to-exclude-metadata-from-indexing/'
800 792 );
801 793
802 794 return [
803 795 'type' => 'error',
@@ -810,10 +802,10 @@
810 802 $message = sprintf(
811 803 /* translators: Elasticsearch or ElasticPress.io; 2. Link to article; 3. Link to article */
812 804 __( '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.', 'elasticpress' ),
813 805 Utils\is_epio() ? __( 'ElasticPress.io', 'elasticpress' ) : __( 'Elasticsearch', 'elasticpress' ),
814 - 'https://elasticpress.zendesk.com/hc/en-us/articles/360051401212-I-get-the-error-Limit-of-total-fields-in-index-has-been-exceeded-',
815 - 'https://elasticpress.zendesk.com/hc/en-us/articles/360052019111'
806 + 'https://www.elasticpress.io/resources/articles/i-get-the-error-limit-of-total-fields-in-index-has-been-exceeded/',
807 + 'https://www.elasticpress.io/resources/articles/how-to-exclude-metadata-from-indexing/'
816 808 );
817 809
818 810 return [
819 811 'type' => 'warning',
@@ -838,9 +830,35 @@
838 830 * @hook ep_admin_notices
839 831 * @param {array} $notices Admin notices
840 832 * @return {array} New notices
841 833 */
842 - return apply_filters( 'ep_admin_notices', $this->notices );
834 + $notices = apply_filters( 'ep_admin_notices', $this->notices );
835 +
836 + if ( ! is_array( $notices ) ) {
837 + _doing_it_wrong(
838 + __METHOD__,
839 + sprintf(
840 + /* translators: %s: Detected variable type. */
841 + esc_html__( 'Callbacks of filter hook `ep_admin_notices` must return a value of type array, %s detected.', 'elasticpress' ),
842 + esc_html( gettype( $notices ) )
843 + ),
844 + 'ElasticPress 5.3.3'
845 + );
846 +
847 + $notices = [];
848 + }
849 +
850 + // If the plugin is network-activated and not in the network admin, return the notices whose scope is site.
851 + if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK && ! is_network_admin() ) {
852 + $notices = array_filter(
853 + $notices,
854 + function ( $notice ) {
855 + return isset( $notice['scope'] ) && 'site' === $notice['scope'];
856 + }
857 + );
858 + }
859 +
860 + return $notices;
843 861 }
844 862
845 863 /**
846 864 * Dismiss a notice given a notice key.
@@ -882,14 +900,21 @@
882 900 */
883 901 protected function check_field_count() {
884 902 $post_indexable = Indexables::factory()->get( 'post' );
885 903
886 - $indexable_fields = $post_indexable->get_predicted_indexable_meta_keys();
887 - $count_fields_db = count( $indexable_fields );
904 + $search = Features::factory()->get_registered_feature( 'search' );
905 + if ( $search && ! empty( $search->weighting ) && 'manual' === $search->weighting->get_meta_mode() ) {
906 + $indexable_fields = $post_indexable->get_all_allowed_metas_manual();
907 + $count_fields_db = count( $indexable_fields );
908 + } else {
909 + $indexable_fields = $post_indexable->get_predicted_indexable_meta_keys();
910 + $count_fields_db = count( $indexable_fields );
911 + }
888 912
889 913 $index_name = $post_indexable->get_index_name();
890 914 $es_field_limit = Elasticsearch::factory()->get_index_total_fields_limit( $index_name );
891 - $es_field_limit = $es_field_limit ?? apply_filters( 'ep_total_field_limit', 5000 );
915 + $es_field_limit = $es_field_limit ? $es_field_limit : 5000;
916 + $es_field_limit = apply_filters( 'ep_total_field_limit', $es_field_limit );
892 917
893 918 $predicted_es_field_count = $count_fields_db * 8;
894 919
895 920 return [