mirror of
https://github.com/ntop/ntopng.git
synced 2026-04-29 15:39:33 +00:00
parent
18a15a8b86
commit
9c404e3b30
5 changed files with 112 additions and 1 deletions
|
|
@ -3482,6 +3482,44 @@ end
|
|||
|
||||
-- ###########################################
|
||||
|
||||
-- version is major.minor.veryminor
|
||||
function version2int(v)
|
||||
if(v == nil) then return(0) end
|
||||
|
||||
e = string.split(v, "%.");
|
||||
if(e ~= nil) then
|
||||
major = e[1]
|
||||
minor = e[2]
|
||||
veryminor = e[3]
|
||||
|
||||
if(major == nil or tonumber(major) == nil or type(major) ~= "string") then major = 0 end
|
||||
if(minor == nil or tonumber(minor) == nil or type(minor) ~= "string") then minor = 0 end
|
||||
if(veryminor == nil or tonumber(veryminor) == nil or type(veryminor) ~= "string") then veryminor = 0 end
|
||||
|
||||
version = tonumber(major)*1000 + tonumber(minor)*100 -- + tonumber(veryminor)
|
||||
return(version)
|
||||
else
|
||||
return(0)
|
||||
end
|
||||
end
|
||||
|
||||
function get_version_update_msg(info, latest_version)
|
||||
version_elems = split(info["version"], " ")
|
||||
new_version = version2int(latest_version)
|
||||
this_version = version2int(version_elems[1])
|
||||
|
||||
if(new_version > this_version) then
|
||||
return i18n("about.new_major_available", {
|
||||
product = info["product"], version = latest_version,
|
||||
url = "http://www.ntop.org/get-started/download/"
|
||||
})
|
||||
else
|
||||
return ""
|
||||
end
|
||||
end
|
||||
|
||||
-- ###########################################
|
||||
|
||||
--
|
||||
-- IMPORTANT
|
||||
-- Leave it at the end so it can use the functions
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue