From d838a20f709408384d53cb0377891b89d2a76f94 Mon Sep 17 00:00:00 2001 From: Claudio Sacerdoti Coen Date: Fri, 19 Sep 2003 13:00:28 +0000 Subject: [PATCH] clean_cache method added --- helm/http_getter/http_getter.ml | 3 +++ helm/http_getter/http_getter_cache.ml | 7 +++++++ helm/http_getter/http_getter_cache.mli | 1 + helm/http_getter/http_getter_const.ml | 3 +++ 4 files changed, 14 insertions(+) diff --git a/helm/http_getter/http_getter.ml b/helm/http_getter/http_getter.ml index 0792d30b5..48c82f8ea 100644 --- a/helm/http_getter/http_getter.ml +++ b/helm/http_getter/http_getter.ml @@ -387,6 +387,9 @@ let callback (req: Http_types.request) outchan = register uri url; return_html_msg "Register done" outchan | _ -> assert false) + | "/clean_cache" -> + Http_getter_cache.clean (); + return_html_msg "Done." outchan | "/update" -> Http_getter_env.reload (); (* reload servers list from servers file *) let log = update_from_all_servers () in diff --git a/helm/http_getter/http_getter_cache.ml b/helm/http_getter/http_getter_cache.ml index 3cc9e4054..b77536f0c 100644 --- a/helm/http_getter/http_getter_cache.ml +++ b/helm/http_getter/http_getter_cache.ml @@ -201,4 +201,11 @@ let respond_dtd ?(enc = Enc_normal) ?(patch = true) ~url outchan = return_file ~fname:url ~contype:"text/plain" ~patch_fun outchan else return_html_error ("Can't find DTD: " ^ url) outchan +;; +let clean () = + let module E = Http_getter_env in + List.iter + (function dir -> ignore (Unix.system ("rm -rf " ^ dir ^ "/*")) + ) [E.cic_dir ; E.nuprl_dir ; E.rdf_dir ] +;; diff --git a/helm/http_getter/http_getter_cache.mli b/helm/http_getter/http_getter_cache.mli index a1acfca8c..9aa6e53a5 100644 --- a/helm/http_getter/http_getter_cache.mli +++ b/helm/http_getter/http_getter_cache.mli @@ -43,3 +43,4 @@ val respond_dtd: out_channel -> unit +val clean: unit -> unit diff --git a/helm/http_getter/http_getter_const.ml b/helm/http_getter/http_getter_const.ml index 71aed58d3..eefd7c865 100644 --- a/helm/http_getter/http_getter_const.ml +++ b/helm/http_getter/http_getter_const.ml @@ -79,6 +79,9 @@ let usage_string configuration =

update

+

+ clean_cache
+

getalluris

-- 2.39.2