use dotclear method to check version

master
Jean-Christian Paul Denis 2022-12-10 15:47:51 +01:00
parent 35db512230
commit 912a47061a
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 5 additions and 21 deletions

View File

@ -15,30 +15,14 @@ if (!defined('DC_CONTEXT_ADMIN')) {
} }
try { try {
# Grab info
$mod_id = basename(__DIR__);
$dc_min = dcCore::app()->plugins->moduleInfo($mod_id, 'requires')[0][1];
# Check installed version # Check installed version
if (version_compare( if (!dcCore::app()->newVersion(
dcCore::app()->getVersion($mod_id), basename(__DIR__),
dcCore::app()->plugins->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);
@ -61,8 +45,8 @@ try {
$changes = $ti->synchronize($t); $changes = $ti->synchronize($t);
# Settings # Settings
dcCore::app()->blog->settings->addNamespace('periodical'); dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
$s = dcCore::app()->blog->settings->periodical; $s = dcCore::app()->blog->settings->__get(basename(__DIR__));
$s->put('periodical_active', false, 'boolean', 'Enable extension', false, true); $s->put('periodical_active', false, 'boolean', 'Enable extension', false, true);
$s->put('periodical_upddate', true, 'boolean', 'Update post date', false, true); $s->put('periodical_upddate', true, 'boolean', 'Update post date', false, true);
$s->put('periodical_updurl', false, 'boolean', 'Update post url', false, true); $s->put('periodical_updurl', false, 'boolean', 'Update post url', false, true);