|
|
@ -3536,40 +3536,48 @@ function inv.cli.backup.fn(name, line, wildcards)
|
|
|
|
|
|
|
|
|
|
|
|
if (not inv.init.initializedActive) then
|
|
|
|
if (not inv.init.initializedActive) then
|
|
|
|
dbot.info("Skipping backup request: plugin is not yet initialized (are you AFK or sleeping?)")
|
|
|
|
dbot.info("Skipping backup request: plugin is not yet initialized (are you AFK or sleeping?)")
|
|
|
|
return inv.tags.stop(invTagsBackup, line, DRL_RET_UNINITIALIZED)
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, DRL_RET_UNINITIALIZED)
|
|
|
|
elseif (dbot.gmcp.getState() ~= dbot.stateActive) then
|
|
|
|
|
|
|
|
dbot.info("Skipping backup request: character is not in the active state")
|
|
|
|
|
|
|
|
return inv.tags.stop(invTagsBackup, line, DRL_RET_NOT_ACTIVE)
|
|
|
|
|
|
|
|
end -- if
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (command == "on") then
|
|
|
|
elseif (command == "on") then
|
|
|
|
inv.config.table.isBackupEnabled = true
|
|
|
|
inv.config.table.isBackupEnabled = true
|
|
|
|
dbot.info("Automatic backups are @GENABLED@W")
|
|
|
|
dbot.info("Automatic backups are @GENABLED@W")
|
|
|
|
retval = inv.config.save()
|
|
|
|
retval = inv.config.save()
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, retval)
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, retval)
|
|
|
|
|
|
|
|
|
|
|
|
elseif (command == "off") then
|
|
|
|
elseif (command == "off") then
|
|
|
|
inv.config.table.isBackupEnabled = false
|
|
|
|
inv.config.table.isBackupEnabled = false
|
|
|
|
dbot.info("Automatic backups are @RDISABLED@W")
|
|
|
|
dbot.info("Automatic backups are @RDISABLED@W")
|
|
|
|
retval = inv.config.save()
|
|
|
|
retval = inv.config.save()
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, retval)
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, retval)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elseif (dbot.gmcp.getState() ~= dbot.stateActive) then
|
|
|
|
|
|
|
|
dbot.info("Skipping backup request: character is not in the active state")
|
|
|
|
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, DRL_RET_NOT_ACTIVE)
|
|
|
|
|
|
|
|
|
|
|
|
elseif (command == "list") then
|
|
|
|
elseif (command == "list") then
|
|
|
|
retval = dbot.backup.list(line)
|
|
|
|
retval = dbot.backup.list(line)
|
|
|
|
|
|
|
|
|
|
|
|
elseif (command == "create") and (backupName ~= "") then
|
|
|
|
elseif (command == "create") and (backupName ~= "") then
|
|
|
|
retval = dbot.backup.create(backupName, line)
|
|
|
|
retval = dbot.backup.create(backupName, line)
|
|
|
|
|
|
|
|
|
|
|
|
elseif (command == "delete") and (backupName ~= "") then
|
|
|
|
elseif (command == "delete") and (backupName ~= "") then
|
|
|
|
retval = dbot.backup.delete(backupName, line, false)
|
|
|
|
retval = dbot.backup.delete(backupName, line, false)
|
|
|
|
|
|
|
|
|
|
|
|
elseif (command == "restore") and (backupName ~= "") then
|
|
|
|
elseif (command == "restore") and (backupName ~= "") then
|
|
|
|
retval = dbot.backup.restore(backupName, line)
|
|
|
|
retval = dbot.backup.restore(backupName, line)
|
|
|
|
|
|
|
|
|
|
|
|
elseif (command == "auto") then -- Note: auto is a hidden mode and not included in the help file
|
|
|
|
elseif (command == "auto") then -- Note: auto is a hidden mode and not included in the help file
|
|
|
|
retval = dbot.backup.current()
|
|
|
|
retval = dbot.backup.current()
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
inv.cli.backup.usage()
|
|
|
|
inv.cli.backup.usage()
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, DRL_RET_INVALID_PARAM)
|
|
|
|
retval = inv.tags.stop(invTagsBackup, line, DRL_RET_INVALID_PARAM)
|
|
|
|
|
|
|
|
|
|
|
|
end -- if
|
|
|
|
end -- if
|
|
|
|
|
|
|
|
|
|
|
|
if (retval ~= DRL_RET_SUCCESS) then
|
|
|
|
if (retval ~= DRL_RET_SUCCESS) then
|
|
|
|
dbot.warn("inv.cli.backup.fn: Failed to perform backup request \"@Y" .. command .. " " .. backupName ..
|
|
|
|
dbot.debug("inv.cli.backup.fn: Unable to perform backup request \"@Y" .. command .. " " .. backupName ..
|
|
|
|
"@W\": " .. dbot.retval.getString(retval))
|
|
|
|
"@W\": " .. dbot.retval.getString(retval))
|
|
|
|
end -- if
|
|
|
|
end -- if
|
|
|
|
end -- inv.cli.backup.fn
|
|
|
|
end -- inv.cli.backup.fn
|
|
|
|
|
|
|
|
|
|
|
@ -16940,7 +16948,7 @@ function dbot.backup.current()
|
|
|
|
end -- if
|
|
|
|
end -- if
|
|
|
|
|
|
|
|
|
|
|
|
if (not inv.config.table.isBackupEnabled) then
|
|
|
|
if (not inv.config.table.isBackupEnabled) then
|
|
|
|
dbot.note("Automatic ackups are disabled")
|
|
|
|
dbot.note("Automatic backups are disabled")
|
|
|
|
return DRL_RET_SUCCESS
|
|
|
|
return DRL_RET_SUCCESS
|
|
|
|
end -- if
|
|
|
|
end -- if
|
|
|
|
|
|
|
|
|
|
|
|