use dotclear method to check version

This commit is contained in:
Jean-Christian 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;
}
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);