mirror of
https://github.com/Ysurac/openmptcprouter-feeds.git
synced 2025-03-09 15:40:03 +00:00
Add multiple backup on server support
This commit is contained in:
parent
da1744ae8a
commit
4a1ac7bbbb
3 changed files with 65 additions and 9 deletions
|
@ -1321,7 +1321,18 @@ end
|
|||
function backupgr()
|
||||
local get_backup = luci.http.formvalue("restore") or ""
|
||||
if get_backup ~= "" then
|
||||
luci.sys.call("/etc/init.d/openmptcprouter-vps backup_get >/dev/null 2>/dev/null")
|
||||
local dobackup = 0
|
||||
ucic:foreach("openmptcprouter","server", function(s)
|
||||
servername = s[".name"]
|
||||
local get_selected_backup = luci.http.formvalue(servername .. "") or ""
|
||||
if get_selected_backup ~= "" then
|
||||
dobackup = 1
|
||||
luci.sys.call("/etc/init.d/openmptcprouter-vps backup_get " .. servername .. " " .. get_selected_backup .. ">/dev/null 2>/dev/null")
|
||||
end
|
||||
end)
|
||||
if dobackup == 0 then
|
||||
luci.sys.call("/etc/init.d/openmptcprouter-vps backup_get >/dev/null 2>/dev/null")
|
||||
end
|
||||
end
|
||||
local send_backup = luci.http.formvalue("save") or ""
|
||||
if send_backup ~= "" then
|
||||
|
|
|
@ -16,10 +16,36 @@ menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter"
|
|||
%>
|
||||
<h3><%=servername%></h3>
|
||||
<%
|
||||
if luci.model.uci.cursor():get("openmptcprouter",servername,"lastbackup") ~= nil then
|
||||
if luci.model.uci.cursor():get("openmptcprouter",servername,"allbackup") ~= nil then
|
||||
%>
|
||||
<div class="cbi-section-node">
|
||||
<%:Last available backup on server:%> <%=os.date('%d-%b-%Y', luci.model.uci.cursor():get("openmptcprouter",servername,"lastbackup"))%>
|
||||
<div class="cbi-value">
|
||||
<label class="cbi-value-title"><%:Backup availables on server%></label>
|
||||
<div class="cbi-value-field">
|
||||
<select class="cbi-input-select" name="<%=servername%>-backup" size="1">
|
||||
<option value=""></option>
|
||||
<%
|
||||
lastmodif=""
|
||||
allbackup=luci.model.uci.cursor():get("openmptcprouter",servername,"allbackup")
|
||||
for _, backup in pairs(allbackup) do
|
||||
filemodif=split(backup, '|')
|
||||
if filemodif[2] ~= lastmodif then
|
||||
lastmodif=filemodif[2]
|
||||
%>
|
||||
<option value="<%=filemodif[1]%>"><%=os.date('%c',filemodif[2])%></option>
|
||||
<%
|
||||
end
|
||||
end
|
||||
%>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<%
|
||||
elseif luci.model.uci.cursor():get("openmptcprouter",servername,"lastbackup") ~= nil then
|
||||
%>
|
||||
<div class="cbi-section-node">
|
||||
<%:Last available backup on server:%> <%=os.date('%c', luci.model.uci.cursor():get("openmptcprouter",servername,"lastbackup"))%>
|
||||
</div>
|
||||
<% else %>
|
||||
<div class="cbi-section-node">
|
||||
|
@ -29,6 +55,7 @@ menuentry = ucic:get("openmptcprouter","settings","menu") or "openmptcprouter"
|
|||
<%
|
||||
end)
|
||||
%>
|
||||
<br/>
|
||||
<input type="submit" class="cbi-button cbi-button-action important" name="restore" value="<%:Restore backup%>"/>
|
||||
<input type="submit" class="cbi-button cbi-button-action important" name="save" value="<%:Send backup%>"/>
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue