Skip to content

Commit db38d78

Browse files
replaced deprecated split with explode; added passive ftp connection
1 parent fc8e5ad commit db38d78

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

refseq/refseq.php

+7-3
Original file line numberDiff line numberDiff line change
@@ -984,7 +984,7 @@ function retrieveSections($aSectionType, $gb_record_sections){
984984
* it removes the header at the top of the file
985985
*/
986986
function removeHeader($aGbRecord){
987-
$gb_arr = split("\n", $aGbRecord);
987+
$gb_arr = explode("\n", $aGbRecord);
988988
for($i=0;$i<count($gb_arr);$i++){
989989
preg_match("/^LOCUS/", $gb_arr[$i], $matches);
990990
if(count($matches)){
@@ -1005,7 +1005,7 @@ function removeHeader($aGbRecord){
10051005
*/
10061006
function parseGenbankRaw($gb_record){
10071007
$sections = array();
1008-
$gb_arr = split("\n", $gb_record);
1008+
$gb_arr = explode("\n", $gb_record);
10091009
$aSection = "";
10101010
$section_name = "";
10111011
$record_counter = 0;
@@ -1063,9 +1063,13 @@ function getFtpFileList($ftp_uri, $path, $regex){
10631063
echo "Couldn't connect as $ftp_user\n";
10641064
exit;
10651065
}
1066-
1066+
ftp_pasv($conn_id, TRUE);
10671067
// get contents of the current directory
10681068
$contents = ftp_nlist($conn_id, $path);
1069+
if(FALSE === $contents) {
1070+
echo "Unable to get contents for $path".PHP_EOL;
1071+
exit(-1);
1072+
}
10691073
foreach($contents as $aFile){
10701074
// $reg_exp = "/.*\/(.*".$extension.")/";
10711075
preg_match($regex, $aFile, $matches);

0 commit comments

Comments
 (0)