clean up install file

This commit is contained in:
Jean-Christian Denis 2021-10-30 00:59:40 +02:00
parent 11dede7f31
commit d2a2b18308
Signed by: JcDenis
GPG key ID: 1B5B8C5B90B6C951

View file

@ -12,29 +12,17 @@
*/ */
if (!defined('DC_CONTEXT_ADMIN')) { if (!defined('DC_CONTEXT_ADMIN')) {
return null; return null;
} }
$new_version = $core->plugins->moduleInfo('postWidgetText', 'version');
$old_version = $core->getVersion('postWidgetText');
if (version_compare($old_version, $new_version, '>=')) {
return;
}
try { try {
# Check module version
if (version_compare(
$core->getVersion('postWidgetText'),
$core->plugins->moduleInfo('postWidgetText', 'version'),
'>='
)) {
return null;
}
# Check Dotclear version
if (!method_exists('dcUtils', 'versionsCompare')
|| dcUtils::versionsCompare(DC_VERSION, '2.6', '<', false)) {
throw new Exception(sprintf(
'%s requires Dotclear %s', 'postWidgetText', '2.6'
));
}
# Table is the same for plugins # Table is the same for plugins
# pollsFactory, postTask, postWidgetText # pollsFactory, postTask, postWidgetText
$s = new dbStruct($core->con, $core->prefix); $s = new dbStruct($core->con, $core->prefix);
@ -72,15 +60,11 @@ try {
} }
# Set module version # Set module version
$core->setVersion( $core->setVersion('postWidgetText', $new_version);
'postWidgetText',
$core->plugins->moduleInfo('postWidgetText', 'version')
);
return true; return true;
} } catch (Exception $e) {
catch (Exception $e) {
$core->error->add($e->getMessage()); $core->error->add($e->getMessage());
}
return false; return false;
}