mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-20 16:15:59 +01:00
* src/mod_configure.erl: Backup management support
* src/mod_disco.erl: Likewise SVN Revision: 81
This commit is contained in:
parent
c18826ad53
commit
764a4288ce
@ -1,3 +1,8 @@
|
||||
2003-02-22 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_configure.erl: Backup management support
|
||||
* src/mod_disco.erl: Likewise
|
||||
|
||||
2003-02-21 Alexey Shchepin <alexey@sevcom.net>
|
||||
|
||||
* src/mod_offline.erl: Now possible to unload this module
|
||||
|
@ -211,6 +211,60 @@ get_form(["running nodes", ENode, "modules", "start"], Lang) ->
|
||||
}
|
||||
]};
|
||||
|
||||
get_form(["running nodes", ENode, "backup", "backup"], Lang) ->
|
||||
{result, [{xmlelement, "title", [],
|
||||
[{xmlcdata,
|
||||
translate:translate(
|
||||
Lang, "Backup to File")}]},
|
||||
{xmlelement, "instructions", [],
|
||||
[{xmlcdata,
|
||||
translate:translate(
|
||||
Lang, "Enter path to backup file")}]},
|
||||
{xmlelement, "field", [{"type", "text-single"},
|
||||
{"label",
|
||||
translate:translate(
|
||||
Lang, "Path to File")},
|
||||
{"var", "path"}],
|
||||
[{xmlelement, "value", [], [{xmlcdata, ""}]}]
|
||||
}
|
||||
]};
|
||||
|
||||
get_form(["running nodes", ENode, "backup", "restore"], Lang) ->
|
||||
{result, [{xmlelement, "title", [],
|
||||
[{xmlcdata,
|
||||
translate:translate(
|
||||
Lang, "Restore Backup from File")}]},
|
||||
{xmlelement, "instructions", [],
|
||||
[{xmlcdata,
|
||||
translate:translate(
|
||||
Lang, "Enter path to backup file")}]},
|
||||
{xmlelement, "field", [{"type", "text-single"},
|
||||
{"label",
|
||||
translate:translate(
|
||||
Lang, "Path to File")},
|
||||
{"var", "path"}],
|
||||
[{xmlelement, "value", [], [{xmlcdata, ""}]}]
|
||||
}
|
||||
]};
|
||||
|
||||
get_form(["running nodes", ENode, "backup", "textfile"], Lang) ->
|
||||
{result, [{xmlelement, "title", [],
|
||||
[{xmlcdata,
|
||||
translate:translate(
|
||||
Lang, "Dump Backup to Text File")}]},
|
||||
{xmlelement, "instructions", [],
|
||||
[{xmlcdata,
|
||||
translate:translate(
|
||||
Lang, "Enter path to text file")}]},
|
||||
{xmlelement, "field", [{"type", "text-single"},
|
||||
{"label",
|
||||
translate:translate(
|
||||
Lang, "Path to File")},
|
||||
{"var", "path"}],
|
||||
[{xmlelement, "value", [], [{xmlcdata, ""}]}]
|
||||
}
|
||||
]};
|
||||
|
||||
get_form(["running nodes", ENode, "import", "file"], Lang) ->
|
||||
{result, [{xmlelement, "title", [],
|
||||
[{xmlcdata,
|
||||
@ -428,6 +482,76 @@ set_form(["running nodes", ENode, "modules", "start"], Lang, XData) ->
|
||||
end;
|
||||
|
||||
|
||||
set_form(["running nodes", ENode, "backup", "backup"], Lang, XData) ->
|
||||
case search_running_node(ENode) of
|
||||
false ->
|
||||
{error, "404", "Not Found"};
|
||||
Node ->
|
||||
case lists:keysearch("path", 1, XData) of
|
||||
false ->
|
||||
{error, "406", "Not Acceptable"};
|
||||
{value, {_, [String]}} ->
|
||||
case rpc:call(Node, mnesia, backup, [String]) of
|
||||
{badrpc, Reason} ->
|
||||
{error, "500", "Internal Server Error"};
|
||||
{error, Reason} ->
|
||||
{error, "500", "Internal Server Error"};
|
||||
_ ->
|
||||
{result, []}
|
||||
end;
|
||||
_ ->
|
||||
{error, "406", "Not Acceptable"}
|
||||
end
|
||||
end;
|
||||
|
||||
|
||||
set_form(["running nodes", ENode, "backup", "restore"], Lang, XData) ->
|
||||
case search_running_node(ENode) of
|
||||
false ->
|
||||
{error, "404", "Not Found"};
|
||||
Node ->
|
||||
case lists:keysearch("path", 1, XData) of
|
||||
false ->
|
||||
{error, "406", "Not Acceptable"};
|
||||
{value, {_, [String]}} ->
|
||||
case rpc:call(Node, mnesia, restore,
|
||||
[String, [{default_op, keep_tables}]]) of
|
||||
{badrpc, Reason} ->
|
||||
{error, "500", "Internal Server Error"};
|
||||
{error, Reason} ->
|
||||
{error, "500", "Internal Server Error"};
|
||||
_ ->
|
||||
{result, []}
|
||||
end;
|
||||
_ ->
|
||||
{error, "406", "Not Acceptable"}
|
||||
end
|
||||
end;
|
||||
|
||||
|
||||
set_form(["running nodes", ENode, "backup", "textfile"], Lang, XData) ->
|
||||
case search_running_node(ENode) of
|
||||
false ->
|
||||
{error, "404", "Not Found"};
|
||||
Node ->
|
||||
case lists:keysearch("path", 1, XData) of
|
||||
false ->
|
||||
{error, "406", "Not Acceptable"};
|
||||
{value, {_, [String]}} ->
|
||||
case rpc:call(Node, mnesia, dump_to_textfile, [String]) of
|
||||
{badrpc, Reason} ->
|
||||
{error, "500", "Internal Server Error"};
|
||||
{error, Reason} ->
|
||||
{error, "500", "Internal Server Error"};
|
||||
_ ->
|
||||
{result, []}
|
||||
end;
|
||||
_ ->
|
||||
{error, "406", "Not Acceptable"}
|
||||
end
|
||||
end;
|
||||
|
||||
|
||||
set_form(["running nodes", ENode, "import", "file"], Lang, XData) ->
|
||||
case search_running_node(ENode) of
|
||||
false ->
|
||||
@ -437,7 +561,8 @@ set_form(["running nodes", ENode, "import", "file"], Lang, XData) ->
|
||||
false ->
|
||||
{error, "406", "Not Acceptable"};
|
||||
{value, {_, [String]}} ->
|
||||
rpc:call(Node, jd2ejd, import_file, [String]);
|
||||
rpc:call(Node, jd2ejd, import_file, [String]),
|
||||
{result, []};
|
||||
_ ->
|
||||
{error, "406", "Not Acceptable"}
|
||||
end
|
||||
|
@ -133,6 +133,11 @@ process_local_iq_info(From, To, {iq, ID, Type, XMLNS, SubEl}) ->
|
||||
{iq, ID, result, XMLNS,
|
||||
[{xmlelement, "query", [{"xmlns", XMLNS}],
|
||||
[feature_to_xml({?NS_XDATA})]}]};
|
||||
["running nodes", ENode, "backup"] -> ?EMPTY_INFO_RESULT;
|
||||
["running nodes", ENode, "backup", _] ->
|
||||
{iq, ID, result, XMLNS,
|
||||
[{xmlelement, "query", [{"xmlns", XMLNS}],
|
||||
[feature_to_xml({?NS_XDATA})]}]};
|
||||
["running nodes", ENode, "import"] -> ?EMPTY_INFO_RESULT;
|
||||
["running nodes", ENode, "import", _] ->
|
||||
{iq, ID, result, XMLNS,
|
||||
@ -236,6 +241,7 @@ get_local_items(["running nodes", ENode], Server, Lang) ->
|
||||
{result,
|
||||
[?NODE("DB", "running nodes/" ++ ENode ++ "/DB"),
|
||||
?NODE("Modules", "running nodes/" ++ ENode ++ "/modules"),
|
||||
?NODE("Backup Management", "running nodes/" ++ ENode ++ "/backup"),
|
||||
?NODE("Import users from jabberd1.4 spool files",
|
||||
"running nodes/" ++ ENode ++ "/import")
|
||||
]};
|
||||
@ -252,6 +258,17 @@ get_local_items(["running nodes", ENode, "modules"], Server, Lang) ->
|
||||
get_local_items(["running nodes", ENode, "modules", _], Server, Lang) ->
|
||||
{result, []};
|
||||
|
||||
get_local_items(["running nodes", ENode, "backup"], Server, Lang) ->
|
||||
{result,
|
||||
[?NODE("Backup", "running nodes/" ++ ENode ++ "/backup/backup"),
|
||||
?NODE("Restore", "running nodes/" ++ ENode ++ "/backup/restore"),
|
||||
?NODE("Dump to Text File",
|
||||
"running nodes/" ++ ENode ++ "/backup/textfile")
|
||||
]};
|
||||
|
||||
get_local_items(["running nodes", ENode, "backup", _], Server, Lang) ->
|
||||
{result, []};
|
||||
|
||||
get_local_items(["running nodes", ENode, "import"], Server, Lang) ->
|
||||
{result,
|
||||
[?NODE("Import File", "running nodes/" ++ ENode ++ "/import/file"),
|
||||
|
Loading…
Reference in New Issue
Block a user