Changeset 31188 for main/trunk/greenstone2
- Timestamp:
- 2016-12-09T21:24:55+13:00 (7 years ago)
- Location:
- main/trunk/greenstone2/perllib
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/DBDrivers/BaseDBDriver.pm
r30517 r31188 344 344 345 345 346 ## @function rename_db_file_to(string, string) => void 347 # 348 sub rename_db_file_to { 349 my $self = shift(@_); 350 my ($srcpath, $destpath) = @_; 351 352 # rename basic db file 353 &FileUtils::moveFiles($srcpath, $destpath); 354 355 # subclass should rename any additional files that the specific dbtype creates 356 } 357 ## rename_db_file_to(string, string) => void ## 358 359 ## @function remove_db_file(string) => void 360 # 361 sub remove_db_file { 362 my $self = shift(@_); 363 my ($db_filepath) = @_; 364 365 # remove basic db file 366 &FileUtils::removeFiles($db_filepath); 367 368 # subclass must rename any additional files that the specific dbtype creates (e.g. transaction log files) 369 } 370 ## remove_db_file(string, string) => void ## 371 372 346 373 ## @function supportsDatestamp(void) => integer 347 374 # -
main/trunk/greenstone2/perllib/DBDrivers/GDBM.pm
r30370 r31188 70 70 # Handled by BaseDBDriver 71 71 # sub get_infodb_file_path(string, string) => string 72 # sub rename_db_file_to(string, string) => void 73 # sub remove_db_file(string) => void 72 74 73 75 # Handled by 70HyphenFormat -
main/trunk/greenstone2/perllib/DBDrivers/JDBM.pm
r30517 r31188 83 83 # ----------------------------------------------------------------------------- 84 84 85 # When DBUtil::* is properly structured with inherit ence, then85 # When DBUtil::* is properly structured with inheritance, then 86 86 # much of this code (along with GDBM and GDBM-TXT-GZ) can be grouped into 87 87 # a shared base class. Really it is only the the command that needs to … … 91 91 # sub get_infodb_file_path {} 92 92 93 # Handle sby 70HyphenFormat93 # Handled by 70HyphenFormat 94 94 # sub open_infodb_write_handle(string, string?) => filehandle 95 95 # sub close_infodb_write_handle(filehandle) => void -
main/trunk/greenstone2/perllib/dbutil.pm
r30517 r31188 564 564 ## write_infodb_rawentry(string, *) => void ## 565 565 566 ## @function rename_db_file_to(string, string) => void 567 # 568 sub rename_db_file_to { 569 my $infodb_type = shift(@_); 570 my $driver = _loadDBDriver($infodb_type); 571 $driver->rename_db_file_to(@_); 572 } 573 ## rename_db_file_to(string, string) => void ## 574 575 ## @function remove_db_file(string) => void 576 # 577 sub remove_db_file { 578 my $infodb_type = shift(@_); 579 my $driver = _loadDBDriver($infodb_type); 580 $driver->remove_db_file(@_); 581 } 582 ## remove_db_file(string, string) => void ## 583 566 584 1; -
main/trunk/greenstone2/perllib/dbutil/jdbm.pm
r28395 r31188 306 306 307 307 308 309 308 sub delete_infodb_entry 310 309 { … … 320 319 321 320 322 323 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 } 324 357 325 358 1;
Note:
See TracChangeset
for help on using the changeset viewer.