use dotclear method to check version

This commit is contained in:
Jean-Christian Paul Denis 2022-12-10 15:57:46 +01:00
parent 33cf760501
commit b503f5efc5
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951

View File

@ -14,32 +14,15 @@ if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
try { try {
# Grab module info
$mod_id = basename(__DIR__);
$dc_min = $this->modules[$mod_id]['requires'][0][1];
# Check module version # Check module version
if (version_compare( if (!dcCore::app()->newVersion(
dcCore::app()->getVersion($mod_id), basename(__DIR__),
$this->moduleInfo($mod_id, 'version'), dcCore::app()->plugins->moduleInfo(basename(__DIR__), 'version')
'>='
)) { )) {
return null; 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 # Tables
$t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix); $t = new dbStruct(dcCore::app()->con, dcCore::app()->prefix);
$t->{initZoneclearFeedServer::FEED_TABLE_NAME} $t->{initZoneclearFeedServer::FEED_TABLE_NAME}
@ -72,8 +55,8 @@ try {
$changes = $ti->synchronize($t); $changes = $ti->synchronize($t);
# Settings # Settings
dcCore::app()->blog->settings->addNamespace('zoneclearFeedServer'); dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
$s = dcCore::app()->blog->settings->zoneclearFeedServer; $s = dcCore::app()->blog->settings->__get(basename(__DIR__));
$s->put('zoneclearFeedServer_active', false, 'boolean', 'Enable zoneclearBlogServer', false, true); $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_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); $s->put('zoneclearFeedServer_post_status_new', true, 'boolean', 'Enable auto publish new posts', false, true);