Fixes license changes and removes duplicated logic

Addresses #5965
This commit is contained in:
Simone Mainardi 2021-10-11 16:03:51 +02:00
parent 5502f3fc2e
commit b1499dc6db
3 changed files with 22 additions and 41 deletions

View file

@ -726,33 +726,6 @@ end
-- ##############################################
function plugins_utils.checkReloadPlugins(when)
local demo_ends_at = ntop.getInfo()["pro.demo_ends_at"]
local time_delta = demo_ends_at - when
local plugins_reloaded = false
-- tprint({time_delta = time_delta, demo_ends_at = demo_ends_at, when = when, is_pro = ntop.isPro()})
if ntop.getCache('ntopng.cache.force_reload_plugins') == '1' then
-- Check and possibly reload plugins after a user has changed (e.g., applied or removed) a license
-- from the web user interface (page about.lua)
plugins_utils.loadPlugins(not ntop.isPro() --[[ reload only community if license is not pro --]])
ntop.delCache('ntopng.cache.force_reload_plugins')
plugins_reloaded = true
elseif demo_ends_at and demo_ends_at > 0 and time_delta <= 10 and ntop.isPro() and not ntop.hasPluginsReloaded() then
-- Checks and possibly reload plugins for demo licenses. In case of demo licenses,
-- if within 10 seconds from the license expirations, a plugin reload is executed only for the community plugins
plugins_utils.loadPlugins(true --[[ reload only community plugins --]])
plugins_reloaded = true
end
if plugins_reloaded then
ntop.reloadPlugins()
end
end
-- ##############################################
function plugins_utils.getMenuEntries()
init_runtime_paths()
local menu = {}