* luci/app/statistics:

- build datatree from rrd directory structure, allows "virtual" plugins
	- flush index cache on statistics reload
	- whitespace cleanup in config generator
This commit is contained in:
Jo-Philipp Wich 2008-10-29 03:59:37 +00:00
parent 9f19574ae0
commit 0543ad6f4f
3 changed files with 34 additions and 19 deletions

View file

@ -59,13 +59,25 @@ function Instance._notzero( self, table )
end
function Instance._scan( self )
local dir = fs.dir( self._libdir )
if not dir then
local dirs = fs.dir( self:_mkpath() )
if not dirs then
return
end
for i, plugin in ipairs( dir ) do
if plugin:match("%w+.so") then
self._plugins[ plugin:gsub(".so", "") ] = { }
-- for i, plugin in ipairs( dirs ) do
-- if plugin:match("%w+.so") then
-- self._plugins[ plugin:gsub("%.so$", "") ] = { }
-- end
-- end
for _, dir in ipairs(dirs) do
if dir ~= "." and dir ~= ".." and
fs.stat(self:_mkpath(dir)).type == "directory"
then
local plugin = dir:gsub("%-.+$", "")
if not self._plugins[plugin] then
self._plugins[plugin] = { }
end
end
end

View file

@ -17,6 +17,9 @@ start() {
imagepath="$(uci get luci_statistics.rrdtool.image_path)"
ln -s ${imagepath:-/tmp/rrdimg}/ /www/rrdimg
fi
### flush LuCI index cache
test -f /var/luci-indexcache && rm /var/luci-indexcache
}
restart() {