(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: create_host.ml,v 1.7 2004/10/06 10:34:30 rich Exp $
+ * $Id: create_host.ml,v 1.8 2004/10/09 12:24:48 rich Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
else 0 in
let hostid = create_host dbh canonical_hostname hostnames template title
- "Administrator" "123456" true in
+ "Administrator" "123456" true None in
(* Commit to the database. *)
dbh#commit ();
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_create_host.ml,v 1.1 2004/10/06 10:34:29 rich Exp $
+ * $Id: cocanwiki_create_host.ml,v 1.2 2004/10/09 12:24:47 rich Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
open Printf
let create_host dbh canonical_hostname hostnames template
- title username password force_password_change =
+ title username password force_password_change email =
let sth =
dbh#prepare_cached "set constraints hosts_hostname_cn deferred" in
sth#execute [];
);
(* Create the administrator user. *)
+ let email = match email with Some e -> `String e | None -> `Null in
+
let sth = dbh#prepare_cached "insert into users (hostid, name, password,
- force_password_change, can_manage_users)
- values (?, ?, ?, ?,
- true)" in
+ force_password_change, email, can_manage_users)
+ values (?, ?, ?, ?, ?, true)" in
sth#execute [`Int hostid; `String username; `String password;
- `Bool force_password_change];
+ `Bool force_password_change; email];
hostid
(* COCANWIKI - a wiki written in Objective CAML.
* Written by Richard W.M. Jones <rich@merjis.com>.
* Copyright (C) 2004 Merjis Ltd.
- * $Id: cocanwiki_create_host.mli,v 1.1 2004/10/06 10:34:29 rich Exp $
+ * $Id: cocanwiki_create_host.mli,v 1.2 2004/10/09 12:24:48 rich Exp $
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
*)
val create_host : Dbi.connection -> string -> string list -> int ->
- string -> string -> string -> bool -> int
+ string -> string -> string -> bool -> string option -> int