use dotclear method to check version

master
Jean-Christian Paul Denis 2022-12-10 15:36:31 +01:00
parent ddaef81d36
commit 430fb78ef2
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 5 additions and 20 deletions

View File

@ -72,33 +72,18 @@ $mod_conf = [
# -- Nothing to change below --
try {
# Grab info
$mod_id = basename(__DIR__);
$dc_min = dcCore::app()->plugins->moduleInfo($mod_id, 'requires')[0][1];
# Check module 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
));
}
# Set module settings
dcCore::app()->blog->settings->addNamespace($mod_id);
dcCore::app()->blog->settings->addNamespace(basename(__DIR__));
foreach ($mod_conf as $v) {
dcCore::app()->blog->settings->{$mod_id}->put(
dcCore::app()->blog->settings->__get(basename(__DIR__))->put(
$v[0],
$v[2],
$v[3],