version 1.64, 2003/05/29 01:08:05
|
version 1.67, 2003/06/16 17:27:33
|
Line 84 my @Omit = ();
|
Line 84 my @Omit = ();
|
# ----------------------------- Handling routine called via Apache and mod_perl |
# ----------------------------- Handling routine called via Apache and mod_perl |
sub handler { |
sub handler { |
my $r = shift; |
my $r = shift; |
|
my $c = $r->connection(); |
$r->content_type('text/html'); |
$r->content_type('text/html'); |
&Apache::loncommon::no_cache($r); |
&Apache::loncommon::no_cache($r); |
$r->send_http_header; |
$r->send_http_header; |
return OK if $r->header_only; |
return OK if $r->header_only; |
$fnum=0; |
$fnum=0; |
$dnum=0; |
$dnum=0; |
untie %hash; |
|
|
|
# Deal with stupid global variables (is there a way around making |
# Deal with stupid global variables (is there a way around making |
# these global to this package? It is just so wrong....) |
# these global to this package? It is just so wrong....) |
Line 124 sub handler {
|
Line 124 sub handler {
|
|
|
$extrafield=''; |
$extrafield=''; |
my $diropendb = |
my $diropendb = |
"/home/httpd/perl/tmp/$domain\_$ENV{'user.name'}_indexer.db"; |
"/home/httpd/perl/tmp/$ENV{'user.domain'}_$ENV{'user.name'}_indexer.db"; |
|
%hash = (); |
|
my %dbfile; |
|
if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
|
while(my($key,$value)=each(%dbfile)) { |
|
$hash{$key}=$value; |
|
} |
|
untie(%dbfile); |
|
|
if (tie(%hash,'GDBM_File',$diropendb,&GDBM_WRCREAT(),0640)) { |
|
if ($ENV{'form.launch'} eq '1') { |
if ($ENV{'form.launch'} eq '1') { |
&start_fresh_session(); |
&start_fresh_session(); |
} |
} |
Line 493 END
|
Line 499 END
|
|
|
# --------------------------------------------------- end the output and return |
# --------------------------------------------------- end the output and return |
$r->print('</body></html>'."\n"); |
$r->print('</body></html>'."\n"); |
untie(%hash); |
|
} else { |
} else { |
$r->print('<html><head></head><body>Unable to tie hash to db '. |
$r->print('<html><head></head><body>Unable to tie hash to db '. |
'file</body></html>'); |
'file</body></html>'); |
return OK; |
return OK; |
} |
} |
|
if(! $c->aborted()) { |
|
if (tie(%dbfile,'GDBM_File',$diropendb,&GDBM_NEWDB(),0640)) { |
|
while (my($key,$value) = each(%hash)) { |
|
$dbfile{$key}=$value; |
|
} |
|
untie(%dbfile); |
|
} |
|
} |
|
|
return OK; |
return OK; |
} |
} |
|
|
# ----------------------------------------------- recursive scan of a directory |
# ----------------------------------------------- recursive scan of a directory |
sub scanDir { |
sub scanDir { |
my ($r,$startdir,$indent,$hashref)=@_; |
my ($r,$startdir,$indent,$hashref)=@_; |
|
my $c = $r->connection(); |
my ($compuri,$curdir); |
my ($compuri,$curdir); |
my $dirptr=16384; |
my $dirptr=16384; |
$indent++; |
$indent++; |
Line 512 sub scanDir {
|
Line 527 sub scanDir {
|
my %dupdirs = %dirs; |
my %dupdirs = %dirs; |
my @list=&get_list($r,$startdir); |
my @list=&get_list($r,$startdir); |
foreach my $line (@list) { |
foreach my $line (@list) { |
|
return if ($c->aborted()); |
my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); |
my ($strip,$dom,undef,$testdir,undef)=split(/\&/,$line,5); |
next if $strip =~ /.*\.meta$/; |
next if $strip =~ /.*\.meta$/; |
my (@fileparts) = split(/\./,$strip); |
my (@fileparts) = split(/\./,$strip); |
Line 948 sub setvalues {
|
Line 964 sub setvalues {
|
sub cleanup { |
sub cleanup { |
if (tied(%hash)){ |
if (tied(%hash)){ |
&Apache::lonnet::logthis('Cleanup indexer: hash'); |
&Apache::lonnet::logthis('Cleanup indexer: hash'); |
unless (untie(%hash)) { |
|
&Apache::lonnet::logthis('Failed cleanup indexer: hash'); |
|
} |
|
} |
} |
} |
} |
|
|