From 912a47061aa95bc3cbc7b52424d31ab6ccfbc7fe Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 10 Dec 2022 15:47:51 +0100 Subject: [PATCH] use dotclear method to check version --- _install.php | 26 +++++--------------------- 1 file changed, 5 insertions(+), 21 deletions(-) diff --git a/_install.php b/_install.php index d43cd06..c52e7f9 100644 --- a/_install.php +++ b/_install.php @@ -15,30 +15,14 @@ if (!defined('DC_CONTEXT_ADMIN')) { } try { - # Grab info - $mod_id = basename(__DIR__); - $dc_min = dcCore::app()->plugins->moduleInfo($mod_id, 'requires')[0][1]; - # Check installed 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 - if (!method_exists('dcUtils', 'versionsCompare') - || dcUtils::versionsCompare(DC_VERSION, $dc_min, '<', false) - ) { - throw new Exception(sprintf( - '%s requires Dotclear %s', - $mod_id, - $dc_min - )); - } - # Tables $t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); @@ -61,8 +45,8 @@ try { $changes = $ti->synchronize($t); # Settings - dcCore::app()->blog->settings->addNamespace('periodical'); - $s = dcCore::app()->blog->settings->periodical; + dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); + $s = dcCore::app()->blog->settings->__get(basename(__DIR__)); $s->put('periodical_active', false, 'boolean', 'Enable extension', false, true); $s->put('periodical_upddate', true, 'boolean', 'Update post date', false, true); $s->put('periodical_updurl', false, 'boolean', 'Update post url', false, true);