Ignore:
Timestamp:
2017-03-14T15:30:24+13:00 (7 years ago)
Author:
ak19
Message:

servercontrol.pm uses established functions to generate tmpfiles in tmp directories, and then immediately deletes them after using them. Made some modifications for this in util.pm and added some extra helper functions there.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/servercontrol.pm

    r31507 r31513  
    140140
    141141    my $wget_file_path = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "wget");
    142     my $tmpfilename = time . ".html"; # random name for file wherein we'll store the HTML page retrieved by wget
    143    
     142    my $tmpfilename = &util::get_tmp_filename(".html", 1); # random file name with html extension in timestamped-tmpdir location (2nd param=1)
     143                                                            # wherein we'll store the HTML page retrieved by wget
     144       
    144145    # https://www.gnu.org/software/wget/manual/wget.html
    145146    # output-document set to - (STDOUT), so page is streamed to STDOUT
     
    181182        # server not running
    182183        $self->print_msg("*** Server not running. $library_url$command\n", 3);
     184        &util::rm_tmp_file($tmpfilename); # will also remove any randomly named tmp directories containing the file
    183185        return 0;
    184186    }
     
    195197        sysread(FIN, $resultstr, -s FIN);       
    196198        close(FIN);
    197         &FileUtils::removeFiles("$tmpfilename");
     199        &util::rm_tmp_file($tmpfilename); # will also remove any randomly named tmp directories containing the file
     200       
    198201       
    199202        #$resultstr =~ s@.*gs_content\"\>@@s;   ## only true for default library servlet   
Note: See TracChangeset for help on using the changeset viewer.