fix init check

master
Jean-Christian Paul Denis 2023-03-20 00:20:41 +01:00
parent 82062f8f96
commit 6b70f9b7fb
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
5 changed files with 27 additions and 32 deletions

View File

@ -24,16 +24,16 @@ class Backend extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { static::$init = defined('DC_CONTEXT_ADMIN')
self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>='); && dcCore::app()->auth?->isSuperAdmin()
} && My::phpCompliant();
return self::$init; return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!self::$init) { if (!static::$init) {
return false; return false;
} }

View File

@ -35,20 +35,16 @@ class Config extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { static::$init = defined('DC_CONTEXT_ADMIN')
if (version_compare(phpversion(), My::PHP_MIN, '>=')) { && dcCore::app()->auth?->isSuperAdmin()
self::$init = true; && My::phpCompliant();
} else {
dcCore::app()->error->add(sprintf(__('%s required php >= %s'), My::id(), My::PHP_MIN));
}
}
return self::$init; return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!self::$init) { if (!static::$init) {
return false; return false;
} }
@ -80,7 +76,7 @@ class Config extends dcNsProcess
public static function render(): void public static function render(): void
{ {
if (!self::$init) { if (!static::$init) {
return; return;
} }

View File

@ -22,17 +22,16 @@ class Install extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { static::$init = defined('DC_CONTEXT_ADMIN')
self::$init = version_compare(phpversion(), My::PHP_MIN, '>=') && My::phpCompliant()
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version')); && dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
}
return self::$init; return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!self::$init) { if (!static::$init) {
return false; return false;
} }
@ -52,7 +51,7 @@ class Install extends dcNsProcess
* *
* @return bool Upgrade done * @return bool Upgrade done
*/ */
public static function growUp() private static function growUp()
{ {
$current = dcCore::app()->getVersion(My::id()); $current = dcCore::app()->getVersion(My::id());

View File

@ -26,16 +26,16 @@ class Manage extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { static::$init = defined('DC_CONTEXT_ADMIN')
self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>='); && dcCore::app()->auth?->isSuperAdmin()
} && My::phpCompliant();
return self::$init; return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!self::$init) { if (!static::$init) {
return false; return false;
} }

View File

@ -21,16 +21,16 @@ class Prepend extends dcNsProcess
{ {
public static function init(): bool public static function init(): bool
{ {
if (defined('DC_CONTEXT_ADMIN')) { static::$init = defined('DC_CONTEXT_ADMIN')
self::$init = dcCore::app()->auth->isSuperAdmin(); && dcCore::app()->auth?->isSuperAdmin()
} && My::phpCompliant();
return self::$init; return static::$init;
} }
public static function process(): bool public static function process(): bool
{ {
if (!self::$init) { if (!static::$init) {
return false; return false;
} }