PluginProbe
ElasticPress / 4.6.1
ElasticPress v4.6.1
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
elasticpress / includes / classes / StatusReport / ElasticPress.php

ElasticPress.php in ElasticPress 4.6.1, at includes/classes/StatusReport/ElasticPress.php

126 lines 2.8 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * ElasticPress report class
4 *
5 * @since 4.4.0
6 * @package elasticpress
7 */
8
9 namespace ElasticPress\StatusReport;
10
11 use ElasticPress\Utils;
12
13 defined( 'ABSPATH' ) || exit;
14
15 /**
16 * ElasticPress report class
17 *
18 * @package ElasticPress
19 */
20 class ElasticPress extends Report {
21
22 /**
23 * Return the report title
24 *
25 * @return string
26 */
27 public function get_title() : string {
28 return __( 'ElasticPress', 'elasticpress' );
29 }
30
31 /**
32 * Return the report fields
33 *
34 * @return array
35 */
36 public function get_groups() : array {
37 return [
38 $this->get_basic_settings(),
39 $this->get_timeouts(),
40 ];
41 }
42
43 /**
44 * Process ElasticPress's basic settings.
45 *
46 * @return array
47 */
48 protected function get_basic_settings() : array {
49 $is_epio = Utils\is_epio();
50
51 $fields = [];
52
53 $fields['host'] = [
54 'label' => $is_epio ? __( 'ElasticPress.io Host URL', 'elasticpress' ) : __( 'Elasticsearch Host URL', 'elasticpress' ),
55 'value' => Utils\get_host(),
56 ];
57
58 $fields['index_prefix'] = [
59 'label' => __( 'Index Prefix', 'elasticpress' ),
60 'value' => Utils\get_index_prefix(),
61 ];
62
63 $fields['language'] = [
64 'label' => __( 'Elasticsearch Language', 'elasticpress' ),
65 'value' => Utils\get_language(),
66 ];
67
68 $fields['per_page'] = [
69 'label' => __( 'Content Items per Index Cycle', 'elasticpress' ),
70 'value' => \ElasticPress\IndexHelper::factory()->get_index_default_per_page(),
71 ];
72
73 $fields['network_active'] = [
74 'label' => __( 'Network Active', 'elasticpress' ),
75 'value' => is_multisite() && defined( 'EP_IS_NETWORK' ) && EP_IS_NETWORK,
76 ];
77
78 return [
79 'title' => __( 'Settings', 'elasticpress' ),
80 'fields' => $fields,
81 ];
82 }
83
84 /**
85 * Process ElasticPress timeouts.
86 *
87 * @return array
88 */
89 protected function get_timeouts() {
90 $default_request_timeout = 5;
91 $fields['request_timeout'] = [
92 'label' => sprintf(
93 /* translators: default time */
94 __( 'Default Requests Timeout (default: %s)', 'elasticpress' ),
95 $default_request_timeout
96 ),
97 'value' => apply_filters( 'http_request_timeout', $default_request_timeout, Utils\get_host() ),
98 ];
99
100 $default_index_document_timeout = 15;
101 $fields['index_document_timeout'] = [
102 'label' => sprintf(
103 /* translators: default time */
104 __( 'Index Document Request Timeout (default: %s)', 'elasticpress' ),
105 $default_index_document_timeout
106 ),
107 'value' => apply_filters( 'ep_index_document_timeout', $default_index_document_timeout ),
108 ];
109
110 $default_bulk_request_timeout = 30;
111 $fields['bulk_request_timeout'] = [
112 'label' => sprintf(
113 /* translators: default time */
114 __( 'Default Requests Timeout (default: %s)', 'elasticpress' ),
115 $default_bulk_request_timeout
116 ),
117 'value' => apply_filters( 'bulk_request_timeout', $default_bulk_request_timeout ),
118 ];
119
120 return [
121 'title' => __( 'Timeouts', 'elasticpress' ),
122 'fields' => $fields,
123 ];
124 }
125 }
126