mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-24 16:23:40 +01:00
Changed the place where database is created(thanks to Michael Remond)
SVN Revision: 2249
This commit is contained in:
parent
67570668b6
commit
20060d9cf6
@ -4,7 +4,7 @@
|
||||
%%% Purpose : Implements XMPP over BOSH (XEP-0205) (formerly known as
|
||||
%%% HTTP Binding)
|
||||
%%% Created : 21 Sep 2005 by Stefan Strigler <steve@zeank.in-berlin.de>
|
||||
%%% Id : $Id: ejabberd_http_bind.erl 917 2009-03-13 16:27:30Z badlop $
|
||||
%%% Id : $Id: ejabberd_http_bind.erl 942 2009-04-22 15:25:31Z mremond $
|
||||
%%%----------------------------------------------------------------------
|
||||
|
||||
-module(ejabberd_http_bind).
|
||||
@ -95,7 +95,6 @@
|
||||
%%% API
|
||||
%%%----------------------------------------------------------------------
|
||||
start(Sid, Key, IP) ->
|
||||
setup_database(),
|
||||
supervisor:start_child(ejabberd_http_bind_sup, [Sid, Key, IP]).
|
||||
|
||||
start_link(Sid, Key, IP) ->
|
||||
@ -1110,19 +1109,3 @@ check_default_xmlns({xmlelement, Name, Attrs, Els} = El) ->
|
||||
true ->
|
||||
El
|
||||
end.
|
||||
|
||||
setup_database() ->
|
||||
migrate_database(),
|
||||
mnesia:create_table(http_bind,
|
||||
[{ram_copies, [node()]},
|
||||
{attributes, record_info(fields, http_bind)}]).
|
||||
|
||||
migrate_database() ->
|
||||
case catch mnesia:table_info(http_bind, attributes) of
|
||||
[id, pid, to, hold, wait, version] ->
|
||||
ok;
|
||||
_ ->
|
||||
%% Since the stored information is not important, instead
|
||||
%% of actually migrating data, let's just destroy the table
|
||||
mnesia:delete_table(http_bind)
|
||||
end.
|
||||
|
@ -3,7 +3,7 @@
|
||||
%%% Author : Stefan Strigler <steve@zeank.in-berlin.de>
|
||||
%%% Purpose : Implementation of XMPP over BOSH (XEP-0206)
|
||||
%%% Created : Tue Feb 20 13:15:52 CET 2007
|
||||
%%% Id : $Id: mod_http_bind.erl 856 2009-01-13 17:11:02Z badlop $
|
||||
%%% Id : $Id: mod_http_bind.erl 942 2009-04-22 15:25:31Z mremond $
|
||||
%%%----------------------------------------------------------------------
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
@ -31,6 +31,9 @@
|
||||
-include("jlib.hrl").
|
||||
-include("ejabberd_http.hrl").
|
||||
|
||||
%% Duplicated from ejabberd_http_bind.
|
||||
%% TODO: move to hrl file.
|
||||
-record(http_bind, {id, pid, to, hold, wait, version}).
|
||||
|
||||
%%%----------------------------------------------------------------------
|
||||
%%% API
|
||||
@ -69,6 +72,7 @@ process(_Path, _Request) ->
|
||||
%%% BEHAVIOUR CALLBACKS
|
||||
%%%----------------------------------------------------------------------
|
||||
start(_Host, _Opts) ->
|
||||
setup_database(),
|
||||
HTTPBindSupervisor =
|
||||
{ejabberd_http_bind_sup,
|
||||
{ejabberd_tmp_sup, start_link,
|
||||
@ -96,3 +100,19 @@ stop(_Host) ->
|
||||
{error, Error} ->
|
||||
{'EXIT', {terminate_child_error, Error}}
|
||||
end.
|
||||
|
||||
setup_database() ->
|
||||
migrate_database(),
|
||||
mnesia:create_table(http_bind,
|
||||
[{ram_copies, [node()]},
|
||||
{attributes, record_info(fields, http_bind)}]).
|
||||
|
||||
migrate_database() ->
|
||||
case catch mnesia:table_info(http_bind, attributes) of
|
||||
[id, pid, to, hold, wait, version] ->
|
||||
ok;
|
||||
_ ->
|
||||
%% Since the stored information is not important, instead
|
||||
%% of actually migrating data, let's just destroy the table
|
||||
mnesia:delete_table(http_bind)
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user