diff options
author | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2015-06-04 20:59:21 +0200 |
---|---|---|
committer | Christian Schoenebeck <christian.schoenebeck@gmail.com> | 2015-06-04 20:59:21 +0200 |
commit | 22f40d392bea954c789a6fc9320cf8993891202e (patch) | |
tree | 6276d78374fd3b45fdcf6204c6b9efbd8a1874f8 /applications | |
parent | e2d6ee782246a61aa88c87dfae0f596882adcd0a (diff) |
luci-app-privoxy: fixed function ipkg_ver_compare()
fixed function ipkg_ver_compare()
Signed-off-by: Christian Schoenebeck <christian.schoenebeck@gmail.com>
Diffstat (limited to 'applications')
-rw-r--r-- | applications/luci-app-privoxy/Makefile | 2 | ||||
-rw-r--r--[-rwxr-xr-x] | applications/luci-app-privoxy/luasrc/controller/privoxy.lua | 41 | ||||
-rw-r--r--[-rwxr-xr-x] | applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua | 1 | ||||
-rw-r--r--[-rwxr-xr-x] | applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm | 0 |
4 files changed, 15 insertions, 29 deletions
diff --git a/applications/luci-app-privoxy/Makefile b/applications/luci-app-privoxy/Makefile index bc2c57ee9..3d87a417f 100644 --- a/applications/luci-app-privoxy/Makefile +++ b/applications/luci-app-privoxy/Makefile @@ -10,7 +10,7 @@ PKG_NAME:=luci-app-privoxy # Version == major.minor.patch # increase "minor" on new functionality and "patch" on patches/optimization -PKG_VERSION:=1.0.3 +PKG_VERSION:=1.0.4 # Release == build # increase on changes of translation files diff --git a/applications/luci-app-privoxy/luasrc/controller/privoxy.lua b/applications/luci-app-privoxy/luasrc/controller/privoxy.lua index 9ffc404ce..58ba80724 100755..100644 --- a/applications/luci-app-privoxy/luasrc/controller/privoxy.lua +++ b/applications/luci-app-privoxy/luasrc/controller/privoxy.lua @@ -72,8 +72,7 @@ end -- compare versions using "<=" "<" ">" ">=" "=" "<<" ">>" function ipkg_ver_compare(ver1, comp, ver2) - if not ver1 or not (#ver1 > 0) - or not ver2 or not (#ver2 > 0) + if not ver1 or not ver2 or not comp or not (#comp > 0) then return nil end -- correct compare string if comp == "<>" or comp == "><" or comp == "!=" or comp == "~=" then comp = "~=" @@ -90,33 +89,19 @@ function ipkg_ver_compare(ver1, comp, ver2) for i = 1, math.max(table.getn(av1),table.getn(av2)), 1 do local s1 = av1[i] or "" local s2 = av2[i] or "" - local n1 = tonumber(s1) - local n2 = tonumber(s2) - - -- one numeric and other empty string then set other to 0 - if n1 and not n2 and (not s2 or #s2 == 0) then n2 = 0 end - if n2 and not n1 and (not s1 or #s1 == 0) then n1 = 0 end - - local nc = (n1 and n2) -- numeric compare - - if nc then - -- first "not equal" found return true - if comp == "~=" and (n1 ~= n2) then return true end - -- first "lower" found return true - if (comp == "<" or comp == "<=") and (n1 < n2) then return true end - -- first "greater" found return true - if (comp == ">" or comp == ">=") and (n1 > n2) then return true end - -- not equal then return false - if (n1 ~= n2) then return false end - else - if comp == "~=" and (s1 ~= s2) then return true end - if (comp == "<" or comp == "<=") and (s1 < s2) then return true end - if (comp == ">" or comp == ">=") and (s1 > s2) then return true end - if (s1 ~= s2) then return false end - end + + -- first "not equal" found return true + if comp == "~=" and (s1 ~= s2) then return true end + -- first "lower" found return true + if (comp == "<" or comp == "<=") and (s1 < s2) then return true end + -- first "greater" found return true + if (comp == ">" or comp == ">=") and (s1 > s2) then return true end + -- not equal then return false + if (s1 ~= s2) then return false end end - -- all equal then true - return true + + -- all equal and not compare greater or lower then true + return not (comp == "<" or comp == ">") end -- read version information for given package if installed diff --git a/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua b/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua index c009313e3..c415f8e06 100755..100644 --- a/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua +++ b/applications/luci-app-privoxy/luasrc/model/cbi/privoxy.lua @@ -39,6 +39,7 @@ if not nixio.fs.access("/etc/config/privoxy") or not VEROK then local f = SimpleForm("_no_config") f.title = TITLE f.description = DESC + f.embedded = true f.submit = false f.reset = false diff --git a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm index 3e190709f..3e190709f 100755..100644 --- a/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm +++ b/applications/luci-app-privoxy/luasrc/view/privoxy/detail_logview.htm |