From fb47a0dee28ca42c0e51be8d4643968e62c5d833 Mon Sep 17 00:00:00 2001 From: liugang Date: Tue, 4 Jun 2024 14:06:19 +0800 Subject: [PATCH] * admin: calling method to check if apcu is enabled. --- module/admin/control.php | 4 ++-- module/admin/ui/cache.html.php | 2 +- module/admin/zen.php | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/module/admin/control.php b/module/admin/control.php index 650c2469d0..e9cd6b5125 100755 --- a/module/admin/control.php +++ b/module/admin/control.php @@ -588,7 +588,7 @@ class admin extends control { if($_POST) { - if(!extension_loaded('apcu')) return $this->send(array('result' => 'fail', 'message' => $this->lang->admin->apcuNotFound)); + if(!helper::isAPCuEnabled()) return $this->send(array('result' => 'fail', 'message' => $this->lang->admin->apcuNotFound)); $cache = form::data()->get(); $this->loadModel('setting')->setItem('system.common.global.cache', json_encode($cache)); @@ -598,7 +598,7 @@ class admin extends control return $this->send(array('result' => 'success', 'message' => $this->lang->saveSuccess, 'load' => true)); } - if(extension_loaded('apcu')) + if(helper::isAPCuEnabled()) { $this->view->rate = $this->adminZen->getAPCuMemory('rate'); $this->view->used = $this->adminZen->getAPCuMemory('used'); diff --git a/module/admin/ui/cache.html.php b/module/admin/ui/cache.html.php index 07c3043ba4..5bfb36c649 100644 --- a/module/admin/ui/cache.html.php +++ b/module/admin/ui/cache.html.php @@ -23,7 +23,7 @@ formPanel set::inline(true) ) ), - extension_loaded('apcu') ? formRow + helper::isAPCuEnabled() ? formRow ( formGroup ( diff --git a/module/admin/zen.php b/module/admin/zen.php index 9c3715cd31..4132b07d97 100644 --- a/module/admin/zen.php +++ b/module/admin/zen.php @@ -313,7 +313,7 @@ class adminZen extends admin */ public function getAPCuMemory(string $type = 'total'): string|float { - if(!extension_loaded('apcu')) return ''; + if(!helper::isAPCuEnabled()) return ''; $info = apcu_sma_info(true);