PluginProbe
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel / trunk
FlyWP Helper – Page Cache, Page Optimization, Emails for FlyWP Server Control Panel vtrunk
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
← All changes | includes/Opcache.php +30 -2 0.3trunk View file →
@@ -3,24 +3,47 @@
3 3 namespace FlyWP;
4 4
5 5 class Opcache {
6 6
7 + /**
8 + * Opcache constructor.
9 + */
7 10 public function clear() {
8 11 return opcache_reset();
9 12 }
10 13
14 + /**
15 + * Check if opcache is available.
16 + *
17 + * @return bool
18 + */
11 19 public function has_opcache() {
12 20 return function_exists( 'opcache_get_status' );
13 21 }
14 22
23 + /**
24 + * Get opcache status.
25 + *
26 + * @return array
27 + */
15 28 public function get_status() {
16 29 return opcache_get_status();
17 30 }
18 31
32 + /**
33 + * Get opcache config.
34 + *
35 + * @return array
36 + */
19 37 public function get_config() {
20 38 return opcache_get_configuration();
21 39 }
22 40
41 + /**
42 + * Check if opcache is enabled.
43 + *
44 + * @return bool
45 + */
23 46 public function enabled() {
24 47 if ( ! $this->has_opcache() ) {
25 48 return false;
26 49 }
@@ -26,16 +49,21 @@
26 49 }
27 50
28 51 $status = $this->get_status();
29 52
30 - return $status['opcache_enabled'] === true;
53 + return isset( $status['opcache_enabled'] ) && $status['opcache_enabled'] === true;
31 54 }
32 55
56 + /**
57 + * Get OPcache purge URL.
58 + *
59 + * @return string
60 + */
33 61 public function purge_cache_url() {
34 62 return wp_nonce_url(
35 63 add_query_arg(
36 64 [ 'flywp-action' => 'purge-opcache' ],
37 - flywp()->admin->page_url()
65 + admin_url( 'index.php?page=flywp' ),
38 66 ),
39 67 'fly-opcache-purge'
40 68 );
41 69 }