check php version

master
Jean-Christian Paul Denis 2023-03-18 23:14:41 +01:00
parent 061b69e803
commit 03ba85d38e
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
4 changed files with 13 additions and 7 deletions

View File

@ -35,7 +35,7 @@ class Backend extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { if (defined('DC_CONTEXT_ADMIN')) {
self::$init = true; self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>=');
} }
return self::$init; return self::$init;

View File

@ -43,10 +43,12 @@ class Config extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { if (defined('DC_CONTEXT_ADMIN')) {
dcPage::checkSuper(); if (version_compare(phpversion(), My::PHP_MIN, '>=')) {
self::$init = true; self::$init = dcCore::app()->auth->isSuperAdmin();
} else {
dcCore::app()->error->add(sprintf(__('%s required php >= %s'), My::id(), My::PHP_MIN));
}
} }
return self::$init; return self::$init;
} }

View File

@ -40,7 +40,10 @@ class Install extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
self::$init = defined('DC_CONTEXT_ADMIN') && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version')); if (defined('DC_CONTEXT_ADMIN')) {
self::$init = version_compare(phpversion(), My::PHP_MIN, '>=')
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
}
return self::$init; return self::$init;
} }

View File

@ -51,13 +51,14 @@ class Manage extends dcNsProcess
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { if (defined('DC_CONTEXT_ADMIN')) {
dcPage::checkSuper(); self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>=');
}
if (self::$init) {
self::$improve = new Core(); self::$improve = new Core();
self::$type = self::getType(); self::$type = self::getType();
self::$module = self::getModule(); self::$module = self::getModule();
self::$action = self::getAction(); self::$action = self::getAction();
self::$init = true;
} }
return self::$init; return self::$init;