check php version

This commit is contained in:
Jean-Christian 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
{
if (defined('DC_CONTEXT_ADMIN')) {
self::$init = true;
self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>=');
}
return self::$init;

View file

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

View file

@ -40,7 +40,10 @@ class Install extends dcNsProcess
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;
}

View file

@ -51,13 +51,14 @@ class Manage extends dcNsProcess
public static function init(): bool
{
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::$type = self::getType();
self::$module = self::getModule();
self::$action = self::getAction();
self::$init = true;
}
return self::$init;