From 869486f9e6c5ccbca91ce70705a157c11f299879 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Wed, 10 May 2023 11:05:11 +0200 Subject: [PATCH] use define php min --- _define.php | 5 ++++- src/Backend.php | 1 - src/Frontend.php | 2 +- src/Install.php | 1 - src/Manage.php | 1 - src/My.php | 11 ----------- src/Prepend.php | 2 +- 7 files changed, 6 insertions(+), 17 deletions(-) diff --git a/_define.php b/_define.php index 18fb83f..235aba3 100644 --- a/_define.php +++ b/_define.php @@ -20,7 +20,10 @@ $this->registerModule( 'Jean-Christian Denis and contributors', '1.0', [ - 'requires' => [['core', '2.26']], + 'requires' => [ + ['php', '8.1'], + ['core', '2.26'], + ], 'permissions' => dcCore::app()->auth->makePermissions([ dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, ]), diff --git a/src/Backend.php b/src/Backend.php index c789dda..189749d 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -25,7 +25,6 @@ class Backend extends dcNsProcess public static function init(): bool { static::$init = defined('DC_CONTEXT_ADMIN') - && My::phpCompliant() && !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog) && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, diff --git a/src/Frontend.php b/src/Frontend.php index 1079913..ffd6ef4 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -22,7 +22,7 @@ class Frontend extends dcNsProcess { public static function init(): bool { - static::$init = My::phpCompliant(); + static::$init = defined('DC_RC_PATH'); return static::$init; } diff --git a/src/Install.php b/src/Install.php index 4d6468e..001fcb5 100644 --- a/src/Install.php +++ b/src/Install.php @@ -23,7 +23,6 @@ class Install extends dcNsProcess public static function init(): bool { static::$init = defined('DC_CONTEXT_ADMIN') - && My::phpCompliant() && is_string(dcCore::app()->plugins->moduleInfo(My::id(), 'version')) && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version')); diff --git a/src/Manage.php b/src/Manage.php index 8246c13..67e393e 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -35,7 +35,6 @@ class Manage extends dcNsProcess public static function init(): bool { static::$init = defined('DC_CONTEXT_ADMIN') - && My::phpCompliant() && !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog) && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, diff --git a/src/My.php b/src/My.php index eed0871..f84b288 100644 --- a/src/My.php +++ b/src/My.php @@ -24,9 +24,6 @@ class My /** @var string Default image name */ public const IMAGE = 'default-avatar.png'; - /** @var string This module required php version */ - public const PHP_MIN = '8.1'; - /** * This module id. */ @@ -52,12 +49,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 c1f12c6..de0b3c3 100644 --- a/src/Prepend.php +++ b/src/Prepend.php @@ -21,7 +21,7 @@ class Prepend extends dcNsProcess { public static function init(): bool { - static::$init = My::phpCompliant(); + static::$init = defined('DC_RC_PATH'); return static::$init; }