From 431ec02cb8f6c365787758e722217fd0bd438a40 Mon Sep 17 00:00:00 2001 From: David <75451291+dulkoss@users.noreply.github.com> Date: Mon, 16 Oct 2023 11:13:49 +0200 Subject: [PATCH] add OpCacheCheck --- src/Checks/OpCacheCheck.php | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 src/Checks/OpCacheCheck.php diff --git a/src/Checks/OpCacheCheck.php b/src/Checks/OpCacheCheck.php new file mode 100644 index 0000000..32ef75b --- /dev/null +++ b/src/Checks/OpCacheCheck.php @@ -0,0 +1,31 @@ +opCacheIsRunning()) { + return $result->failed('OpCache is not running.'); + } + + return $result->ok('OpCache is running.'); + } + + protected function opCacheIsRunning(): bool + { + if (! function_exists('opcache_get_status')) { + return false; + } + + $configuration = opcache_get_status(); + + return $configuration['opcache_enabled'] ?? false; + } +}