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/Indexable/Comment/QueryIntegration.php +21 -8 4.4.15.3.5 View file →
@@ -7,11 +7,11 @@
7 7 */
8 8
9 9 namespace ElasticPress\Indexable\Comment;
10 10
11 -use ElasticPress\Indexables as Indexables;
12 -use \WP_Comment_Query as WP_Comment_Query;
13 -use ElasticPress\Utils as Utils;
11 +use WP_Comment_Query;
12 +use ElasticPress\Indexables;
13 +use ElasticPress\Utils;
14 14
15 15 if ( ! defined( 'ABSPATH' ) ) {
16 16 exit; // Exit if accessed directly.
17 17 }
@@ -37,13 +37,27 @@
37 37
38 38 /**
39 39 * Sets up the appropriate actions and filters.
40 40 *
41 + * @param string $indexable_slug Indexable slug. Optional.
42 + *
41 43 * @since 3.6.0
42 44 */
43 - public function __construct() {
45 + public function __construct( $indexable_slug = 'comment' ) {
46 + /**
47 + * Filter whether to enable query integration during indexing
48 + *
49 + * @since 4.5.2
50 + * @hook ep_enable_query_integration_during_indexing
51 + *
52 + * @param {bool} $enable To allow query integration during indexing
53 + * @param {string} $indexable_slug Indexable slug
54 + * @return {bool} New value
55 + */
56 + $allow_query_integration_during_indexing = apply_filters( 'ep_enable_query_integration_during_indexing', false, $indexable_slug );
57 +
44 58 // Check if we are currently indexing
45 - if ( Utils\is_indexing() ) {
59 + if ( Utils\is_indexing() && ! $allow_query_integration_during_indexing ) {
46 60 return;
47 61 }
48 62
49 63 // Add header
@@ -167,9 +181,9 @@
167 181
168 182 $this->index = implode( ',', $this->index );
169 183 } elseif ( ! empty( $site__not_in ) ) {
170 184
171 - $sites = get_sites(
185 + $sites = \get_sites(
172 186 array(
173 187 'fields' => 'ids',
174 188 'site__not_in' => $site__not_in,
175 189 )
@@ -316,9 +330,9 @@
316 330 $child_comments[] = $level_comment;
317 331 }
318 332 }
319 333
320 - $level ++;
334 + ++$level;
321 335 $levels[ $level ] = $child_comments;
322 336 } while ( $child_comments );
323 337
324 338 // Pull out just the descendant comments
@@ -357,6 +371,5 @@
357 371 }
358 372
359 373 return $comments;
360 374 }
361 -
362 375 }