Package: durep
Version: 0.8.1-6
Severity: wishlist
Tags: patch
Hi,
the attached patch splits the html pages into subdirs starting with the
first number of the node ID, this way you don't have a single directory
with tons of files.
thanks,
filippo
-- System Information:
Debian Release: testing/unstable
APT prefers unstable
APT policy: (600, 'unstable'), (550, 'experimental'), (450, 'breezy')
Architecture: powerpc (ppc)
Shell: /bin/sh linked to /bin/bash
Kernel: Linux 2.6.13
Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1)
Versions of packages durep depends on:
ii debconf [debconf-2.0] 1.4.58 Debian configuration management sy
ii perl 5.8.7-7 Larry Wall's Practical Extraction
durep recommends no packages.
-- debconf information:
durep/makereports: false
durep/filesystems: .
--- durep.orig 2005-10-28 17:04:07.000000000 +0200
+++ durep 2005-10-28 18:12:48.000000000 +0200
@@ -294,7 +294,7 @@
local *FILE;
my $this = $_[0];
- my $file = "$opt_webdir$idcount.html";
+ my $file = "$opt_webdir". file_from_id($idcount);
$depth_count++;
@@ -303,7 +303,7 @@
# Create the links for the preceding dirs
foreach $loop (@doodad) {
- $path .= sprintf("<a href='%d.html'>%s</a>%s", @$loop[1], @$loop[0],
+ $path .= sprintf("<a href='../%s'>%s</a>%s", file_from_id(@$loop[1]),
@$loop[0],
(@$loop[0] =~ m|/$|) ? "" : "/");
}
$path .= $this->{NAME};
@@ -357,7 +357,7 @@
print FILE "/" if defined $loop->{PATH};
}
else {
- print FILE "<b><a href='$idcount.html'>";
+ print FILE "<b><a href='../". file_from_id($idcount). "'>";
print FILE $loop->{NAME};
print FILE "/" if defined $loop->{PATH};
print FILE "</a></b>";
@@ -422,6 +422,16 @@
return $ret;
}
+sub file_from_id {
+ my $id = $_[0];
+ my $dir = substr($id,0,1);
+ my $file = "$dir/$id.html";
+
+# FIXME check umask
+ mkdir("$opt_webdir$dir") if ( ! -d "$opt_webdir$dir" );
+
+ return "$file";
+}
### Show all the options that we've used that influence the final output.
sub show_options {