diff options
author | Ted Trask <ttrask01@yahoo.com> | 2015-11-30 20:14:25 +0000 |
---|---|---|
committer | Ted Trask <ttrask01@yahoo.com> | 2015-11-30 20:14:25 +0000 |
commit | cd1bec6fa5a66d07319577965f5485fedcbf3fe7 (patch) | |
tree | 15760e0c181c1e793ec773459a37fe9f9fec922f /lbu-model.lua | |
parent | 228a648ef6b8931e575a78281678cfb887aab3ce (diff) | |
download | acf-alpine-conf-cd1bec6fa5a66d07319577965f5485fedcbf3fe7.tar.bz2 acf-alpine-conf-cd1bec6fa5a66d07319577965f5485fedcbf3fe7.tar.xz |
Modify listbackupfiles to report filedetails, not just a list
Diffstat (limited to 'lbu-model.lua')
-rw-r--r-- | lbu-model.lua | 25 |
1 files changed, 17 insertions, 8 deletions
diff --git a/lbu-model.lua b/lbu-model.lua index ac9f926..e06add2 100644 --- a/lbu-model.lua +++ b/lbu-model.lua @@ -156,6 +156,17 @@ local function validatefilecontent (filedetails) return success, filedetails end +local listbackupfiles = function() + local files = {} + local content = modelfunctions.run_executable({"lbu", "lb"}) + if not string.match(content, "usage: lbu") then + for line in string.gmatch(content, "([^\n]+)\n?") do + files[#files + 1] = line + end + end + return files +end + -- ################################################################################ -- PUBLIC FUNCTIONS @@ -365,20 +376,18 @@ end function mymodule.getbackupfiles() local files = {} - local content = modelfunctions.run_executable({"lbu", "lb"}) - if not string.match(content, "usage: lbu") then - for line in string.gmatch(content, "([^\n]+)\n?") do - files[#files + 1] = line - end + for i,file in ipairs(listbackupfiles()) do + local filedetails = posix.stat(file) + filedetails.filename = file + file[#files+1] = filedetails end - return cfe({ type="list", value=files, label="Backup Archives"}) + return cfe({ type="structure", value=files, label="Backup Archives"}) end function mymodule.get_selectbackup(self, clientdata) local result = {} result.backup = cfe({ type="select", value=clientdata.backup or "", label="Backup" }) - local files = mymodule.getbackupfiles() - result.backup.option = files.value + result.backup.option = listbackupfiles() return cfe({ type="group", value=result, label="Revert to Backup" }) end |