PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / 1.5.1
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel v1.5.1
1.7.1 1.7.0 1.6.0 1.5.2 trunk 0.1 0.2.0 0.2.1 0.3 0.3.1 0.3.2 0.3.3 0.3.4 0.4 0.4.1 0.4.2 0.4.3 1.0 1.1 1.2 1.3.1 1.4.0 1.4.1 1.5.0 1.5.1 All 26 releases
flywp / views / op-cache.php

op-cache.php in FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel 1.5.1, at views/op-cache.php

85 lines 4.6 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 $notice = '';
4 $status = flywp()->opcache->get_status();
5 $config = flywp()->opcache->get_config();
6
7 $cache_messages = [
8 'opcache-purged' => __( 'PHP OPcache has been cleared.', 'flywp' ),
9 ];
10
11 if ( isset( $_GET['fly-notice'] ) && isset( $cache_messages[ $_GET['fly-notice'] ] ) ) {
12 $notice = $cache_messages[ $_GET['fly-notice'] ];
13 }
14 ?>
15
16 <div class="fw-bg-white fw-shadow fw-rounded fw-sm:rounded-lg fw-mb-4">
17 <div class="">
18 <div class="fw-flex fw-px-4 fw-py-4 fw-fw-sm:p-6 fw-items-center fw-justify-between fw-border-b fw-border-gray-200">
19 <h3 class="fw-text-lg fw-font-semibold fw-leading-6 fw-text-gray-900 fw-m-0">
20 <?php esc_html_e( 'PHP OPcache', 'flywp' ); ?>
21 </h3>
22
23 <?php if ( flywp()->opcache->enabled() ) { ?>
24 <div class="fw-text-green-600">
25 <span class="dashicons dashicons-yes-alt"></span>
26 <?php esc_html_e( 'Enabled', 'flywp' ); ?>
27 </div>
28 <?php } else { ?>
29
30 <div class="fw-text-gray-400">
31 <span class="dashicons dashicons-no-alt"></span>
32 <?php esc_html_e( 'Disabled', 'flywp' ); ?>
33 </div>
34 <?php } ?>
35 </div>
36
37 <?php if ( $notice ) { ?>
38 <div class="fw-bg-green-200 fw-text-green-800 fw-px-4 fw-py-1 fly-form-notice">
39 <p><?php echo esc_html( $notice ); ?></p>
40 </div>
41 <?php } ?>
42
43 <div class="fw-mt-2 fw-px-4 fw-py-4 fw-fw-sm:p-6 fw-text-sm fw-text-gray-500">
44 <p class="fw-mt-0 fw-text-sm"><?php esc_html_e( 'OPcache improves PHP performance by storing precompiled script bytecode in shared memory, thereby removing the need for PHP to load and parse scripts on each request.', 'flywp' ); ?></p>
45
46 <?php if ( flywp()->opcache->enabled() ) { ?>
47 <div class="md:fw-flex fw-w-full fw-mb-4 fw-gap-3 fw-items-center">
48 <div class="sm:fw-w-2/3 fw-mb-6 sm:fw-mb-0">
49 <dl class="fw-m-0 fw-mt-2">
50 <div class="fw-flex fw-justify-between sm:fw-justify-normal">
51 <dt class="fw-font-medium fw-text-gray-900 sm:fw-w-32 sm:fw-flex-none sm:fw-pr-6"><?php esc_html_e( 'Hit Rate', 'flywp' ); ?></dt>
52 <dd><?php echo number_format( $status['opcache_statistics']['opcache_hit_rate'], 2 ) . '%'; ?></dd>
53 </div>
54
55 <div class="fw-flex fw-justify-between sm:fw-justify-normal">
56 <dt class="fw-font-medium fw-text-gray-900 sm:fw-w-32 sm:fw-pr-6"><?php esc_html_e( 'Cached Scripts', 'flywp' ); ?></dt>
57 <dd><?php echo $status['opcache_statistics']['num_cached_scripts']; ?></dd>
58 </div>
59
60 <div class="fw-flex fw-justify-between sm:fw-justify-normal">
61 <dt class="fw-font-medium fw-text-gray-900 sm:fw-w-32 sm:fw-pr-6"><?php esc_html_e( 'Memory', 'flywp' ); ?></dt>
62 <dd><?php echo sprintf( '%s of %s', size_format( $status['memory_usage']['used_memory'] ), size_format( $config['directives']['opcache.memory_consumption'] ) ); ?></dd>
63 </div>
64
65 <div class="fw-flex fw-justify-between sm:fw-justify-normal">
66 <dt class="fw-font-medium fw-text-gray-900 sm:fw-w-32 sm:fw-pr-6"><?php esc_html_e( 'Keys', 'flywp' ); ?></dt>
67 <dd><?php echo sprintf( '%d of %d', $status['opcache_statistics']['num_cached_keys'], $status['opcache_statistics']['max_cached_keys'] ); ?></dd>
68 </div>
69
70 <div class="fw-flex fw-justify-between sm:fw-justify-normal">
71 <dt class="fw-font-medium fw-text-gray-900 sm:fw-w-32 sm:fw-pr-6"><?php esc_html_e( 'Engine', 'flywp' ); ?></dt>
72 <dd><?php echo sprintf( '%s (%s)', $config['version']['opcache_product_name'], $config['version']['version'] ); ?></dd>
73 </div>
74 </dl>
75 </div>
76
77 <div class="sm:fw-w-1/3 fw-text-center sm:fw-text-right">
78 <a href="<?php echo esc_url( flywp()->opcache->purge_cache_url() ); ?>" class="button button-primary button-hero !fw-bg-indigo-600 hover:!fw-bg-indigo-700"><?php esc_html_e( 'Clear Cache', 'flywp' ); ?></a>
79 </div>
80 </div>
81 <?php } ?>
82 </div>
83 </div>
84 </div>
85