From 9645614c567ee99909096a7671783b5999e9c93a Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Thu, 1 Dec 2022 10:53:13 +0100 Subject: [PATCH] lazy way to get dc_min --- _install.php | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/_install.php b/_install.php index ffa62b8..de1483d 100644 --- a/_install.php +++ b/_install.php @@ -33,8 +33,6 @@ use Exception; */ class install { - /** @var string Dotclear minimal version */ - private static $dotclear_version = '2.24'; /** @var array Improve default settings */ private static $default_settings = [[ 'disabled', @@ -52,7 +50,7 @@ class install throw new Exception(sprintf( '%s requires Dotclear %s', 'improve', - self::$dotclear_version + self::getDotclearVersion() )); } @@ -64,6 +62,11 @@ class install return true; } + private static function getDotclearVersion(): string + { + return dcCore::app()->plugins->moduleInfo('improve', 'requires')[0][1]; + } + private static function getInstalledVersion(): string { $version = dcCore::app()->getVersion('improve'); @@ -83,7 +86,7 @@ class install private static function checkDotclearVersion(): bool { return method_exists('dcUtils', 'versionsCompare') - && dcUtils::versionsCompare(DC_VERSION, self::$dotclear_version, '>=', false); + && dcUtils::versionsCompare(DC_VERSION, self::getDotclearVersion(), '>=', false); } private static function putSettings(): void