fix init check
This commit is contained in:
parent
8f3f817f42
commit
40f4cc14ad
5 changed files with 31 additions and 28 deletions
|
@ -34,16 +34,16 @@ class Backend extends dcNsProcess
|
|||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
if (defined('DC_CONTEXT_ADMIN')) {
|
||||
self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>=');
|
||||
}
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& dcCore::app()->auth->isSuperAdmin()
|
||||
&& My::phpCompliant();
|
||||
|
||||
return self::$init;
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -42,20 +42,16 @@ class Config extends dcNsProcess
|
|||
{
|
||||
public static function init(): bool
|
||||
{
|
||||
if (defined('DC_CONTEXT_ADMIN')) {
|
||||
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));
|
||||
}
|
||||
}
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& dcCore::app()->auth->isSuperAdmin()
|
||||
&& My::phpCompliant();
|
||||
|
||||
return self::$init;
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -86,7 +82,7 @@ class Config extends dcNsProcess
|
|||
|
||||
public static function render(): void
|
||||
{
|
||||
if (!self::$init) {
|
||||
if (!static::$init) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -40,17 +40,16 @@ class Install extends dcNsProcess
|
|||
|
||||
public static function init(): bool
|
||||
{
|
||||
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'));
|
||||
}
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& My::phpCompliant()
|
||||
&& dcCore::app()->newVersion(My::id(), dcCore::app()->plugins->moduleInfo(My::id(), 'version'));
|
||||
|
||||
return self::$init;
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
|
@ -50,18 +50,18 @@ class Manage extends dcNsProcess
|
|||
|
||||
public static function init(): bool
|
||||
{
|
||||
if (defined('DC_CONTEXT_ADMIN')) {
|
||||
self::$init = dcCore::app()->auth->isSuperAdmin() && version_compare(phpversion(), My::PHP_MIN, '>=');
|
||||
}
|
||||
static::$init = defined('DC_CONTEXT_ADMIN')
|
||||
&& dcCore::app()->auth->isSuperAdmin()
|
||||
&& My::phpCompliant();
|
||||
|
||||
if (self::$init) {
|
||||
if (static::$init) {
|
||||
self::$improve = new Core();
|
||||
self::$type = self::getType();
|
||||
self::$module = self::getModule();
|
||||
self::$action = self::getAction();
|
||||
}
|
||||
|
||||
return self::$init;
|
||||
return static::$init;
|
||||
}
|
||||
|
||||
private static function getType(): string
|
||||
|
@ -166,7 +166,7 @@ class Manage extends dcNsProcess
|
|||
|
||||
public static function process(): bool
|
||||
{
|
||||
if (!self::$init) {
|
||||
if (!static::$init) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -217,7 +217,7 @@ class Manage extends dcNsProcess
|
|||
|
||||
public static function render(): void
|
||||
{
|
||||
if (!self::$init) {
|
||||
if (!static::$init) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -39,4 +39,12 @@ class My
|
|||
{
|
||||
return __((string) dcCore::app()->plugins->moduleInfo(self::id(), 'name'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Check php version
|
||||
*/
|
||||
public static function phpCompliant(): bool
|
||||
{
|
||||
return version_compare(phpversion(), self::PHP_MIN, '>=');
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue