use dotclear method to check version

master
Jean-Christian Paul Denis 2022-12-10 15:54:05 +01:00
parent 6f9334cbbf
commit 9bd94e05c1
Signed by: JcDenis
GPG Key ID: 1B5B8C5B90B6C951
1 changed files with 5 additions and 9 deletions

View File

@ -15,14 +15,10 @@ if (!defined('DC_CONTEXT_ADMIN')) {
} }
try { try {
# Grab info
$mod_id = basename(__DIR__);
# 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;
} }
@ -69,8 +65,8 @@ try {
); );
# Transfert records from old table to the new one # Transfert records from old table to the new one
if (dcCore::app()->getVersion($mod_id) !== null if (dcCore::app()->getVersion(basename(__DIR__)) !== null
&& version_compare(dcCore::app()->getVersion($mod_id), '0.5', '<') && version_compare(dcCore::app()->getVersion(basename(__DIR__)), '0.5', '<')
) { ) {
require_once __DIR__ . '/inc/patch.0.5.php'; require_once __DIR__ . '/inc/patch.0.5.php';
} }