Ignore:
Timestamp:
12/12/16 15:20:40 (4 years ago)
Author:
ak19
Message:

Kathy found that the lowercased dbutil modules are not used (jdbm.pm, for example) and have been wholly replaced by the uppercased versions in DBDrivers folder. (I thought we had both). So I've moved the recently added code in jdbm.pm to JDBM.pm and fixed it up. Also tiedied up oaiinfo.pm of some unwanted commented out code.

Location:
main/trunk/greenstone2/perllib
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/DBDrivers/JDBM.pm

    r31188 r31208  
    7979
    8080
     81# jdb also creates .lg log files, that don't get removed on delete or move operations
     82# Make sure to rename them to when performing a rename operation on the main db file.
     83# dbutil::renameTo(src,dest) already took care of renaming the main db file.
     84sub rename_db_file_to {
     85    my $self = shift(@_);   
     86
     87    $self->SUPER::rename_db_file_to(@_);
     88    my ($srcpath, $destpath) = @_;
     89
     90    my ($srctailname, $srcdirname, $srcsuffix)
     91    = &File::Basename::fileparse($srcpath, "\\.[^\\.]+\$");
     92    my ($desttailname, $destdirname, $destsuffix)
     93    = &File::Basename::fileparse($destpath, "\\.[^\\.]+\$");
     94   
     95    # add in the lg extension
     96    my $src_log_file = &FileUtils::filenameConcatenate($srcdirname, $srctailname.".lg");
     97    my $dest_log_file = &FileUtils::filenameConcatenate($destdirname, $desttailname.".lg");
     98   
     99    # finally, move/rename any log file belonging to the src db file
     100    if(&FileUtils::fileExists($src_log_file)) {
     101    &FileUtils::moveFiles($src_log_file, $dest_log_file);
     102    }
     103   
     104    # don't want to keep the log file for any files renamed to bak (backup file) though
     105    if($destsuffix =~ m/bak$/) {
     106    my $assoc_log_file = &FileUtils::filenameConcatenate($destdirname, $desttailname.".lg");
     107    if(&FileUtils::fileExists($assoc_log_file)) {
     108        &FileUtils::removeFiles($assoc_log_file);
     109    }
     110    }
     111
     112}
     113
     114sub remove_db_file {
     115    my $self = shift(@_);
     116
     117    print STDERR "###### |".join(",", @_) . "|\n";
     118
     119    $self->SUPER::remove_db_file(@_);
     120    my ($db_filepath) = @_;
     121
     122    # add in the lg extension to get the log file name
     123    my ($tailname, $dirname, $suffix) = &File::Basename::fileparse($db_filepath, "\\.[^\\.]+\$");
     124    my $assoc_log_file = &FileUtils::filenameConcatenate($dirname, $tailname.".lg");
     125
     126    # remove any log file associated with the db file
     127    if(&FileUtils::fileExists($assoc_log_file)) {
     128    &FileUtils::removeFiles($assoc_log_file);
     129    }
     130
     131}
     132
     133
     134
    81135# -----------------------------------------------------------------------------
    82136#   JDBM IMPLEMENTATION
  • main/trunk/greenstone2/perllib/dbutil/jdbm.pm

    r31188 r31208  
    319319
    320320
    321 # jdb also creates .lg log files, that don't get removed on delete or move operations
    322 # Make sure to rename them to when performing a rename operation on the main db file.
    323 # dbutil::renameTo(src,dest) already took care of renaming the main db file.
    324 sub rename_db_file_to {
    325     my $infodb_handle = shift(@_);
    326     my ($srcpath, $destpath) = @_;
    327 
    328     my ($srctailname, $srcdirname, $srcsuffix)
    329     = &File::Basename::fileparse($srcpath, "\\.[^\\.]+\$");
    330     my ($desttailname, $destdirname, $destsuffix)
    331     = &File::Basename::fileparse($destpath, "\\.[^\\.]+\$");
    332 
    333     # add in the lg extension
    334     my $src_log_file = &FileUtils::filenameConcatenate($srcdirname, $srctailname.".lg");
    335     my $dest_log_file = &FileUtils::filenameConcatenate($destdirname, $desttailname.".lg");
    336 
    337     # finally, move/rename any log file belonging to the src db file
    338     if(&FileUtils::fileExists($src_log_file)) {
    339     &FileUtils::moveFiles($src_log_file, $dest_log_file);
    340     }
    341 }
    342 
    343 sub remove_db_file {
    344     my $infodb_handle = shift(@_);
    345     my ($db_filepath) = @_;
    346 
    347     # add in the lg extension to get the log file name
    348     my ($tailname, $dirname, $suffix) = &File::Basename::fileparse($db_filepath, "\\.[^\\.]+\$");
    349     my $assoc_log_file = &FileUtils::filenameConcatenate($dirname, $tailname.".lg");
    350 
    351     # remove any log file associated with the db file
    352     if(&FileUtils::fileExists($assoc_log_file)) {
    353     &FileUtils::removeFiles($assoc_log_file);
    354     }
    355 
    356 }
    357 
    3583211;
  • main/trunk/greenstone2/perllib/oaiinfo.pm

    r31192 r31208  
    509509    foreach my $oid ( keys $self->{'info'} ) {
    510510    my $OID_info = $self->{'info'}->{$oid};
    511     #my $val_hash = {
    512     #    "status" => $OID_info->[INFO_STATUS_INDEX],
    513     #    "timestamp" => $OID_info->[INFO_TIMESTAMP_INDEX]
    514     #};
    515    
    516     #&dbutil::write_infodb_rawentry($infodbtype,$infodb_handle,$oid,$val_hash);
    517 
    518511    my $val = "<status>".$OID_info->[INFO_STATUS_INDEX]."\n<timestamp>".$OID_info->[INFO_TIMESTAMP_INDEX]."\n";
    519512    &dbutil::write_infodb_rawentry($infodbtype,$infodb_handle,$oid,$val);
Note: See TracChangeset for help on using the changeset viewer.