From: Florian Eckert Date: Mon, 21 Jan 2019 13:18:12 +0000 (+0100) Subject: luci-app-statistics: only include lua modules into local scope X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=b8aa3ebced39a9e82dbd3751d5ed28092aa02233;p=oweals%2Fluci.git luci-app-statistics: only include lua modules into local scope Signed-off-by: Florian Eckert --- diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua index 663a3f12d..b380febac 100644 --- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/collectd.lua @@ -1,7 +1,7 @@ -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. -require("luci.sys") +local sys = require("luci.sys") m = Map("luci_statistics", @@ -17,7 +17,7 @@ s = m:section( NamedSection, "collectd", "luci_statistics" ) -- general.hostname (Hostname) hostname = s:option( Value, "Hostname", translate("Hostname") ) -hostname.default = luci.sys.hostname() +hostname.default = sys.hostname() hostname.optional = true -- general.basedir (BaseDir) diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua index dafcc452c..424501866 100644 --- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/dns.lua @@ -1,7 +1,7 @@ -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. -require("luci.sys") +local sys = require("luci.sys") m = Map("luci_statistics", @@ -24,7 +24,7 @@ interfaces.widget = "select" interfaces.size = 5 interfaces:depends( "enable", 1 ) interfaces:value("any") -for k, v in pairs(luci.sys.net.devices()) do +for k, v in pairs(sys.net.devices()) do interfaces:value(v) end diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua index 752212f4d..60c88d072 100644 --- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/interface.lua @@ -1,7 +1,7 @@ -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. -require("luci.sys") +local sys = require("luci.sys") m = Map("luci_statistics", @@ -23,7 +23,7 @@ interfaces = s:option( MultiValue, "Interfaces", translate("Monitor interfaces") interfaces.widget = "select" interfaces.size = 5 interfaces:depends( "enable", 1 ) -for k, v in pairs(luci.sys.net.devices()) do +for k, v in pairs(sys.net.devices()) do interfaces:value(v) end diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua index ded3f7f99..375a15bf1 100644 --- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/iptables.lua @@ -1,13 +1,12 @@ -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. -require("luci.sys.iptparser") +local ip = require("luci.sys.iptparser").IptParser() -ip = luci.sys.iptparser.IptParser() -chains = { } -targets = { } +local chains = { } +local targets = { } -for i, rule in ipairs( ip:find() ) do +for i, rule in ipairs( ip:find() ) do if rule.chain and rule.target then chains[rule.chain] = true targets[rule.target] = true diff --git a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua index 66449ec46..784ad1fdb 100644 --- a/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua +++ b/applications/luci-app-statistics/luasrc/model/cbi/luci_statistics/netlink.lua @@ -1,9 +1,9 @@ -- Copyright 2008 Freifunk Leipzig / Jo-Philipp Wich -- Licensed to the public under the Apache License 2.0. -require("luci.sys") +local sys = require("luci.sys") -local devices = luci.sys.net.devices() +local devices = sys.net.devices() m = Map("luci_statistics",