From fa60910c57e535d60da8dd100377d5f4c7451be2 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Wed, 10 May 2023 09:59:38 +0200 Subject: [PATCH] use define php min --- _define.php | 5 ++++- src/Backend.php | 3 +-- src/Config.php | 3 +-- src/Frontend.php | 2 +- src/Install.php | 2 +- src/Manage.php | 1 - src/ManageFeed.php | 1 - src/My.php | 11 ----------- src/Prepend.php | 2 +- src/Uninstall.php | 2 +- 10 files changed, 10 insertions(+), 22 deletions(-) diff --git a/_define.php b/_define.php index d26385f..bc2c181 100644 --- a/_define.php +++ b/_define.php @@ -20,7 +20,10 @@ $this->registerModule( 'Jean-Christian Denis, BG, Pierre Van Glabeke', '2023.05.08', [ - '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 a8fd0a2..3c6565f 100644 --- a/src/Backend.php +++ b/src/Backend.php @@ -27,8 +27,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/Config.php b/src/Config.php index 16e0e8f..5b42cb1 100644 --- a/src/Config.php +++ b/src/Config.php @@ -39,8 +39,7 @@ class Config 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/Frontend.php b/src/Frontend.php index 06632e4..d38ea74 100644 --- a/src/Frontend.php +++ b/src/Frontend.php @@ -28,7 +28,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 a0713c3..10a4cad 100644 --- a/src/Install.php +++ b/src/Install.php @@ -26,7 +26,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 44f5110..840a913 100644 --- a/src/Manage.php +++ b/src/Manage.php @@ -39,7 +39,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([ diff --git a/src/ManageFeed.php b/src/ManageFeed.php index 087a593..578457f 100644 --- a/src/ManageFeed.php +++ b/src/ManageFeed.php @@ -42,7 +42,6 @@ class ManageFeed 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 5806308..8f3d876 100644 --- a/src/My.php +++ b/src/My.php @@ -55,9 +55,6 @@ class My 'FeedFeedURL', ]; - /** @var string This module required php version */ - public const PHP_MIN = '8.1'; - /** * This module id. */ @@ -83,12 +80,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 fad397d..db1bd9e 100644 --- a/src/Prepend.php +++ b/src/Prepend.php @@ -24,7 +24,7 @@ class Prepend extends dcNsProcess { public static function init(): bool { - static::$init = My::phpCompliant(); + static::$init = defined('DC_RC_PATH'); return static::$init; } diff --git a/src/Uninstall.php b/src/Uninstall.php index 6333081..cd2247a 100644 --- a/src/Uninstall.php +++ b/src/Uninstall.php @@ -54,7 +54,7 @@ class Uninstall extends dcNsProcess ->addUserAction( 'tables', 'delete', - My::TABLE_NAME + My::TABLE_NAME, ) ->addUserAction( 'plugins',