PluginProbe
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution / 1.1.0
Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution v1.1.0
2.0.1 trunk 1.0.0 1.1.0 1.2.0 1.3.0 1.3.1 1.3.2 1.3.3 1.4.0 1.4.1 1.4.2 1.5.0 1.6.0 1.6.1 1.7.0 1.7.1 1.8.0 1.9.0 2.0.0
solid-performance / src / Performance / Telemetry / Health_Data.php

Health_Data.php in Solid Performance – Your No-Code Caching, Performance, & Page Speed Solution 1.1.0, at src/Performance/Telemetry/Health_Data.php

72 lines 2.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 /**
3 * Handles adding a new section to the site health data screen.
4 *
5 * @since 0.1.0
6 *
7 * @package SolidWP\Performance
8 */
9
10 namespace SolidWP\Performance\Telemetry;
11
12 /**
13 * Handles adding a new section to the site health data screen.
14 *
15 * @since 0.1.0
16 *
17 * @package SolidWP\Performance
18 */
19 class Health_Data {
20
21 /**
22 * Adds a new Solid Performance section to site health data.
23 *
24 * @since 0.1.0
25 *
26 * @filter debug_information
27 *
28 * @param array $info The array of site health data.
29 *
30 * @return array
31 */
32 public function add_summary_to_telemetry( array $info ): array {
33 $page_cache = swpsp_config_get( 'page_cache' );
34 $page_cache_status = $page_cache['enabled'] ? esc_html__( 'Enabled', 'solid-performance' ) : esc_html__( 'Disabled', 'solid-performance' );
35 $cache_dir_writeable = swpsp_direct_filesystem()->is_writable( $page_cache['cache_dir'] ) ? esc_html__( 'Writable', 'solid-performance' ) : esc_html__( 'Not Writable', 'solid-performance' );
36 $debug_mode_status = $page_cache['debug'] ? esc_html__( 'Enabled', 'solid-performance' ) : esc_html__( 'Disabled', 'solid-performance' );
37 $exclusion_count = count( $page_cache['exclusions'] );
38
39 $info['solid-performance'] = [
40 'label' => esc_html__( 'Solid Performance', 'solid-performance' ),
41 'fields' => [
42 'page_cache_status' => [
43 'label' => esc_html__( 'Page Cache', 'solid-performance' ),
44 'value' => $page_cache_status,
45 'debug' => strtolower( $page_cache_status ),
46 ],
47 'cache_directory' => [
48 'label' => esc_html__( 'Cache Directory', 'solid-performance' ),
49 'value' => $page_cache['cache_dir'],
50 'debug' => $page_cache['cache_dir'],
51 ],
52 'cache_directory_writable' => [
53 'label' => esc_html__( 'Cache Directory Permissions', 'solid-performance' ),
54 'value' => $cache_dir_writeable,
55 'debug' => strtolower( $cache_dir_writeable ),
56 ],
57 'debug_mode' => [
58 'label' => esc_html__( 'Debug Mode', 'solid-performance' ),
59 'value' => $debug_mode_status,
60 'debug' => strtolower( $debug_mode_status ),
61 ],
62 'exclusion_count' => [
63 'label' => esc_html__( 'Number of custom exclusions', 'solid-performance' ),
64 'value' => $exclusion_count,
65 ],
66 ],
67 ];
68
69 return $info;
70 }
71 }
72