File:  [LON-CAPA] / loncom / metadata_database / searchcat.pl
Revision 1.53: download - view: text, annotated - select for diffs
Sat Dec 27 23:04:28 2003 UTC (20 years, 4 months ago) by www
Branches: MAIN
CVS tags: HEAD
Bugs #789 and 1926: Trying to make new fields searchable, just saving my work.

    1: #!/usr/bin/perl
    2: # The LearningOnline Network
    3: # searchcat.pl "Search Catalog" batch script
    4: #
    5: # $Id: searchcat.pl,v 1.53 2003/12/27 23:04:28 www Exp $
    6: #
    7: # Copyright Michigan State University Board of Trustees
    8: #
    9: # This file is part of the LearningOnline Network with CAPA (LON-CAPA).
   10: #
   11: # LON-CAPA is free software; you can redistribute it and/or modify
   12: # it under the terms of the GNU General Public License as published by
   13: # the Free Software Foundation; either version 2 of the License, or
   14: # (at your option) any later version.
   15: #
   16: # LON-CAPA is distributed in the hope that it will be useful,
   17: # but WITHOUT ANY WARRANTY; without even the implied warranty of
   18: # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   19: # GNU General Public License for more details.
   20: #
   21: # You should have received a copy of the GNU General Public License
   22: # along with LON-CAPA; if not, write to the Free Software
   23: # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
   24: #
   25: # /home/httpd/html/adm/gpl.txt
   26: #
   27: # http://www.lon-capa.org/
   28: #
   29: ###
   30: 
   31: =pod
   32: 
   33: =head1 NAME
   34: 
   35: B<searchcat.pl> - put authoritative filesystem data into sql database.
   36: 
   37: =head1 SYNOPSIS
   38: 
   39: Ordinarily this script is to be called from a loncapa cron job
   40: (CVS source location: F<loncapa/loncom/cron/loncapa>; typical
   41: filesystem installation location: F</etc/cron.d/loncapa>).
   42: 
   43: Here is the cron job entry.
   44: 
   45: C<# Repopulate and refresh the metadata database used for the search catalog.>
   46: C<10 1 * * 7    www    /home/httpd/perl/searchcat.pl>
   47: 
   48: This script only allows itself to be run as the user C<www>.
   49: 
   50: =head1 DESCRIPTION
   51: 
   52: This script goes through a loncapa resource directory and gathers metadata.
   53: The metadata is entered into a SQL database.
   54: 
   55: This script also does general database maintenance such as reformatting
   56: the C<loncapa:metadata> table if it is deprecated.
   57: 
   58: This script evaluates dynamic metadata from the authors'
   59: F<nohist_resevaldata.db> database file in order to store it in MySQL.
   60: 
   61: This script is playing an increasingly important role for a loncapa
   62: library server.  The proper operation of this script is critical for a smooth
   63: and correct user experience.
   64: 
   65: =cut
   66: 
   67: use strict;
   68: 
   69: use lib '/home/httpd/lib/perl/';
   70: use LONCAPA::Configuration;
   71: 
   72: use IO::File;
   73: use HTML::TokeParser;
   74: use DBI;
   75: use GDBM_File;
   76: use POSIX qw(strftime mktime);
   77: 
   78: require "find.pl";
   79: 
   80: my @metalist;
   81: 
   82: my $simplestatus='';
   83: my %countext=();
   84: 
   85: # ----------------------------------------------------- write out simple status
   86: sub writesimple {
   87:     open(SMP,'>/home/httpd/html/lon-status/mysql.txt');
   88:     print SMP $simplestatus."\n";
   89:     close(SMP);
   90: }
   91: 
   92: sub writecount {
   93:     open(RSMP,'>/home/httpd/html/lon-status/rescount.txt');
   94:     foreach (keys %countext) {
   95: 	print RSMP $_.'='.$countext{$_}.'&';
   96:     }
   97:     print RSMP 'time='.time."\n";
   98:     close(RSMP);
   99: }
  100: 
  101: # -------------------------------------- counts files with different extensions
  102: sub count {
  103:     my $file=shift;
  104:     $file=~/\.(\w+)$/;
  105:     my $ext=lc($1);
  106:     if (defined($countext{$ext})) {
  107: 	$countext{$ext}++;
  108:     } else {
  109: 	$countext{$ext}=1;
  110:     }
  111: }
  112: # ----------------------------------------------------- Un-Escape Special Chars
  113: 
  114: sub unescape {
  115:     my $str=shift;
  116:     $str =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg;
  117:     return $str;
  118: }
  119: 
  120: # -------------------------------------------------------- Escape Special Chars
  121: 
  122: sub escape {
  123:     my $str=shift;
  124:     $str =~ s/(\W)/"%".unpack('H2',$1)/eg;
  125:     return $str;
  126: }
  127: 
  128: # ------------------------------------------- Code to evaluate dynamic metadata
  129: 
  130: sub dynamicmeta {
  131:     my $url=&declutter(shift);
  132:     $url=~s/\.meta$//;
  133:     my %returnhash=(
  134: 		    'count' => 0,
  135: 		    'course' => 0,
  136: 		    'course_list' => '',
  137: 		    'avetries' => 'NULL',
  138: 		    'avetries_list' => '',
  139: 		    'stdno' => 0,
  140: 		    'stdno_list' => '',
  141: 		    'usage' => 0,
  142: 		    'usage_list' => '',
  143: 		    'goto' => 0,
  144: 		    'goto_list' => '',
  145: 		    'comefrom' => 0,
  146: 		    'comefrom_list' => '',
  147: 		    'difficulty' => 'NULL',
  148: 		    'difficulty_list' => '',
  149:                     'clear' => 'NULL',
  150:                     'technical' => 'NULL',
  151: 		    'correct' => 'NULL',
  152: 		    'helpful' => 'NULL',
  153: 		    'depth' => 'NULL',
  154: 		    'comments' => ''
  155: 		    );
  156:     my ($adomain,$aauthor)=($url=~/^(\w+)\/(\w+)\//);
  157:     my $prodir=&propath($adomain,$aauthor);
  158: 
  159: # Get metadata except counts
  160:     if (tie(my %evaldata,'GDBM_File',
  161:             $prodir.'/nohist_resevaldata.db',&GDBM_READER(),0640)) {
  162: 	my %sum=();
  163: 	my %cnt=();
  164: 	my %concat=();
  165: 	my %listitems=(
  166: 		       'course'       => 'add',
  167: 		       'goto'         => 'add',
  168: 		       'comefrom'     => 'add',
  169: 		       'avetries'     => 'avg',
  170: 		       'stdno'        => 'add',
  171: 		       'difficulty'   => 'avg',
  172: 		       'clear'        => 'avg',
  173: 		       'technical'    => 'avg',
  174: 		       'helpful'      => 'avg',
  175: 		       'correct'      => 'avg',
  176: 		       'depth'        => 'avg',
  177: 		       'comments'     => 'app',
  178: 		       'usage'        => 'cnt'
  179: 		       );
  180: 	
  181: 	my $regexp=$url;
  182: 	$regexp=~s/(\W)/\\$1/g;
  183: 	$regexp='___'.$regexp.'___([a-z]+)$';
  184: 	while (my ($esckey,$value)=each %evaldata) {
  185: 	    my $key=&unescape($esckey);
  186: 	    if ($key=~/$regexp/) {
  187: 		my ($item,$purl,$cat)=split(/___/,$key);
  188: 		if (defined($cnt{$cat})) { $cnt{$cat}++; } else { $cnt{$cat}=1; }
  189: 		unless ($listitems{$cat} eq 'app') {
  190: 		    if (defined($sum{$cat})) {
  191: 			$sum{$cat}+=&unescape($evaldata{$esckey});
  192: 			$concat{$cat}.=','.$item;
  193: 		    } else {
  194: 			$sum{$cat}=&unescape($evaldata{$esckey});
  195: 			$concat{$cat}=$item;
  196: 		    }
  197: 		} else {
  198: 		    if (defined($sum{$cat})) {
  199: 			if ($evaldata{$esckey}=~/\w/) {
  200: 			    $sum{$cat}.='<hr />'.&unescape($evaldata{$esckey});
  201: 			}
  202: 		    } else {
  203: 			$sum{$cat}=''.&unescape($evaldata{$esckey});
  204: 		    }
  205: 		}
  206: 	    }
  207: 	}
  208: 	untie(%evaldata);
  209: # transfer gathered data to returnhash, calculate averages where applicable
  210: 	while (my $cat=each(%cnt)) {
  211: 	    if ($cnt{$cat} eq 'nan') { next; }
  212: 	    if ($sum{$cat} eq 'nan') { next; }
  213: 	    if ($listitems{$cat} eq 'avg') {
  214: 		if ($cnt{$cat}) {
  215: 		    $returnhash{$cat}=int(($sum{$cat}/$cnt{$cat})*100.0+0.5)/100.0;
  216: 		} else {
  217: 		    $returnhash{$cat}='NULL';
  218: 		}
  219: 	    } elsif ($listitems{$cat} eq 'cnt') {
  220: 		$returnhash{$cat}=$cnt{$cat};
  221: 	    } else {
  222: 		$returnhash{$cat}=$sum{$cat};
  223: 	    }
  224: 	    $returnhash{$cat.'_list'}=$concat{$cat};
  225: 	}
  226:     }
  227: # get count
  228:     if (tie(my %evaldata,'GDBM_File',
  229:             $prodir.'/nohist_accesscount.db',&GDBM_READER(),0640)) {
  230: 	my $escurl=&escape($url);
  231: 	if (! exists($evaldata{$escurl})) {
  232: 	    $returnhash{'count'}=0;
  233: 	} else {
  234: 	    $returnhash{'count'}=$evaldata{$escurl};
  235: 	}
  236: 	untie %evaldata;
  237:     }
  238:     return %returnhash;
  239: }
  240:   
  241: # ---------------  Read loncapa_apache.conf and loncapa.conf and get variables
  242: my $perlvarref=LONCAPA::Configuration::read_conf('loncapa.conf');
  243: my %perlvar=%{$perlvarref};
  244: undef $perlvarref;
  245: delete $perlvar{'lonReceipt'}; # remove since sensitive and not needed
  246: 
  247: # ------------------------------------- Only run if machine is a library server
  248: exit unless $perlvar{'lonRole'} eq 'library';
  249: 
  250: # ----------------------------- Make sure this process is running from user=www
  251: 
  252: my $wwwid=getpwnam('www');
  253: if ($wwwid!=$<) {
  254:     my $emailto="$perlvar{'lonAdmEMail'},$perlvar{'lonSysEMail'}";
  255:     my $subj="LON: $perlvar{'lonHostID'} User ID mismatch";
  256:     system("echo 'User ID mismatch. searchcat.pl must be run as user www.' |\
  257:  mailto $emailto -s '$subj' > /dev/null");
  258:     exit 1;
  259: }
  260: 
  261: 
  262: # ---------------------------------------------------------- We are in business
  263: 
  264: open(LOG,'>'.$perlvar{'lonDaemons'}.'/logs/searchcat.log');
  265: print LOG '==== Searchcat Run '.localtime()."====\n\n";
  266: $simplestatus='time='.time.'&';
  267: my $dbh;
  268: # ------------------------------------- Make sure that database can be accessed
  269: {
  270:     unless (
  271: 	    $dbh = DBI->connect("DBI:mysql:loncapa","www",$perlvar{'lonSqlAccess'},{ RaiseError =>0,PrintError=>0})
  272: 	    ) { 
  273: 	print LOG "Cannot connect to database!\n";
  274: 	$simplestatus.='mysql=defunct';
  275: 	&writesimple();
  276: 	exit;
  277:     }
  278: 
  279: # Make temporary table
  280:     $dbh->do("DROP TABLE IF EXISTS newmetadata");
  281:     my $make_metadata_table = "CREATE TABLE IF NOT EXISTS newmetadata (".
  282:         "title TEXT, author TEXT, subject TEXT, url TEXT, keywords TEXT, ".
  283:         "version TEXT, notes TEXT, abstract TEXT, mime TEXT, language TEXT, ".
  284:         "creationdate DATETIME, lastrevisiondate DATETIME, owner TEXT, ".
  285:         "copyright TEXT, dependencies TEXT, ".
  286: 	"modifyinguser TEXT, authorspace TEXT, ".
  287: 	"lowestgradelevel INTEGER UNSIGNED, highestgradelevel INTEGER UNSIGNED, ".
  288: 	"standards TEXT, ".
  289:         "count INTEGER UNSIGNED, ".
  290:         "course INTEGER UNSIGNED, course_list TEXT, ".
  291:         "goto INTEGER UNSIGNED, goto_list TEXT, ".
  292:         "comefrom INTEGER UNSIGNED, comefrom_list TEXT, ".
  293:         "sequsage INTEGER UNSIGNED, sequsage_list TEXT, ".
  294:         "stdno INTEGER UNSIGNED, stdno_list TEXT, ".
  295: 	"avetries FLOAT, avetries_list TEXT, ".
  296:         "difficulty FLOAT, difficulty_list TEXT, ".
  297: 	"clear FLOAT, technical FLOAT, correct FLOAT, helpful FLOAT, depth FLOAT, ".
  298: 	"comments TEXT, ".
  299: # For backward compatibility, only insert new fields below
  300: # ...
  301: # For backward compatibility, end new fields above
  302:         "FULLTEXT idx_title (title), ".
  303:         "FULLTEXT idx_author (author), FULLTEXT idx_subject (subject), ".
  304:         "FULLTEXT idx_url (url), FULLTEXT idx_keywords (keywords), ".
  305:         "FULLTEXT idx_notes (notes), ".
  306:         "FULLTEXT idx_abstract (abstract), FULLTEXT idx_mime (mime), ".
  307:         "FULLTEXT idx_owner (owner), ".
  308: 	"FULLTEXT idx_standards (standards))".
  309:         "TYPE=MyISAM";
  310:     # It would sure be nice to have some logging mechanism.
  311:     unless ($dbh->do($make_metadata_table)) {
  312: 	print LOG "\nMySQL Error Create: ".$dbh->errstr."\n";
  313: 	die $dbh->errstr;
  314:     }
  315: }
  316: 
  317: # ------------------------------------------------------------- get .meta files
  318: opendir(RESOURCES,"$perlvar{'lonDocRoot'}/res/$perlvar{'lonDefDomain'}");
  319: my @homeusers = grep {
  320:     &ishome("$perlvar{'lonDocRoot'}/res/$perlvar{'lonDefDomain'}/$_")
  321:     } grep {!/^\.\.?$/} readdir(RESOURCES);
  322: closedir RESOURCES;
  323: 
  324: #
  325: # Create the statement handlers we need
  326: 
  327: my $insert_sth = $dbh->prepare
  328:     ("INSERT INTO newmetadata VALUES (".
  329:      "?,".   # title
  330:      "?,".   # author
  331:      "?,".   # subject
  332:      "?,".   # declutter url
  333:      "?,".   # version
  334:      "?,".   # current
  335:      "?,".   # notes
  336:      "?,".   # abstract
  337:      "?,".   # mime
  338:      "?,".   # language
  339:      "?,".   # creationdate
  340:      "?,".   # revisiondate
  341:      "?,".   # owner
  342:      "?,".   # copyright
  343:      "?,".   # dependencies
  344:      "?,".   # modifyinguser
  345:      "?,".   # authorspace
  346:      "?,".   # lowestgradelevel
  347:      "?,".   # highestgradelevel
  348:      "?,".   # standards
  349:      "?,".   # count
  350:      "?,".   # course
  351:      "?,".   # course_list
  352:      "?,".   # goto
  353:      "?,".   # goto_list
  354:      "?,".   # comefrom
  355:      "?,".   # comefrom_list
  356:      "?,".   # usage
  357:      "?,".   # usage_list
  358:      "?,".   # stdno
  359:      "?,".   # stdno_list
  360:      "?,".   # avetries
  361:      "?,".   # avetries_list
  362:      "?,".   # difficulty
  363:      "?,".   # difficulty_list
  364:      "?,".   # clear
  365:      "?,".   # technical
  366:      "?,".   # correct
  367:      "?,".   # helpful
  368:      "?,".   # depth
  369:      "?".    # comments
  370:      ")"
  371:      );
  372: 
  373: foreach my $user (@homeusers) {
  374:     print LOG "\n=== User: ".$user."\n\n";
  375: 
  376:     my $prodir=&propath($perlvar{'lonDefDomain'},$user);
  377:     # Use find.pl
  378:     undef @metalist;
  379:     @metalist=();
  380:     &find("$perlvar{'lonDocRoot'}/res/$perlvar{'lonDefDomain'}/$user");
  381:     # -- process each file to get metadata and put into search catalog SQL
  382:     # database.  Also, check to see if already there.
  383:     # I could just delete (without searching first), but this works for now.
  384:     foreach my $m (@metalist) {
  385:         print LOG "- ".$m."\n";
  386:         my $ref=&metadata($m);
  387:         my $m2='/res/'.&declutter($m);
  388:         $m2=~s/\.meta$//;
  389:  	if ($ref->{'obsolete'}) { print LOG "obsolete\n"; next; }
  390: 	if ($ref->{'copyright'} eq 'private') { print LOG "private\n"; next; }
  391:         my %dyn=&dynamicmeta($m2);
  392: 	&count($m2);
  393:         unless ($insert_sth->execute(
  394: 			     $ref->{'title'},
  395:                              $ref->{'author'},
  396:                              $ref->{'subject'},
  397:                              $m2,
  398:                              $ref->{'keywords'},
  399:                              'current',
  400:                              $ref->{'notes'},
  401:                              $ref->{'abstract'},
  402:                              $ref->{'mime'},
  403:                              $ref->{'language'},
  404:                              sqltime($ref->{'creationdate'}),
  405:                              sqltime($ref->{'lastrevisiondate'}),
  406:                              $ref->{'owner'},
  407:                              $ref->{'copyright'},
  408: 			     $ref->{'dependencies'},
  409: 			     $ref->{'modifyinguser'},
  410: 			     $ref->{'authorspace'},
  411: 			     $ref->{'lowestgradelevel'},
  412: 			     $ref->{'highestgradelevel'},
  413: 			     $ref->{'standards'},
  414: 			     $dyn{'count'},
  415: 			     $dyn{'course'},
  416: 			     $dyn{'course_list'},
  417: 			     $dyn{'goto'},
  418: 			     $dyn{'goto_list'},
  419: 			     $dyn{'comefrom'},
  420: 			     $dyn{'comefrom_list'},
  421: 			     $dyn{'usage'},
  422: 			     $dyn{'usage_list'},
  423: 			     $dyn{'stdno'},
  424: 			     $dyn{'stdno_list'},
  425: 			     $dyn{'avetries'},
  426: 			     $dyn{'avetries_list'},
  427: 			     $dyn{'difficulty'},
  428: 			     $dyn{'difficulty_list'},			     
  429: 			     $dyn{'clear'},
  430: 			     $dyn{'technical'},
  431: 			     $dyn{'correct'},
  432: 			     $dyn{'helpful'},
  433: 			     $dyn{'depth'},
  434: 			     $dyn{'comments'}			     
  435: 			     )) {
  436: 	    print LOG "\nMySQL Error Insert: ".$dbh->errstr."\n";
  437: 	    die $dbh->errstr;
  438: 	}
  439:         $ref = undef;
  440:     }
  441: }
  442: # --------------------------------------------------- Close database connection
  443: $dbh->do("DROP TABLE IF EXISTS metadata");
  444: unless ($dbh->do("RENAME TABLE newmetadata TO metadata")) {
  445:     print LOG "\nMySQL Error Rename: ".$dbh->errstr."\n";
  446:     die $dbh->errstr;
  447: }
  448: unless ($dbh->disconnect) {
  449:     print LOG "\nMySQL Error Disconnect: ".$dbh->errstr."\n";
  450:     die $dbh->errstr;
  451: }
  452: print LOG "\n==== Searchcat completed ".localtime()." ====\n";
  453: close(LOG);
  454: &writesimple();
  455: &writecount();
  456: exit 0;
  457: 
  458: 
  459: 
  460: # =============================================================================
  461: 
  462: # ---------------------------------------------------------------- Get metadata
  463: # significantly altered from subroutine present in lonnet
  464: sub metadata {
  465:     my ($uri,$what)=@_;
  466:     my %metacache=();
  467:     $uri=&declutter($uri);
  468:     my $filename=$uri;
  469:     $uri=~s/\.meta$//;
  470:     $uri='';
  471:     unless ($metacache{$uri.'keys'}) {
  472:         unless ($filename=~/\.meta$/) { $filename.='.meta'; }
  473: 	my $metastring=&getfile($perlvar{'lonDocRoot'}.'/res/'.$filename);
  474:         my $parser=HTML::TokeParser->new(\$metastring);
  475:         my $token;
  476:         while ($token=$parser->get_token) {
  477:             if ($token->[0] eq 'S') {
  478:                 my $entry=$token->[1];
  479:                 my $unikey=$entry;
  480:                 if (defined($token->[2]->{'part'})) { 
  481:                     $unikey.='_'.$token->[2]->{'part'}; 
  482:                 }
  483:                 if (defined($token->[2]->{'name'})) { 
  484:                     $unikey.='_'.$token->[2]->{'name'}; 
  485:                 }
  486:                 if ($metacache{$uri.'keys'}) {
  487:                     $metacache{$uri.'keys'}.=','.$unikey;
  488:                 } else {
  489:                     $metacache{$uri.'keys'}=$unikey;
  490:                 }
  491:                 map {
  492:                     $metacache{$uri.''.$unikey.'.'.$_}=$token->[2]->{$_};
  493:                 } @{$token->[3]};
  494:                 unless (
  495:                         $metacache{$uri.''.$unikey}=$parser->get_text('/'.$entry)
  496:                         ) { $metacache{$uri.''.$unikey}=
  497:                                 $metacache{$uri.''.$unikey.'.default'};
  498:                         }
  499:             }
  500:         }
  501:     }
  502:     return \%metacache;
  503: }
  504: 
  505: # ------------------------------------------------------------ Serves up a file
  506: # returns either the contents of the file or a -1
  507: sub getfile {
  508:     my $file=shift;
  509:     if (! -e $file ) { return -1; };
  510:     my $fh=IO::File->new($file);
  511:     my $a='';
  512:     while (<$fh>) { $a .=$_; }
  513:     return $a;
  514: }
  515: 
  516: # ------------------------------------------------------------- Declutters URLs
  517: sub declutter {
  518:     my $thisfn=shift;
  519:     $thisfn=~s/^$perlvar{'lonDocRoot'}//;
  520:     $thisfn=~s/^\///;
  521:     $thisfn=~s/^res\///;
  522:     return $thisfn;
  523: }
  524: 
  525: # --------------------------------------- Is this the home server of an author?
  526: # (copied from lond, modification of the return value)
  527: sub ishome {
  528:     my $author=shift;
  529:     $author=~s/\/home\/httpd\/html\/res\/([^\/]*)\/([^\/]*).*/$1\/$2/;
  530:     my ($udom,$uname)=split(/\//,$author);
  531:     my $proname=propath($udom,$uname);
  532:     if (-e $proname) {
  533: 	return 1;
  534:     } else {
  535:         return 0;
  536:     }
  537: }
  538: 
  539: # -------------------------------------------- Return path to profile directory
  540: # (copied from lond)
  541: sub propath {
  542:     my ($udom,$uname)=@_;
  543:     $udom=~s/\W//g;
  544:     $uname=~s/\W//g;
  545:     my $subdir=$uname.'__';
  546:     $subdir =~ s/(.)(.)(.).*/$1\/$2\/$3/;
  547:     my $proname="$perlvar{'lonUsersDir'}/$udom/$subdir/$uname";
  548:     return $proname;
  549: } 
  550: 
  551: # ---------------------------- convert 'time' format into a datetime sql format
  552: sub sqltime {
  553:     my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =
  554: 	localtime(&unsqltime(@_[0]));
  555:     $mon++; $year+=1900;
  556:     return "$year-$mon-$mday $hour:$min:$sec";
  557: }
  558: 
  559: sub maketime {
  560:     my %th=@_;
  561:     return POSIX::mktime(($th{'seconds'},$th{'minutes'},$th{'hours'},
  562:                           $th{'day'},$th{'month'}-1,
  563:                           $th{'year'}-1900,0,0,$th{'dlsav'}));
  564: }
  565: 
  566: 
  567: #########################################
  568: #
  569: # Retro-fixing of un-backward-compatible time format
  570: 
  571: sub unsqltime {
  572:     my $timestamp=shift;
  573:     if ($timestamp=~/^(\d+)\-(\d+)\-(\d+)\s+(\d+)\:(\d+)\:(\d+)$/) {
  574:         $timestamp=&maketime('year'=>$1,'month'=>$2,'day'=>$3,
  575:                              'hours'=>$4,'minutes'=>$5,'seconds'=>$6);
  576:     }
  577:     return $timestamp;
  578: }
  579: 
  580: # ----------------- Code to enable 'find' subroutine listing of the .meta files
  581: 
  582: no strict "vars";
  583: 
  584: sub wanted {
  585:     (($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
  586:          -f _ &&
  587:          /^.*\.meta$/ && !/^.+\.\d+\.[^\.]+\.meta$/ &&
  588:          push(@metalist,"$dir/$_");
  589: }

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>