Skip to content

Commit 4c6e4ee

Browse files
irefindex file loader uses first file in zip file
1 parent 6f9edbd commit 4c6e4ee

File tree

1 file changed

+11
-7
lines changed

1 file changed

+11
-7
lines changed

irefindex/irefindex.php

+11-7
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class irefindexParser extends Bio2RDFizer
3333
{
3434
function __construct($argv) { //
3535
parent::__construct($argv,"irefindex");
36-
parent::addParameter('files',true,'all|10090|10116|4932|559292|562|6239|7227|9606|A','all','all or comma-separated list of files to process');
37-
parent::addParameter('version',false,'08122013|03022013|10182011','08122013','dated version of files to download');
36+
parent::addParameter('files',true,'all|10090|10116|4932|559292|562|6239|7227|9606','all','all or comma-separated list of files to process');
37+
parent::addParameter('version',false,'07042015|08122013|03022013|10182011','07042015','dated version of files to download');
3838
parent::addParameter('download_url',false,null,'http://irefindex.org/download/irefindex/data/current/psi_mitab/MITAB2.6/');
3939
parent::initialize();
4040
}
@@ -55,9 +55,8 @@ function Run()
5555

5656
foreach($files AS $file) {
5757
$download = parent::getParameterValue('download');
58-
59-
$base_file = ucfirst($file).".mitab.".parent::getParameterValue("version").".txt";
60-
$zip_file = $base_file.".zip";
58+
$version = parent::getParameterValue("version");
59+
$zip_file = ucfirst($file).".mitab.".$version.".txt.zip";
6160
$lfile = $ldir.$zip_file;
6261

6362
$gz = (strstr(parent::getParameterValue('output_format'),".gz") === FALSE)?false:true;
@@ -82,9 +81,14 @@ function Run()
8281
trigger_error("Unable to open $lfile");
8382
exit;
8483
}
84+
if($zin->numFiles != 1) {
85+
trigger_error("Found more than one file ... using first file");
86+
}
87+
$f = $zin->statIndex(0);
88+
$base_file = $f['name'];
8589
if(($fp = $zin->getStream($base_file)) === FALSE) {
86-
trigger_error("Unable to get $base_file in ziparchive $lfile");
87-
return FALSE;
90+
trigger_error("Unable to get $base_file in ziparchive $lfile");
91+
return FALSE;
8892
}
8993
parent::setReadFile($lfile);
9094
parent::getReadFile()->setFilePointer($fp);

0 commit comments

Comments
 (0)