diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 15:37:46 +0100 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2015-01-15 15:37:46 +0100 |
commit | b7f80a98d8b78e259648d820912b7c2338529e0a (patch) | |
tree | c399b203a293f5351d0135f96259a54f6314adb3 /modules/luci-mod-admin-full/luasrc/view | |
parent | 9780ee382e72f8a5fb69e337a3fcc51fc0914883 (diff) |
luci-mod-admin-full: switch to nixio.fs
Signed-off-by: Jo-Philipp Wich <jow@openwrt.org>
Diffstat (limited to 'modules/luci-mod-admin-full/luasrc/view')
3 files changed, 18 insertions, 22 deletions
diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm index 312fd0865..63bb6dc9c 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_network/wifi_overview.htm @@ -14,7 +14,7 @@ You may obtain a copy of the License at <%- local sys = require "luci.sys" - local fs = require "luci.fs" + local fs = require "nixio.fs" local utl = require "luci.util" local uci = require "luci.model.uci".cursor() local ntm = require "luci.model.network" @@ -86,7 +86,7 @@ You may obtain a copy of the License at return translate("Hermes 802.11b Wireless Controller") -- hostap - elseif name == "wlan" and fs.isdirectory("/proc/net/hostap/" .. ifname) then + elseif name == "wlan" and fs.stat("/proc/net/hostap/" .. ifname, "type") == "dir" then return translate("Prism2/2.5/3 802.11b Wireless Controller") -- dunno yet diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm index cb6371bfa..17dfd1466 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/index.htm @@ -12,13 +12,13 @@ You may obtain a copy of the License at -%> <% - require "luci.fs" - require "luci.tools.status" + local fs = require "nixio.fs" + local util = require "luci.util" + local stat = require "luci.tools.status" - local has_ipv6 = luci.fs.access("/proc/net/ipv6_route") - local has_dhcp = luci.fs.access("/etc/config/dhcp") - local has_wifi = luci.fs.stat("/etc/config/wireless") - has_wifi = has_wifi and has_wifi.size > 0 + local has_ipv6 = fs.access("/proc/net/ipv6_route") + local has_dhcp = fs.access("/etc/config/dhcp") + local has_wifi = ((fs.stat("/etc/config/wireless", "size") or 0) > 0) local sysinfo = luci.util.ubus("system", "info") or { } local boardinfo = luci.util.ubus("system", "board") or { } @@ -35,7 +35,7 @@ You may obtain a copy of the License at free = 0 } - local has_dsl = luci.fs.stat("/etc/init.d/dsl_control") + local has_dsl = fs.access("/etc/init.d/dsl_control") if luci.http.formvalue("status") == "1" then local ntm = require "luci.model.network".init() @@ -60,9 +60,9 @@ You may obtain a copy of the License at swap = swapinfo, connmax = conn_max, conncount = conn_count, - leases = luci.tools.status.dhcp_leases(), - leases6 = luci.tools.status.dhcp6_leases(), - wifinets = luci.tools.status.wifi_networks() + leases = stat.dhcp_leases(), + leases6 = stat.dhcp6_leases(), + wifinets = stat.wifi_networks() } if wan then @@ -695,13 +695,10 @@ You may obtain a copy of the License at <% end %> <%- - require "luci.util" - require "nixio.fs" - - local plugins = nixio.fs.dir(luci.util.libpath() .. "/view/admin_status/index") - if plugins then + local incdir = util.libpath() .. "/view/admin_status/index/" + if fs.access(incdir) then local inc - for inc in plugins do + for inc in fs.dir(incdir) do if inc:match("%.htm$") then include("admin_status/index/" .. inc:gsub("%.htm$", "")) end diff --git a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm index 957604e8a..d6997f837 100644 --- a/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm +++ b/modules/luci-mod-admin-full/luasrc/view/admin_status/iptables.htm @@ -16,10 +16,10 @@ $Id$ <%- require "luci.sys.iptparser" - require "luci.tools.webadmin" - require "luci.fs" + local wba = require "luci.tools.webadmin" + local fs = require "nixio.fs" - local has_ip6tables = luci.fs.access("/usr/sbin/ip6tables") + local has_ip6tables = fs.access("/usr/sbin/ip6tables") local mode = 4 if has_ip6tables then @@ -28,7 +28,6 @@ $Id$ end local ipt = luci.sys.iptparser.IptParser(mode) - local wba = luci.tools.webadmin local rowcnt = 1 function rowstyle() |