From cb52f33cd143f03556ce97a21ec0279e93743a99 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sun, 19 Mar 2023 22:50:56 +0100 Subject: [PATCH] add php min --- src/Backend.php | 4 +++- src/Manage.php | 4 +++- src/My.php | 16 ++++++++++++++++ 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/src/Backend.php b/src/Backend.php index ada2845..bedd1e1 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -28,7 +28,9 @@ class Backend extends dcNsProcess { public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN'); + static::$init = defined('DC_CONTEXT_ADMIN') + && dcCore::app()->auth?->isSuperAdmin() + && My::phpCompliant(); return static::$init; } diff --git a/src/Manage.php b/src/Manage.php index ea6addc..2367e70 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -29,7 +29,9 @@ class Manage extends dcNsProcess { public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->auth->isSuperAdmin(); + static::$init = defined('DC_CONTEXT_ADMIN') + && dcCore::app()->auth?->isSuperAdmin() + && My::phpCompliant(); return static::$init; } diff --git a/src/My.php b/src/My.php index fb4b656..72e6510 100644 --- a/src/My.php +++ b/src/My.php @@ -18,6 +18,14 @@ use dcCore; class My { + /** + * @var string PHP min version + */ + public const PHP_MIN = '8.1'; + + /** + * @var string Admin list ID + */ public const BACKEND_LIST_ID = 'dcloglist'; /** @@ -35,4 +43,12 @@ class My { return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name')); } + + /** + * Check php version + */ + public static function phpCompliant(): bool + { + return version_compare(phpversion(), self::PHP_MIN, '>='); + } }