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