Changeset 28561

Show
Ignore:
Timestamp:
31.10.2013 11:26:49 (6 years ago)
Author:
kjdon
Message:

changing some util:: methods to FileUtils:: methods

Location:
main/trunk/greenstone2/perllib/cgiactions
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/cgiactions/buildaction.pm

    r24362 r28561  
    3636 
    3737use util; 
     38use FileUtils; 
    3839 
    3940BEGIN { 
     
    132133     
    133134    # Obtain the collect dir 
    134     my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 
    135  
    136     # Make sure the collection isn't locked by someone else 
    137     $self->lock_collection($username, $collect); 
    138  
    139     my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     135    my $collect_dir = &FileUtils::filenameConcatenate($gsdl_home, "collect"); 
     136 
     137    # Make sure the collection isn't locked by someone else 
     138    $self->lock_collection($username, $collect); 
     139 
     140    my $bin_script = &FileUtils::filenameConcatenate($gsdl_home,"bin","script"); 
    140141    my $cmd = "\"".&util::get_perl_exec()."\" -S full-import.pl \"$collect\""; 
    141142 
     
    171172     
    172173    # Obtain the collect dir 
    173     my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 
    174  
    175     # Make sure the collection isn't locked by someone else 
    176     $self->lock_collection($username, $collect); 
    177  
    178     my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     174    my $collect_dir = &FileUtils::filenameConcatenate($gsdl_home, "collect"); 
     175 
     176    # Make sure the collection isn't locked by someone else 
     177    $self->lock_collection($username, $collect); 
     178 
     179    my $bin_script = &FileUtils::filenameConcatenate($gsdl_home,"bin","script"); 
    179180    my $cmd = "\"".&util::get_perl_exec()."\" -S full-buildcol.pl \"$collect\""; 
    180181 
     
    209210     
    210211    # Obtain the collect dir 
    211     my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 
    212  
    213     # Make sure the collection isn't locked by someone else 
    214     $self->lock_collection($username, $collect); 
    215      
    216     my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     212    my $collect_dir = &FileUtils::filenameConcatenate($gsdl_home, "collect"); 
     213 
     214    # Make sure the collection isn't locked by someone else 
     215    $self->lock_collection($username, $collect); 
     216     
     217    my $bin_script = &FileUtils::filenameConcatenate($gsdl_home,"bin","script"); 
    217218    my $cmd = "\"".&util::get_perl_exec()."\" -S full-rebuild.pl \"$collect\""; 
    218219 
     
    248249     
    249250    # Obtain the collect dir 
    250     my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 
    251  
    252     # Make sure the collection isn't locked by someone else 
    253     $self->lock_collection($username, $collect); 
    254  
    255  
    256     my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     251    my $collect_dir = &FileUtils::filenameConcatenate($gsdl_home, "collect"); 
     252 
     253    # Make sure the collection isn't locked by someone else 
     254    $self->lock_collection($username, $collect); 
     255 
     256 
     257    my $bin_script = &FileUtils::filenameConcatenate($gsdl_home,"bin","script"); 
    257258    my $cmd = "\"".&util::get_perl_exec()."\" -S incremental-import.pl \"$collect\""; 
    258259 
     
    287288     
    288289    # Obtain the collect dir 
    289     my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 
    290  
    291     # Make sure the collection isn't locked by someone else 
    292     $self->lock_collection($username, $collect); 
    293  
    294  
    295     my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     290    my $collect_dir = &FileUtils::filenameConcatenate($gsdl_home, "collect"); 
     291 
     292    # Make sure the collection isn't locked by someone else 
     293    $self->lock_collection($username, $collect); 
     294 
     295 
     296    my $bin_script = &FileUtils::filenameConcatenate($gsdl_home,"bin","script"); 
    296297    my $cmd = "\"".&util::get_perl_exec()."\" -S incremental-buildcol.pl \"$collect\""; 
    297298 
     
    326327     
    327328    # Obtain the collect dir 
    328     my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 
    329  
    330     # Make sure the collection isn't locked by someone else 
    331     $self->lock_collection($username, $collect); 
    332  
    333  
    334     my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     329    my $collect_dir = &FileUtils::filenameConcatenate($gsdl_home, "collect"); 
     330 
     331    # Make sure the collection isn't locked by someone else 
     332    $self->lock_collection($username, $collect); 
     333 
     334 
     335    my $bin_script = &FileUtils::filenameConcatenate($gsdl_home,"bin","script"); 
    335336    my $cmd = "\"".&util::get_perl_exec()."\" -S incremental-rebuild.pl \"$collect\""; 
    336337 
     
    364365     
    365366    # Obtain the collect dir 
    366     my $collect_dir = &util::filename_cat($gsdl_home, "collect"); 
     367    my $collect_dir = &FileUtils::filenameConcatenate($gsdl_home, "collect"); 
    367368 
    368369    # Make sure the collection isn't locked by someone else 
     
    402403        close(MOUT); 
    403404         
    404         ## my $bin_script = &util::filename_cat($gsdl_home,"bin","script"); 
     405        ## my $bin_script = &FileUtils::filenameConcatenate($gsdl_home,"bin","script"); 
    405406        my $cmd = "\"".&util::get_perl_exec()."\" -S incremental-rebuild.pl -manifest \"$manifest_filename\" \"$collect\""; 
    406407 
     
    408409         
    409410        if ($status==0) { 
    410             &util::rm($manifest_filename); 
     411            &FileUtils::removeFiles($manifest_filename); 
    411412        } 
    412413    } 
  • main/trunk/greenstone2/perllib/cgiactions/explodeaction.pm

    r28211 r28561  
    3333use ghtml; 
    3434use util; 
     35use FileUtils; 
    3536 
    3637use JSON; 
     
    115116    my $site = $self->{'site'}; 
    116117    my $collect_dir = $gsdl_cgi->get_collection_dir($site); 
    117     my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 
    118     ##my $archive_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"archives"); 
     118    my $archive_dir = &FileUtils::filenameConcatenate($collect_dir,$collect,"archives"); 
     119    ##my $archive_dir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},"archives"); 
    119120 
    120121    my $arcinfo_doc_filename  
     
    167168    my $site = $self->{'site'}; 
    168169    my $collect_dir = $gsdl_cgi->get_collection_dir($site); 
    169     my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 
    170     ##my $archive_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"archives"); 
     170    my $archive_dir = &FileUtils::filenameConcatenate($collect_dir,$collect,"archives"); 
     171    ##my $archive_dir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},"archives"); 
    171172 
    172173    # Obtain the oids for the specified import filenames 
     
    209210    # its original source files will have already been removed   
    210211    if (-e $f) { 
    211         &util::rm($f); 
     212        &FileUtils::removeFiles($f); 
    212213    } 
    213214    } 
     
    227228    my $collect_dir = $gsdl_cgi->get_collection_dir($site); 
    228229     
    229     my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 
    230     my $import_dir  = &util::filename_cat($collect_dir,$collect,"import"); 
     230    my $archive_dir = &FileUtils::filenameConcatenate($collect_dir,$collect,"archives"); 
     231    my $import_dir  = &FileUtils::filenameConcatenate($collect_dir,$collect,"import"); 
    231232 
    232233    # Obtain the doc.xml path for the specified docID 
     
    248249 
    249250    my $assoc_path = dirname($doc_xml_file); 
    250     my $import_assoc_dir = &util::filename_cat($import_dir,$assoc_path); 
    251     my $archive_assoc_dir = &util::filename_cat($archive_dir,$assoc_path); 
     251    my $import_assoc_dir = &FileUtils::filenameConcatenate($import_dir,$assoc_path); 
     252    my $archive_assoc_dir = &FileUtils::filenameConcatenate($archive_dir,$assoc_path); 
    252253 
    253254    # If assoc_path involves more than one sub directory, then need to make 
     
    259260    if (-d $import_assoc_dir) { 
    260261        # detected version from previous explode => remove it 
    261         &util::rm_r($import_assoc_dir); 
     262        &FileUtils::removeFilesRecursive($import_assoc_dir); 
    262263    } 
    263264    else { 
     
    265266        # "c.dir" (see above) into 
    266267         
    267         &util::mk_all_dir($import_target_parent_dir); 
    268     } 
    269  
    270     &util::cp_r($archive_assoc_dir,$import_target_parent_dir) 
     268        &FileUtils::makeAllDirectories($import_target_parent_dir); 
     269    } 
     270 
     271    &FileUtils::copyFilesRecursive($archive_assoc_dir,$import_target_parent_dir) 
    271272    } 
    272273} 
     
    286287    my $collect_dir = $gsdl_cgi->get_collection_dir($site); 
    287288     
    288     my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 
     289    my $archive_dir = &FileUtils::filenameConcatenate($collect_dir,$collect,"archives"); 
    289290 
    290291    # Obtain the doc.xml path for the specified docID 
     
    306307 
    307308        my $assoc_path = dirname($doc_xml_file); 
    308         my $archive_assoc_dir = &util::filename_cat($archive_dir,$assoc_path); 
    309  
    310         &util::rm_r($archive_assoc_dir) 
     309        my $archive_assoc_dir = &FileUtils::filenameConcatenate($archive_dir,$assoc_path); 
     310 
     311        &FileUtils::removeFilesRecursive($archive_assoc_dir) 
    311312    } 
    312313} 
     
    332333    my $collect_dir = $gsdl_cgi->get_collection_dir($site); 
    333334     
    334     my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 
    335     ##my $archive_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"archives"); 
     335    my $archive_dir = &FileUtils::filenameConcatenate($collect_dir,$collect,"archives"); 
     336    ##my $archive_dir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},"archives"); 
    336337 
    337338    # Make sure the collection isn't locked by someone else 
     
    412413    my $collect_dir = $gsdl_cgi->get_collection_dir($site); 
    413414     
    414     my $archive_dir = &util::filename_cat($collect_dir,$collect,"archives"); 
    415     ##my $archive_dir = &util::filename_cat($ENV{'GSDLCOLLECTDIR'},"archives"); 
     415    my $archive_dir = &FileUtils::filenameConcatenate($collect_dir,$collect,"archives"); 
     416    ##my $archive_dir = &FileUtils::filenameConcatenate($ENV{'GSDLCOLLECTDIR'},"archives"); 
    416417 
    417418    # Make sure the collection isn't locked by someone else 
     
    460461 
    461462    # Obtain the collect dir 
    462     ## my $collect_dir = &util::filename_cat($gsdlhome, "collect"); 
     463    ## my $collect_dir = &FileUtils::filenameConcatenate($gsdlhome, "collect"); 
    463464 
    464465    # Make sure the collection isn't locked by someone else