Multiple changes and improvements to the handling of users:
[cocanwiki.git] / scripts / rebuild_links.ml
index df3a707..354776a 100644 (file)
@@ -1,7 +1,7 @@
 (* COCANWIKI - a wiki written in Objective CAML.
  * Written by Richard W.M. Jones <rich@merjis.com>.
  * Copyright (C) 2004 Merjis Ltd.
- * $Id: rebuild_links.ml,v 1.1 2004/09/28 10:56:40 rich Exp $
+ * $Id: rebuild_links.ml,v 1.3 2004/10/23 12:00:24 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
@@ -63,14 +63,6 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
   q#header ();
   print_string r template_start#to_string;
 
-  let insert_link =
-    let sth =
-      dbh#prepare_cached "insert into links (hostid, from_url, to_url)
-                          values (?, ?, ?)" in
-    fun from_url to_url ->
-      sth#execute [`Int hostid; `String from_url; `String to_url]
-  in
-
   (* Process each section ... *)
   let i = ref 0 in
 
@@ -83,14 +75,14 @@ let run r (q : cgi) (dbh : Dbi.connection) hostid _ _ =
        print_string r template#to_string;
 
        let links = get_links_from_section dbh hostid content in
-       List.iter (insert_link url) links
+       List.iter (insert_link dbh hostid url) links
 
        | _ -> assert false);
 
   (* Finish off. *)
   dbh#commit ();
 
-  print_string r template_done#to_string
+  ignore (print_string r template_done#to_string)
 
 let () =
   register_script ~restrict:[CanManageSite] run