Skip to content

Commit

Permalink
Merge pull request #1179 from dsenalik/1178-tv3-bulk_loader_line_count
Browse files Browse the repository at this point in the history
filter out blank lines in bulk loader line count
  • Loading branch information
spficklin committed Mar 17, 2021
2 parents 55aadd7 + ce38a33 commit 29b3039
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion tripal_bulk_loader/includes/tripal_bulk_loader.loader.inc
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,15 @@ function tripal_bulk_loader_load_data($nid, $job_id) {
$node = node_load($nid);
print "Template: " . $node->template->name . " (" . $node->template_id . ")\n";

// Determine the total number of lines in the file.
// Determine the total number of non-blank lines in the file.
$total_lines = 0;
$handle = fopen($node->file, "r");
while (!feof($handle)) {
$line = fgets($handle);
$line = trim($line);
if (empty($line)) {
continue;
} // skips blank lines
$total_lines++;
}
fclose($handle);
Expand Down

0 comments on commit 29b3039

Please sign in to comment.