From b503f5efc5a5a31508b2330ddb69b771b162b1ba Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Sat, 10 Dec 2022 15:57:46 +0100 Subject: [PATCH] use dotclear method to check version --- _install.php | 27 +++++---------------------- 1 file changed, 5 insertions(+), 22 deletions(-) diff --git a/_install.php b/_install.php index 0a7dfba..1e37a43 100644 --- a/_install.php +++ b/_install.php @@ -14,32 +14,15 @@ if (!defined('DC_CONTEXT_ADMIN')) { return null; } - try { - # Grab module info - $mod_id = basename(__DIR__); - $dc_min = $this->modules[$mod_id]['requires'][0][1]; - # Check module version - if (version_compare( - dcCore::app()->getVersion($mod_id), - $this->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); $t->{initZoneclearFeedServer::FEED_TABLE_NAME} @@ -72,8 +55,8 @@ try { $changes = $ti->synchronize($t); # Settings - dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer'); - $s = dcCore::app()->blog->settings->zoneclearFeedServer; + dcCore::app()->blog->settings->addNamespace(basename(__DIR__)); + $s = dcCore::app()->blog->settings->__get(basename(__DIR__)); $s->put('zoneclearFeedServer_active', false, 'boolean', 'Enable zoneclearBlogServer', false, true); $s->put('zoneclearFeedServer_pub_active', false, 'boolean', 'Enable public page of list of feeds', false, true); $s->put('zoneclearFeedServer_post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);