lazy way to get dc_min

This commit is contained in:
Jean-Christian Denis 2022-12-01 10:53:13 +01:00
parent e557293f80
commit 9645614c56
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -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