- Timestamp:
- 2013-09-10T15:37:45+12:00 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/downloaders/OAIDownload.pm
r27012 r28250 112 112 my $tmp_dir = "$ENV{GSDLHOME}/tmp"; 113 113 if (! -e $tmp_dir) { 114 & util::mk_dir($tmp_dir);114 &FileUtils::makeDirectory($tmp_dir); 115 115 } 116 116 … … 171 171 $self->getOAIRecords($aryIDs, $strOutputDir, $strBasURL, $self->{'max_records'}, $blnDownloadDoc); 172 172 173 # my $tmp_file = & util::filename_cat($ENV{'GSDLHOME'},"tmp","oai.tmp");174 # & util::rm($tmp_file);173 # my $tmp_file = &FileUtils::filenameConcatenate($ENV{'GSDLHOME'},"tmp","oai.tmp"); 174 # &FileUtils::removeFiles($tmp_file); 175 175 176 176 return 1; … … 318 318 } 319 319 320 321 my $is_page_html = 0; 322 if($id_file_ext =~ m/^html?$/i) { 323 $is_page_html = 1; 324 } elsif ($doc_id_url) { # important: if no doc id has currently been typed into the url field, skip this block 320 325 321 if ((!$primary_doc_match) && ($id_file_ext =~ m/^html?$/i)) { 326 # get the page and check the header's content-type and see if this is text/html 327 # if so, $is_page_html is true 328 # See http://superuser.com/questions/197009/wget-head-request 329 330 my $wget_opts3 = $self->getWgetOptions(); 331 my $wget_header_cmd = "$wget_opts3 -S --spider \"$doc_id_url\""; 332 my $page_content = $self->useWget($wget_header_cmd); 333 334 if($page_content && $page_content =~ m@Content-Type:\s*text/html@i) { 335 $is_page_html = 1; 336 } 337 } 338 339 if (!$primary_doc_match && $is_page_html) { 340 322 341 # Download this doc if HTML, scan through it looking for a link 323 342 # that does match get_doc_exts … … 387 406 388 407 if (-e $tmp_filename) { 389 & util::rm($tmp_filename);408 &FileUtils::removeFiles($tmp_filename); 390 409 } 391 410 } … … 474 493 ($strSubDirPath,$unused) = $self->dirFileSplit($strFileURL); 475 494 476 & util::mk_all_dir($strSubDirPath);495 &FileUtils::makeAllDirectories($strSubDirPath); 477 496 478 497 my $ds = &util::get_dirsep(); … … 559 578 560 579 #Open a temporary file to store OAI information, and store the information to the temp file 561 my $name = & util::filename_cat($ENV{GSDLHOME},"tmp","oai.tmp");580 my $name = &FileUtils::filenameConcatenate($ENV{GSDLHOME},"tmp","oai.tmp"); 562 581 563 582 open(*OAIOUT,"> $name");
Note:
See TracChangeset
for help on using the changeset viewer.