From b4468107a5bcd65995622ebbfe88460ea20aff1d Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 10 Dec 2022 15:16:43 +0100 Subject: [PATCH] use dotclear method to check version --- _install.php | 23 +++++------------------ 1 file changed, 5 insertions(+), 18 deletions(-) diff --git a/_install.php b/_install.php index 8103869..3b46e0a 100644 --- a/_install.php +++ b/_install.php @@ -15,7 +15,6 @@ if (!defined('DC_CONTEXT_ADMIN')) { } # -- Module specs -- -$mod_id = 'dcFilterDuplicate'; $mod_conf = [[ 'dcfilterduplicate_minlen', 'Minimum lenght of comment to filter', @@ -26,28 +25,16 @@ $mod_conf = [[ # -- Nothing to change below -- try { # Check module version - if (version_compare( - dcCore::app()->getVersion($mod_id), - dcCore::app()->plugins->moduleInfo($mod_id, 'version'), - '>=' + if (!dcCore::app()->newVersion( + basename(__DIR__), + dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version') )) { return null; } - # Check Dotclear version - $dc_min = $this->modules[$mod_id]['requires'][0][1]; - if (!method_exists('dcUtils', 'versionsCompare') - || dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false) - ) { - throw new Exception(sprintf( - '%s requires Dotclear %s', - $mod_id, - $dc_min - )); - } # Set module settings - dcCore::app()->blog->settings->addNamespace($mod_id); + dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); foreach ($mod_conf as $v) { - dcCore::app()->blog->settings->{$mod_id}->put( + dcCore::app()->blog->settings->__get(basename(__DIR__))->put( $v[0], $v[2], $v[3],