143 |
143 |
144 -- save the datastore |
144 -- save the datastore |
145 local f, msg = io_open(getpath(username, host, datastore, nil, true), "w+"); |
145 local f, msg = io_open(getpath(username, host, datastore, nil, true), "w+"); |
146 if not f then |
146 if not f then |
147 log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil")); |
147 log("error", "Unable to write to "..datastore.." storage ('"..msg.."') for user: "..(username or "nil").."@"..(host or "nil")); |
148 return; |
148 return nil, "Error saving to storage"; |
149 end |
149 end |
150 f:write("return "); |
150 f:write("return "); |
151 append(f, data); |
151 append(f, data); |
152 f:close(); |
152 f:close(); |
153 if next(data) == nil then -- try to delete empty datastore |
153 if next(data) == nil then -- try to delete empty datastore |