HCoop
/
hcoop
/
domtool2.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f086616
)
Fixes to webbw while getting it parsed in the portal
author
Adam Chlipala
<adamc@hcoop.net>
Sun, 9 Dec 2007 19:26:33 +0000
(19:26 +0000)
committer
Adam Chlipala
<adamc@hcoop.net>
Sun, 9 Dec 2007 19:26:33 +0000
(19:26 +0000)
src/stats/webbw.sml
patch
|
blob
|
blame
|
history
diff --git
a/src/stats/webbw.sml
b/src/stats/webbw.sml
index
f180683
..
62ad65f
100644
(file)
--- a/
src/stats/webbw.sml
+++ b/
src/stats/webbw.sml
@@
-139,18
+139,28
@@
fun doit () =
groups
end handle ex => ref []
groups
end handle ex => ref []
+ fun sslTweak s =
+ case rev (String.tokens (fn ch => ch = #".") s) of
+ "ssl" :: rest =>
+ (case rev rest of
+ [] => raise Fail ("SSL goofyness: " ^ s)
+ | first :: rest => first ^ "_ssl." ^ String.concatWith "." rest)
+ | _ => s
+
fun addGroup (group, n, d, d') =
let
val groups' = if List.exists (fn ((x, _), _) => x = group) (!groups) then
fun addGroup (group, n, d, d') =
let
val groups' = if List.exists (fn ((x, _), _) => x = group) (!groups) then
- map (fn v as ((gr, ds), n') => if gr = group then ((gr, d
^ ":" ^ d'
:: ds), n + n') else v) (!groups)
+ map (fn v as ((gr, ds), n') => if gr = group then ((gr, d
' ^ "@" ^ d
:: ds), n + n') else v) (!groups)
else
else
- ((group, [d
^ ":" ^ d'
]), n) :: (!groups)
+ ((group, [d
' ^ "@" ^ d
]), n) :: (!groups)
in
groups := groups'
end
fun dodir {node, host} =
let
in
groups := groups'
end
fun dodir {node, host} =
let
+ val fullHost = host
+
val file = Config.Webalizer.outputDir ^ "/" ^ node ^ "/" ^ host ^ "/index.html"
in
if not (Posix.FileSys.access (file, [])) then
val file = Config.Webalizer.outputDir ^ "/" ^ node ^ "/" ^ host ^ "/index.html"
in
if not (Posix.FileSys.access (file, [])) then
@@
-192,20
+202,20
@@
fun doit () =
readEm ()
val ret = readEm ()
readEm ()
val ret = readEm ()
+
+ val tokens = String.tokens (fn ch => ch = #".") host
+ val (tokens, ssl) =
+ case rev tokens of
+ "ssl" :: tokens => (rev tokens, true)
+ | _ => (tokens, false)
+ val (host, tokens) =
+ case tokens of
+ host :: tokens => (host, tokens)
+ | _ => raise Fail "Host name too short"
val group =
if host <> Config.Webalizer.defaultHost then
let
val group =
if host <> Config.Webalizer.defaultHost then
let
- val tokens = String.tokens (fn ch => ch = #".") host
- val (tokens, ssl) =
- case rev tokens of
- "ssl" :: tokens => (rev tokens, true)
- | _ => (tokens, false)
- val (host, tokens) =
- case tokens of
- host :: tokens => (host, tokens)
- | _ => raise Fail "Host name too short"
-
val file = Config.resultRoot ^ "/" ^ node ^ "/" ^ String.concatWith "/" (rev tokens)
^ "/" ^ host ^ "." ^ String.concatWith "." tokens ^ ".vhost"
val file = if ssl then
val file = Config.resultRoot ^ "/" ^ node ^ "/" ^ String.concatWith "/" (rev tokens)
^ "/" ^ host ^ "." ^ String.concatWith "." tokens ^ ".vhost"
val file = if ssl then
@@
-229,7
+239,7
@@
fun doit () =
NONE
in
(case (ret, group) of
NONE
in
(case (ret, group) of
- (SOME ret, SOME group) => addGroup (group, ret, node,
h
ost)
+ (SOME ret, SOME group) => addGroup (group, ret, node,
sslTweak fullH
ost)
| _ => ());
TextIO.closeIn inf;
ret
| _ => ());
TextIO.closeIn inf;
ret
@@
-252,7
+262,7
@@
fun doit () =
| SOME d' =>
case dodir {node = d, host = d'} of
NONE => loop' L
| SOME d' =>
case dodir {node = d, host = d'} of
NONE => loop' L
- | SOME n => loop' (((d, d'), n) :: L)
+ | SOME n => loop' (((d,
sslTweak
d'), n) :: L)
val L =
if d = "main" then
val L =
if d = "main" then
@@
-263,7
+273,7
@@
fun doit () =
loop L
end
loop L
end
- fun sort ls = ListMergeSort.sort (fn ((_, n1), (_, n2)) => n1
>
n2) ls
+ fun sort ls = ListMergeSort.sort (fn ((_, n1), (_, n2)) => n1
<
n2) ls
val doms = loop []
val doms = sort doms
val doms = loop []
val doms = sort doms
@@
-272,7
+282,7
@@
fun doit () =
val sum = List.foldl (fn ((_, n), s) => s+n) 0 doms
in
print ("TOTAL: " ^ Int.toString sum ^ "\n\n");
val sum = List.foldl (fn ((_, n), s) => s+n) 0 doms
in
print ("TOTAL: " ^ Int.toString sum ^ "\n\n");
- List.app (fn ((
d, d'), n) => print (d ^ ":" ^ d'
^ ": " ^ Int.toString n ^ "\n")) doms;
+ List.app (fn ((
node, host), n) => print (host ^ "@" ^ node
^ ": " ^ Int.toString n ^ "\n")) doms;
print "\n";
List.app (fn ((d, ds), n) => print (d ^ "[" ^ String.concatWith "," ds ^ "]: " ^ Int.toString n ^ "\n")) groups;
Posix.FileSys.closedir dir
print "\n";
List.app (fn ((d, ds), n) => print (d ^ "[" ^ String.concatWith "," ds ^ "]: " ^ Int.toString n ^ "\n")) groups;
Posix.FileSys.closedir dir