Changeset 37679 for main


Ignore:
Timestamp:
2023-04-19T20:59:05+12:00 (12 months ago)
Author:
anupama
Message:

Dr Bainbridge's archives_keepold to archives *directory* rename requires a new gliserver.pl method renameCollectionFolder to call the appropriate FileUtils.pm function, as the existing moveCollectionFile only moves source files *into* destination if destination is a folder.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/common-src/cgi-bin/gliserver.pl

    r36096 r37679  
    195195    if ($cmd eq "move-collection-file") {
    196196    &move_collection_file($gsdl_cgi, $username, $timestamp, $site);
     197    return;
     198    }
     199    if ($cmd eq "rename-collection-folder") {
     200    &rename_collection_folder($gsdl_cgi, $username, $timestamp, $site);
    197201    return;
    198202    }
     
    10301034
    10311035
    1032 sub move_collection_file
     1036sub _move_rename_collection_file
    10331037{
    10341038    my ($gsdl_cgi, $username, $timestamp, $site) = @_;
     
    10791083    &lock_collection($gsdl_cgi, $username, $collection, $site);
    10801084
     1085    return ($source_file, $target_file);
     1086}
     1087   
     1088sub move_collection_file
     1089{
     1090    my ($gsdl_cgi, $username, $timestamp, $site) = @_;
     1091
     1092    my ($source_file, $target_file) =  &_move_rename_collection_file($gsdl_cgi,
     1093                                     $username, $timestamp, $site);
     1094   
    10811095    &util::mv($source_file, $target_file);
    10821096
     
    10871101
    10881102    $gsdl_cgi->generate_ok_message("Collection file $source_file moved to $target_file successfully.");
     1103}
     1104
     1105sub rename_collection_folder
     1106{
     1107    my ($gsdl_cgi, $username, $timestamp, $site) = @_;
     1108
     1109    my ($source_file, $target_file) =  &_move_rename_collection_file($gsdl_cgi,
     1110                                     $username, $timestamp, $site);
     1111
     1112    &FileUtils::renameDirectory($source_file, $target_file);
     1113
     1114    # Check that the collection source file was moved
     1115    if (-e $source_file || !-e $target_file) {
     1116    $gsdl_cgi->generate_error("Could not rename collection folder $source_file to $target_file."); # dies
     1117    }
     1118
     1119    $gsdl_cgi->generate_ok_message("Collection folder $source_file renamed to $target_file successfully.");
    10891120}
    10901121
Note: See TracChangeset for help on using the changeset viewer.