PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / 1.1
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel v1.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 / includes / Opcache.php

Opcache.php in FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel 1.1, at includes/Opcache.php

71 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace FlyWP;
4
5 class Opcache {
6
7 /**
8 * Opcache constructor.
9 */
10 public function clear() {
11 return opcache_reset();
12 }
13
14 /**
15 * Check if opcache is available.
16 *
17 * @return bool
18 */
19 public function has_opcache() {
20 return function_exists( 'opcache_get_status' );
21 }
22
23 /**
24 * Get opcache status.
25 *
26 * @return array
27 */
28 public function get_status() {
29 return opcache_get_status();
30 }
31
32 /**
33 * Get opcache config.
34 *
35 * @return array
36 */
37 public function get_config() {
38 return opcache_get_configuration();
39 }
40
41 /**
42 * Check if opcache is enabled.
43 *
44 * @return bool
45 */
46 public function enabled() {
47 if ( !$this->has_opcache() ) {
48 return false;
49 }
50
51 $status = $this->get_status();
52
53 return isset( $status['opcache_enabled'] ) && $status['opcache_enabled'] === true;
54 }
55
56 /**
57 * Get OPcache purge URL.
58 *
59 * @return string
60 */
61 public function purge_cache_url() {
62 return wp_nonce_url(
63 add_query_arg(
64 ['flywp-action' => 'purge-opcache'],
65 admin_url( 'index.php?page=flywp' ),
66 ),
67 'fly-opcache-purge'
68 );
69 }
70 }
71