diff options
Diffstat (limited to 'gnats-model.lua')
-rw-r--r-- | gnats-model.lua | 29 |
1 files changed, 12 insertions, 17 deletions
diff --git a/gnats-model.lua b/gnats-model.lua index 28b9d9e..a39090c 100644 --- a/gnats-model.lua +++ b/gnats-model.lua @@ -7,9 +7,7 @@ require("date") require("getopts") require("format") require("posix") -require("daemoncontrol") require("validator") -require("socket") require("processinfo") -- Set variables @@ -304,14 +302,6 @@ end -- ################################################################################ -- PUBLIC FUNCTIONS -function startstop_service ( self, action ) - local cmd = action.value - local cmdresult,cmdmessage,cmderror,cmdaction = daemoncontrol.daemoncontrol(processname, cmd) - action.descr=cmdmessage - action.errtxt=cmderror - return cmdresult,action -end - function valid_filename(self, path) local files = {} recursedir(baseurl,files) @@ -344,7 +334,7 @@ function getstatus() status.configfiles.size = #status.configfiles.option status.numbugs = cfe({ name="numbugs", - label="Still not closed reports", + label="Number of open reports", value=get_various_info(), }) @@ -451,14 +441,19 @@ function get_filedetails(self,path) return true, file end function update_filecontent (self, modifications,path) - if not (valid_filename(self,path)) then - return false, {['errtxt'] = "Not a valid filename!"} + if not (fs.is_file(path)) then + return false, "Not a filename" end - local file_result,err = fs.write_file(path, format.dostounix(modifications)) - if (err) and (#err > 0) then - return false, err + if (valid_filename(self,path)) then + local file_result,err = fs.write_file(path, format.dostounix(modifications)) + if (err) and (#err > 0) then + return false, err + end + return true + else + return false, "Not a valid filename!" end - return true, file_result + return false, "Something went wrong!" end function sendbug (self, message) |