From 2cfff229a2ecfb9e8ea386dd9f14c03dcff2d6b6 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Wed, 10 May 2023 09:53:09 +0200 Subject: [PATCH] use define php min --- _define.php | 5 ++++- src/Backend.php | 3 +-- src/Install.php | 2 +- src/Manage.php | 3 +-- src/My.php | 11 ----------- src/Prepend.php | 1 - 6 files changed, 7 insertions(+), 18 deletions(-) diff --git a/_define.php b/_define.php index f020dbd..caa7e27 100644 --- a/_define.php +++ b/_define.php @@ -20,7 +20,10 @@ $this->registerModule( 'Jean-Christian Denis and Contributors', '0.9.1', [ - 'requires' => [['core', '2.26']], + 'requires' => [ + ['php', '8.1'], + ['core', '2.26'], + ], 'permissions' => null, 'type' => 'plugin', 'settings' => [ diff --git a/src/Backend.php b/src/Backend.php index 8a2eafa..5dc4fc2 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -26,8 +26,7 @@ class Backend extends dcNsProcess { public static function init(): bool { - static::$init = defined('DC_CONTEXT_ADMIN') - && My::phpCompliant(); + static::$init = defined('DC_CONTEXT_ADMIN'); return static::$init; } diff --git a/src/Install.php b/src/Install.php index 0adca1b..1d219e4 100644 --- a/src/Install.php +++ b/src/Install.php @@ -22,7 +22,7 @@ class Install extends dcNsProcess { public static function init(): bool { - if (defined('DC_CONTEXT_ADMIN') && My::phpCompliant()) { + if (defined('DC_CONTEXT_ADMIN')) { $version = dcCore::app()->plugins->moduleInfo(My::id(), 'version'); static::$init = is_string($version) ? dcCore::app()->newVersion(My::id(), $version) : true; } diff --git a/src/Manage.php b/src/Manage.php index 1bf043c..4733e0f 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -37,8 +37,7 @@ class Manage extends dcNsProcess public static function init(): bool { static::$init = defined('DC_CONTEXT_ADMIN') - && dcCore::app()->auth?->isSuperAdmin() - && My::phpCompliant(); + && dcCore::app()->auth?->isSuperAdmin(); return static::$init; } diff --git a/src/My.php b/src/My.php index 935107d..983d502 100644 --- a/src/My.php +++ b/src/My.php @@ -21,9 +21,6 @@ use dcCore; */ class My { - /** @var string This module required php version */ - public const PHP_MIN = '8.1'; - /** * This module id. */ @@ -49,12 +46,4 @@ class My { return dirname(__DIR__); } - - /** - * Check this module PHP version compliant. - */ - public static function phpCompliant(): bool - { - return version_compare(phpversion(), self::PHP_MIN, '>='); - } } diff --git a/src/Prepend.php b/src/Prepend.php index 51abc0f..2b691e6 100644 --- a/src/Prepend.php +++ b/src/Prepend.php @@ -22,7 +22,6 @@ class Prepend extends dcNsProcess public static function init(): bool { static::$init = defined('DC_CONTEXT_ADMIN') - && My::phpCompliant() && dcCore::app()->auth?->isSuperAdmin(); return static::$init;