From 152ccc37665db71d942dde94d511d9dfa83ec373 Mon Sep 17 00:00:00 2001 From: Jean-Christian Denis Date: Tue, 7 Sep 2021 14:51:25 +0200 Subject: [PATCH] fix install --- _install.php | 35 +++++++++-------------------------- 1 file changed, 9 insertions(+), 26 deletions(-) diff --git a/_install.php b/_install.php index 1946b09..3832363 100644 --- a/_install.php +++ b/_install.php @@ -13,30 +13,17 @@ # -- END LICENSE BLOCK ------------------------------------ if (!defined('DC_CONTEXT_ADMIN')) { - return null; } +$new_version = $core->plugins->moduleInfo('cinecturlink2', 'version'); +$old_version = $core->getVersion('cinecturlink2'); + +if (version_compare($old_version, $new_version, '>=')) { + return; +} + try { - # Check module version - if (version_compare( - $core->getVersion('cinecturlink2'), - $core->plugins->moduleInfo('cinecturlink2', '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', 'cinecturlink2', '2.6' - )); - } - - # Tables $s = new dbStruct($core->con, $core->prefix); $s->cinecturlink2 ->link_id ('bigint', 0, false) @@ -80,7 +67,6 @@ try { $si = new dbStruct($core->con,$core->prefix); $changes = $si->synchronize($s); - # Settings $core->blog->settings->addNamespace('cinecturlink2'); $s = $core->blog->settings->cinecturlink2; $s->put('cinecturlink2_active', true, 'boolean', 'Enable cinecturlink2', false, true); @@ -93,17 +79,14 @@ try { $s->put('cinecturlink2_public_nbrpp', 20, 'integer', 'Number of entries per page on public page', false, true); $s->put('cinecturlink2_public_caturl', 'c2cat', 'string', 'Part of URL for a category list', false, true); - - # Set module version $core->setVersion( 'cinecturlink2', $core->plugins->moduleInfo('cinecturlink2', 'version') ); return true; -} -catch (Exception $e) { +} catch (Exception $e) { $core->error->add($e->getMessage()); } -return false; +return false; \ No newline at end of file