mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
* src/mod_pubsub/mod_pubsub.erl: Fix update pubsub tables from
ejabberd 1.x to 2.x (EJAB-817) SVN Revision: 1734
This commit is contained in:
parent
867ce5be32
commit
8f43867091
@ -1,5 +1,8 @@
|
||||
2008-12-16 Badlop <badlop@process-one.net>
|
||||
|
||||
* src/mod_pubsub/mod_pubsub.erl: Fix update pubsub tables from
|
||||
ejabberd 1.x to 2.x (EJAB-817)
|
||||
|
||||
* doc/guide.tex: Fix capitalization of some section titles
|
||||
|
||||
* doc/guide.tex: Mention as optional Requirements: mysql, pgsql
|
||||
|
@ -241,7 +241,6 @@ update_database(Host) ->
|
||||
[host_node, host_parent, info] ->
|
||||
?INFO_MSG("upgrade pubsub tables",[]),
|
||||
F = fun() ->
|
||||
NewRecords =
|
||||
lists:foldl(
|
||||
fun({pubsub_node, NodeId, ParentId, {nodeinfo, Items, Options, Entities}}, RecList) ->
|
||||
ItemsList =
|
||||
@ -285,16 +284,23 @@ update_database(Host) ->
|
||||
RecList]
|
||||
end, [],
|
||||
mnesia:match_object(
|
||||
{pubsub_node, {Host, '_'}, '_', '_'})),
|
||||
mnesia:delete_table(pubsub_node),
|
||||
mnesia:create_table(pubsub_node,
|
||||
{pubsub_node, {Host, '_'}, '_', '_'}))
|
||||
end,
|
||||
{atomic, NewRecords} = mnesia:transaction(F),
|
||||
{atomic, ok} = mnesia:delete_table(pubsub_node),
|
||||
{atomic, ok} = mnesia:create_table(pubsub_node,
|
||||
[{disc_copies, [node()]},
|
||||
{attributes, record_info(fields, pubsub_node)}]),
|
||||
lists:foreach(fun(Record) ->
|
||||
FNew = fun() -> lists:foreach(fun(Record) ->
|
||||
mnesia:write(Record)
|
||||
end, NewRecords)
|
||||
end,
|
||||
mnesia:transaction(F);
|
||||
case mnesia:transaction(FNew) of
|
||||
{atomic, Result} ->
|
||||
?INFO_MSG("Pubsub tables updated correctly: ~p", [Result]);
|
||||
{aborted, Reason} ->
|
||||
?ERROR_MSG("Problem updating Pubsub tables:~n~p", [Reason])
|
||||
end;
|
||||
_ ->
|
||||
ok
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user