From 82f0a3d7e6d085ebf399f9cf71be1c5821a62b95 Mon Sep 17 00:00:00 2001 From: Cambell Date: Wed, 29 Mar 2017 17:17:59 +0700 Subject: [PATCH] unstable-feature/ModuleVersion: unversioned modules - Allow unversioned modules to be installed - Improve the error text to include the module version that fails to install. --- admin/inst_module.php | 4 ++-- includes/packages.inc | 4 ++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/admin/inst_module.php b/admin/inst_module.php index 2309292be..d461956d1 100644 --- a/admin/inst_module.php +++ b/admin/inst_module.php @@ -214,8 +214,8 @@ function company_extensions($id) { if (check_value('Active'.$i) && !check_src_ext_version($ext['version'])) { - display_warning(sprintf(_("Package '%s' is incompatible with current application version and cannot be activated.\n") - . _("Check Install/Activate page for newer package version."), $ext['name'])); + display_warning(sprintf(_("Package '%s' version '%s' is incompatible with current application version and cannot be activated.\n") + . _("Check Install/Activate page for newer package version."), $ext['name'], $ext['version'])); continue; } $activated = activate_hooks($ext['package'], $comp, !$ext['active']); // change active state diff --git a/includes/packages.inc b/includes/packages.inc index 99b620d30..8be885389 100644 --- a/includes/packages.inc +++ b/includes/packages.inc @@ -733,6 +733,10 @@ function check_src_ext_version($ext_v) $app = explode('.', substr($src_version, 0, strspn($src_version, "0123456789."))); $pkg = explode('.', substr($ext_v, 0, strspn($ext_v, "0123456789."))); + if ($ext_v == '' || $ext_v == '-') { + return true; + } + for ($i=0; $i < min($compat_levels, count($app)); $i++) if ($pkg[$i] < $app[$i]) return false;