Changeset 27325


Ignore:
Timestamp:
05/14/13 10:49:29 (8 years ago)
Author:
kjdon
Message:

changed old util function calls to the new FileUtils calls

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/activate.pl

    r27240 r27325  
    290290   
    291291    if($gs_mode eq "gs2") {     
    292         my $llssite_cfg = &util::filename_cat($ENV{'GSDLHOME'}, "llssite.cfg");
     292        my $llssite_cfg = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "llssite.cfg");
    293293       
    294294        if(-f $llssite_cfg) {
     
    514514    # work out the building and index dirs
    515515    my $collection_dir = &util::resolve_collection_dir($collect_dir, $qualified_collection, $site);
    516     $build_dir = &util::filename_cat($collection_dir, "building") unless (defined $build_dir);
    517     $index_dir = &util::filename_cat($collection_dir, "index") unless (defined $index_dir);
     516    $build_dir = &FileUtils::filenameConcatenate($collection_dir, "building") unless (defined $build_dir);
     517    $index_dir = &FileUtils::filenameConcatenate($collection_dir, "index") unless (defined $index_dir);
    518518   
    519519    &print_task_msg("Running  Collection  Activation  Stage");
     
    539539   
    540540    if ($gs_mode eq "gs2") {
    541         $build_cfg_filename = &util::filename_cat($build_dir,"build.cfg");
     541        $build_cfg_filename = &FileUtils::filenameConcatenate($build_dir,"build.cfg");
    542542    } else {
    543         $build_cfg_filename = &util::filename_cat($build_dir, "buildConfig.xml");
     543        $build_cfg_filename = &FileUtils::filenameConcatenate($build_dir, "buildConfig.xml");
    544544        # gs_mode is GS3. Set the site now if this was not specified as cmdline argument
    545545        #$site = "localsite" unless defined $site;
     
    563563    # Except if we're (doing incremental) building for solr, where we want to still
    564564    # activate and deactivate collections including for the incremental case
    565     if(!&util::dir_exists($build_dir)) {
     565    if(!&FileUtils::directoryExists($build_dir)) {
    566566    &print_msg("No building folder at $build_dir to move to index.\n");
    567567    exit -1 unless ($buildtype eq "solr"); #&& $incremental);
    568     } elsif (&util::is_dir_empty($build_dir)) {
     568    } elsif (&FileUtils::isDirectoryEmpty($build_dir)) {
    569569    &print_msg("Nothing in building folder $build_dir to move into index folder.\n");
    570570    exit -1 unless ($buildtype eq "solr"); #&& $incremental);
     
    655655    if($removeold) {
    656656       
    657         if(&util::dir_exists($index_dir)) {
     657        if(&FileUtils::directoryExists($index_dir)) {
    658658            &print_task_msg("Removing \"index\"");
    659659
     
    665665            }   
    666666
    667             &util::rm_r($index_dir);
     667            &FileUtils::removeFilesRecursive($index_dir);
    668668           
    669669            # Wait for a couple of seconds, just for luck
    670670            sleep 2;
    671671           
    672             if (&util::dir_exists($index_dir)) {
     672            if (&FileUtils::directoryExists($index_dir)) {
    673673                &print_msg("The index directory $index_dir could not be deleted.\n"); # CollectionManager.Index_Not_Deleted
    674674            }
     
    687687        # Move the building directory to become the new index directory
    688688        &print_task_msg("Moving \"building\" -> \"index\"");
    689         &util::mv($build_dir, $index_dir);
    690         if(&util::dir_exists($build_dir) || !&util::dir_exists($index_dir)) {           
     689        &FileUtils::moveFiles($build_dir, $index_dir);
     690        if(&FileUtils::directoryExists($build_dir) || !&FileUtils::directoryExists($index_dir)) {           
    691691            &print_msg("Could not move $build_dir to $index_dir.\n"); # CollectionManager.Build_Not_Moved
    692692        }
     
    703703        # existing files, but don't replace index with building.
    704704        &print_task_msg("Moving \"building\" -> \"index\"");
    705         &util::mv_dir_contents($build_dir, $index_dir);
     705        &FileUtils::moveDirectoryContents($build_dir, $index_dir);
    706706    }
    707707
     
    732732   
    733733    # Check for success: if building does not exist OR is empty
    734     if(!&util::dir_exists($build_dir) || &util::is_dir_empty($build_dir)) {
     734    if(!&FileUtils::directoryExists($build_dir) || &FileUtils::isDirectoryEmpty($build_dir)) {
    735735   
    736736        if($library_url) { # undef if no valid server URL
Note: See TracChangeset for help on using the changeset viewer.