From: Steven Barth Date: Fri, 2 Jan 2009 21:33:10 +0000 (+0000) Subject: Use luci.fs.access instead of luci.fs.isfile where applicable X-Git-Tag: 0.9.0~835 X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fluci.git;a=commitdiff_plain;h=70ded13045e6b882859eeb0acb928eb8cacefd28 Use luci.fs.access instead of luci.fs.isfile where applicable --- diff --git a/applications/luci-ddns/luasrc/controller/ddns.lua b/applications/luci-ddns/luasrc/controller/ddns.lua index 0adc6abb5..6adbbb0ca 100644 --- a/applications/luci-ddns/luasrc/controller/ddns.lua +++ b/applications/luci-ddns/luasrc/controller/ddns.lua @@ -17,7 +17,7 @@ module("luci.controller.ddns", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("ddns") - if not luci.fs.isfile("/etc/config/ddns") then + if not luci.fs.access("/etc/config/ddns") then return end diff --git a/applications/luci-hd_idle/luasrc/controller/hd_idle.lua b/applications/luci-hd_idle/luasrc/controller/hd_idle.lua index 45d102cc1..5dfbe16ea 100644 --- a/applications/luci-hd_idle/luasrc/controller/hd_idle.lua +++ b/applications/luci-hd_idle/luasrc/controller/hd_idle.lua @@ -18,7 +18,7 @@ module("luci.controller.hd_idle", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("hd_idle") - if not luci.fs.isfile("/etc/config/hd-idle") then + if not luci.fs.access("/etc/config/hd-idle") then return end diff --git a/applications/luci-initmgr/luasrc/controller/init.lua b/applications/luci-initmgr/luasrc/controller/init.lua index aecf6c186..fbbc7270f 100644 --- a/applications/luci-initmgr/luasrc/controller/init.lua +++ b/applications/luci-initmgr/luasrc/controller/init.lua @@ -15,7 +15,7 @@ $Id$ module("luci.controller.init", package.seeall) function index() - if not luci.fs.isfile("/etc/rc.common") then + if not luci.fs.access("/etc/rc.common") then return end diff --git a/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua b/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua index ce244cb50..7beaa144f 100644 --- a/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua +++ b/applications/luci-mmc_over_gpio/luasrc/controller/mmc_over_gpio.lua @@ -18,7 +18,7 @@ module("luci.controller.mmc_over_gpio", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("mmc_over_gpio") - if not luci.fs.isfile("/etc/config/mmc_over_gpio") then + if not luci.fs.access("/etc/config/mmc_over_gpio") then return end diff --git a/applications/luci-ntpc/luasrc/controller/ntpc.lua b/applications/luci-ntpc/luasrc/controller/ntpc.lua index 8fa690f66..929064468 100644 --- a/applications/luci-ntpc/luasrc/controller/ntpc.lua +++ b/applications/luci-ntpc/luasrc/controller/ntpc.lua @@ -17,7 +17,7 @@ module("luci.controller.ntpc", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("ntpc") - if not luci.fs.isfile("/etc/config/ntpclient") then + if not luci.fs.access("/etc/config/ntpclient") then return end diff --git a/applications/luci-olsr/luasrc/controller/olsr.lua b/applications/luci-olsr/luasrc/controller/olsr.lua index 766107ee9..652f6b9d2 100644 --- a/applications/luci-olsr/luasrc/controller/olsr.lua +++ b/applications/luci-olsr/luasrc/controller/olsr.lua @@ -1,7 +1,7 @@ module("luci.controller.olsr", package.seeall) function index() - if not luci.fs.isfile("/etc/config/olsrd") then + if not luci.fs.access("/etc/config/olsrd") then return end diff --git a/applications/luci-p910nd/luasrc/controller/p910nd.lua b/applications/luci-p910nd/luasrc/controller/p910nd.lua index 8cc0e7197..75b2693d4 100644 --- a/applications/luci-p910nd/luasrc/controller/p910nd.lua +++ b/applications/luci-p910nd/luasrc/controller/p910nd.lua @@ -18,7 +18,7 @@ module("luci.controller.p910nd", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("p910nd") - if not luci.fs.isfile("/etc/config/p910nd") then + if not luci.fs.access("/etc/config/p910nd") then return end diff --git a/applications/luci-polipo/luasrc/controller/polipo.lua b/applications/luci-polipo/luasrc/controller/polipo.lua index c3965ee2e..949f80a62 100644 --- a/applications/luci-polipo/luasrc/controller/polipo.lua +++ b/applications/luci-polipo/luasrc/controller/polipo.lua @@ -14,7 +14,7 @@ $Id$ module("luci.controller.polipo", package.seeall) function index() - if not luci.fs.isfile("/etc/config/polipo") then + if not luci.fs.access("/etc/config/polipo") then return end diff --git a/applications/luci-qos/luasrc/controller/qos.lua b/applications/luci-qos/luasrc/controller/qos.lua index 5a9ef5e15..970dd3d60 100644 --- a/applications/luci-qos/luasrc/controller/qos.lua +++ b/applications/luci-qos/luasrc/controller/qos.lua @@ -14,7 +14,7 @@ $Id$ module("luci.controller.qos", package.seeall) function index() - if not luci.fs.isfile("/etc/config/qos") then + if not luci.fs.access("/etc/config/qos") then return end diff --git a/applications/luci-samba/luasrc/controller/samba.lua b/applications/luci-samba/luasrc/controller/samba.lua index a698777c2..75cb65a0b 100644 --- a/applications/luci-samba/luasrc/controller/samba.lua +++ b/applications/luci-samba/luasrc/controller/samba.lua @@ -15,7 +15,7 @@ $Id$ module("luci.controller.samba", package.seeall) function index() - if not luci.fs.isfile("/etc/config/samba") then + if not luci.fs.access("/etc/config/samba") then return end require("luci.i18n") diff --git a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua index 0aa66362b..940d2265c 100644 --- a/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua +++ b/applications/luci-statistics/luasrc/controller/luci_statistics/luci_statistics.lua @@ -32,7 +32,7 @@ function index() -- override entry(): check for existance .so where is derived from the called path function _entry( path, ... ) local file = path[5] or path[4] - if luci.fs.isfile( "/usr/lib/collectd/" .. file .. ".so" ) then + if luci.fs.access( "/usr/lib/collectd/" .. file .. ".so" ) then entry( path, ... ) end end diff --git a/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm b/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm index e29d97c9e..54ba2b0e2 100644 --- a/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm +++ b/applications/luci-statistics/luasrc/view/admin_statistics/networkplugins.htm @@ -22,7 +22,7 @@ about open tcp connections, interface traffic, iptables rules etc.%>

<%:stat_networkplugins_installed Installed network plugins:%>

    <% for plugin, desc in pairs(plugins) do %> - <% if luci.fs.isfile("/usr/lib/collectd/" .. plugin .. ".so") then %> + <% if luci.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
  • <%=desc%>
  • <% end %> <% end %> diff --git a/applications/luci-statistics/luasrc/view/admin_statistics/outputplugins.htm b/applications/luci-statistics/luasrc/view/admin_statistics/outputplugins.htm index d230109cc..e79e2f49f 100644 --- a/applications/luci-statistics/luasrc/view/admin_statistics/outputplugins.htm +++ b/applications/luci-statistics/luasrc/view/admin_statistics/outputplugins.htm @@ -23,7 +23,7 @@ and to transmit the data over the network to other collectd instances.%>

    <%:stat_outputplugins_installed Installed output plugins:%>

      <% for plugin, desc in pairs(plugins) do %> - <% if luci.fs.isfile("/usr/lib/collectd/" .. plugin .. ".so") then %> + <% if luci.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
    • <%=desc%>
    • <% end %> <% end %> diff --git a/applications/luci-statistics/luasrc/view/admin_statistics/systemplugins.htm b/applications/luci-statistics/luasrc/view/admin_statistics/systemplugins.htm index bb63228b6..0c1b2b52b 100644 --- a/applications/luci-statistics/luasrc/view/admin_statistics/systemplugins.htm +++ b/applications/luci-statistics/luasrc/view/admin_statistics/systemplugins.htm @@ -19,7 +19,7 @@ $Id$

      <%:stat_systemplugins_desc System plugins collecting values about system state and ressource usage on the device.:%>

        <% for plugin, desc in pairs(plugins) do %> - <% if luci.fs.isfile("/usr/lib/collectd/" .. plugin .. ".so") then %> + <% if luci.fs.access("/usr/lib/collectd/" .. plugin .. ".so") then %>
      • <%=desc%>
      • <% end %> <% end %> diff --git a/applications/luci-tinyproxy/luasrc/controller/tinyproxy.lua b/applications/luci-tinyproxy/luasrc/controller/tinyproxy.lua index 2ecfb9383..fb8d9e2b5 100644 --- a/applications/luci-tinyproxy/luasrc/controller/tinyproxy.lua +++ b/applications/luci-tinyproxy/luasrc/controller/tinyproxy.lua @@ -15,7 +15,7 @@ $Id$ module("luci.controller.tinyproxy", package.seeall) function index() - if not luci.fs.isfile("/etc/config/tinyproxy") then + if not luci.fs.access("/etc/config/tinyproxy") then return end diff --git a/applications/luci-upnp/luasrc/controller/upnp.lua b/applications/luci-upnp/luasrc/controller/upnp.lua index a7fd66fc1..c88abddc2 100644 --- a/applications/luci-upnp/luasrc/controller/upnp.lua +++ b/applications/luci-upnp/luasrc/controller/upnp.lua @@ -15,7 +15,7 @@ $Id$ module("luci.controller.upnp", package.seeall) function index() - if not luci.fs.isfile("/etc/config/upnpd") then + if not luci.fs.access("/etc/config/upnpd") then return end diff --git a/applications/luci-ushare/luasrc/controller/ushare.lua b/applications/luci-ushare/luasrc/controller/ushare.lua index 2fdea4e83..958f247d9 100644 --- a/applications/luci-ushare/luasrc/controller/ushare.lua +++ b/applications/luci-ushare/luasrc/controller/ushare.lua @@ -18,7 +18,7 @@ module("luci.controller.ushare", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("ushare") - if not luci.fs.isfile("/etc/config/ushare") then + if not luci.fs.access("/etc/config/ushare") then return end diff --git a/applications/luci-uvc_streamer/luasrc/controller/uvc_streamer.lua b/applications/luci-uvc_streamer/luasrc/controller/uvc_streamer.lua index 1766c2b11..64491dc9d 100644 --- a/applications/luci-uvc_streamer/luasrc/controller/uvc_streamer.lua +++ b/applications/luci-uvc_streamer/luasrc/controller/uvc_streamer.lua @@ -18,7 +18,7 @@ module("luci.controller.uvc_streamer", package.seeall) function index() require("luci.i18n") luci.i18n.loadc("uvc_streamer") - if not luci.fs.isfile("/etc/config/uvc-streamer") then + if not luci.fs.access("/etc/config/uvc-streamer") then return end diff --git a/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua b/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua index 3de871044..9a0282f3a 100644 --- a/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua +++ b/modules/admin-full/luasrc/model/cbi/admin_index/luci.lua @@ -28,7 +28,7 @@ l = c:option(ListValue, "lang", translate("language")) local i18ndir = luci.i18n.i18ndir .. "default." for k, v in pairs(luci.config.languages) do - if k:sub(1, 1) ~= "." and luci.fs.isfile(i18ndir .. k:gsub("_", "-") .. ".lua") then + if k:sub(1, 1) ~= "." and luci.fs.access(i18ndir .. k:gsub("_", "-") .. ".lua") then l:value(k, v) end end diff --git a/modules/admin-mini/luasrc/model/cbi/mini/luci.lua b/modules/admin-mini/luasrc/model/cbi/mini/luci.lua index f9365c906..819a9b64d 100644 --- a/modules/admin-mini/luasrc/model/cbi/mini/luci.lua +++ b/modules/admin-mini/luasrc/model/cbi/mini/luci.lua @@ -28,7 +28,7 @@ l = c:option(ListValue, "lang", translate("language")) local i18ndir = luci.i18n.i18ndir .. "default." for k, v in pairs(luci.config.languages) do - if k:sub(1, 1) ~= "." and luci.fs.isfile(i18ndir .. k:gsub("_", "-") .. ".lua") then + if k:sub(1, 1) ~= "." and luci.fs.access(i18ndir .. k:gsub("_", "-") .. ".lua") then l:value(k, v) end end diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua index 533211b00..ff739fd5f 100644 --- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua @@ -52,7 +52,7 @@ function index() assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, "OLSR", 30) - if luci.fs.isfile("/etc/config/luci_statistics") then + if luci.fs.access("/etc/config/luci_statistics") then assign({"freifunk", "graph"}, {"admin", "statistics", "graph"}, i18n("stat_statistics", "Statistiken"), 40) end