use define php min

This commit is contained in:
Jean-Christian Denis 2023-05-10 09:59:38 +02:00
parent 5afc035872
commit fa60910c57
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951
10 changed files with 10 additions and 22 deletions

View file

@ -20,7 +20,10 @@ $this->registerModule(
'Jean-Christian Denis, BG, Pierre Van Glabeke', 'Jean-Christian Denis, BG, Pierre Van Glabeke',
'2023.05.08', '2023.05.08',
[ [
'requires' => [['core', '2.26']], 'requires' => [
['php', '8.1'],
['core', '2.26'],
],
'permissions' => dcCore::app()->auth->makePermissions([ 'permissions' => dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,
]), ]),

View file

@ -27,8 +27,7 @@ class Backend extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = defined('DC_CONTEXT_ADMIN') static::$init = defined('DC_CONTEXT_ADMIN');
&& My::phpCompliant();
return static::$init; return static::$init;
} }

View file

@ -39,8 +39,7 @@ class Config extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
static::$init == defined('DC_CONTEXT_ADMIN') static::$init == defined('DC_CONTEXT_ADMIN')
&& dcCore::app()->auth?->isSuperAdmin() && dcCore::app()->auth?->isSuperAdmin();
&& My::phpCompliant();
return static::$init; return static::$init;
} }

View file

@ -28,7 +28,7 @@ class Frontend extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = My::phpCompliant(); static::$init = defined('DC_RC_PATH');
return static::$init; return static::$init;
} }

View file

@ -26,7 +26,7 @@ class Install extends dcNsProcess
{ {
public static function init(): bool 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'); $version = dcCore::app()->plugins->moduleInfo(My::id(), 'version');
static::$init = is_string($version) ? dcCore::app()->newVersion(My::id(), $version) : true; static::$init = is_string($version) ? dcCore::app()->newVersion(My::id(), $version) : true;
} }

View file

@ -39,7 +39,6 @@ class Manage extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
static::$init == defined('DC_CONTEXT_ADMIN') static::$init == defined('DC_CONTEXT_ADMIN')
&& My::phpCompliant()
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->auth)
&& !is_null(dcCore::app()->blog) && !is_null(dcCore::app()->blog)
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([

View file

@ -42,7 +42,6 @@ class ManageFeed extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
static::$init == defined('DC_CONTEXT_ADMIN') static::$init == defined('DC_CONTEXT_ADMIN')
&& My::phpCompliant()
&& !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog) && !is_null(dcCore::app()->auth) && !is_null(dcCore::app()->blog)
&& dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([ && dcCore::app()->auth->check(dcCore::app()->auth->makePermissions([
dcCore::app()->auth::PERMISSION_CONTENT_ADMIN, dcCore::app()->auth::PERMISSION_CONTENT_ADMIN,

View file

@ -55,9 +55,6 @@ class My
'FeedFeedURL', 'FeedFeedURL',
]; ];
/** @var string This module required php version */
public const PHP_MIN = '8.1';
/** /**
* This module id. * This module id.
*/ */
@ -83,12 +80,4 @@ class My
{ {
return dirname(__DIR__); return dirname(__DIR__);
} }
/**
* Check this module PHP version compliant.
*/
public static function phpCompliant(): bool
{
return version_compare(phpversion(), self::PHP_MIN, '>=');
}
} }

View file

@ -24,7 +24,7 @@ class Prepend extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
static::$init = My::phpCompliant(); static::$init = defined('DC_RC_PATH');
return static::$init; return static::$init;
} }

View file

@ -54,7 +54,7 @@ class Uninstall extends dcNsProcess
->addUserAction( ->addUserAction(
'tables', 'tables',
'delete', 'delete',
My::TABLE_NAME My::TABLE_NAME,
) )
->addUserAction( ->addUserAction(
'plugins', 'plugins',