← All changes
|
includes/classes/StatusReport/IndexableContent.php
+10
-12
4.5.2
→
5.3.5
View file →
| @@ -16,9 +16,9 @@ | ||
| 16 | 16 | * IndexableContent report class |
| 17 | 17 | * |
| 18 | 18 | * @package ElasticPress |
| 19 | 19 | */ |
| 20 | -class IndexableContent extends Report { | |
| 20 | +class IndexableContent extends AjaxReport { | |
| 21 | 21 | |
| 22 | 22 | /** |
| 23 | 23 | * Return the report title |
| 24 | 24 | * |
| @@ -23,9 +23,9 @@ | ||
| 23 | 23 | * Return the report title |
| 24 | 24 | * |
| 25 | 25 | * @return string |
| 26 | 26 | */ |
| 27 | - public function get_title() : string { | |
| 27 | + public function get_title(): string { | |
| 28 | 28 | return __( 'Indexable Content', 'elasticpress' ); |
| 29 | 29 | } |
| 30 | 30 | |
| 31 | 31 | /** |
| @@ -32,9 +32,9 @@ | ||
| 32 | 32 | * Return the report fields |
| 33 | 33 | * |
| 34 | 34 | * @return array |
| 35 | 35 | */ |
| 36 | - public function get_groups() : array { | |
| 36 | + public function get_groups_ajax(): array { | |
| 37 | 37 | return $this->get_indexable_content_groups(); |
| 38 | 38 | } |
| 39 | 39 | |
| 40 | 40 | /** |
| @@ -41,18 +41,14 @@ | ||
| 41 | 41 | * Process the indexable content for all sites. |
| 42 | 42 | * |
| 43 | 43 | * @return array |
| 44 | 44 | */ |
| 45 | - protected function get_indexable_content_groups() : array { | |
| 45 | + protected function get_indexable_content_groups(): array { | |
| 46 | 46 | $groups = []; |
| 47 | 47 | |
| 48 | 48 | if ( defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK ) { |
| 49 | - $sites = Utils\get_sites(); | |
| 49 | + $sites = Utils\get_sites( 0, true ); | |
| 50 | 50 | foreach ( $sites as $site ) { |
| 51 | - if ( ! Utils\is_site_indexable( $site['blog_id'] ) ) { | |
| 52 | - continue; | |
| 53 | - } | |
| 54 | - | |
| 55 | 51 | switch_to_blog( $site['blog_id'] ); |
| 56 | 52 | |
| 57 | 53 | $groups[] = $this->get_indexable_content_group(); |
| 58 | 54 | |
| @@ -69,9 +65,9 @@ | ||
| 69 | 65 | * Process the indexable content. |
| 70 | 66 | * |
| 71 | 67 | * @return array |
| 72 | 68 | */ |
| 73 | - protected function get_indexable_content_group() : array { | |
| 69 | + protected function get_indexable_content_group(): array { | |
| 74 | 70 | $post_counts = $this->get_post_count_group(); |
| 75 | 71 | $meta_counts = $this->get_post_meta_fields(); |
| 76 | 72 | |
| 77 | 73 | $fields = array_merge( $post_counts, $meta_counts ); |
| @@ -91,13 +87,14 @@ | ||
| 91 | 87 | * Process the count of all indexable post types and status |
| 92 | 88 | * |
| 93 | 89 | * @return array |
| 94 | 90 | */ |
| 95 | - protected function get_post_count_group() : array { | |
| 91 | + protected function get_post_count_group(): array { | |
| 96 | 92 | $post_indexable = \ElasticPress\Indexables::factory()->get( 'post' ); |
| 97 | 93 | $post_types = $post_indexable->get_indexable_post_types(); |
| 98 | 94 | |
| 99 | 95 | $post_stati = $post_indexable->get_indexable_post_status(); |
| 96 | + $fields = []; | |
| 100 | 97 | |
| 101 | 98 | foreach ( $post_types as $post_type ) { |
| 102 | 99 | $post_type_obj = get_post_type_object( $post_type ); |
| 103 | 100 | $post_type_label = $post_type_obj ? $post_type_obj->labels->name : $post_type; |
| @@ -128,9 +125,9 @@ | ||
| 128 | 125 | * Process the count of meta keys. |
| 129 | 126 | * |
| 130 | 127 | * @return array |
| 131 | 128 | */ |
| 132 | - protected function get_post_meta_fields() : array { | |
| 129 | + protected function get_post_meta_fields(): array { | |
| 133 | 130 | $post_indexable = \ElasticPress\Indexables::factory()->get( 'post' ); |
| 134 | 131 | $post_types = $post_indexable->get_indexable_post_types(); |
| 135 | 132 | |
| 136 | 133 | $force_refresh = ! empty( $_GET['force_refresh'] ); // phpcs:ignore WordPress.Security.NonceVerification |
| @@ -137,8 +134,9 @@ | ||
| 137 | 134 | |
| 138 | 135 | $fields = []; |
| 139 | 136 | $all_keys = []; |
| 140 | 137 | $post_count_limit = 88000; |
| 138 | + $limited = false; | |
| 141 | 139 | |
| 142 | 140 | foreach ( $post_types as $post_type ) { |
| 143 | 141 | $post_type_obj = get_post_type_object( $post_type ); |
| 144 | 142 | |