Skip to content

Commit

Permalink
Merge pull request #1402 from tripal/1401-tv3-php8-bulk-update-all-ti…
Browse files Browse the repository at this point in the history
…tles

tv3g3 php8 errors with Bulk update all titles
  • Loading branch information
spficklin committed Feb 11, 2023
2 parents 510a9ef + 67ba585 commit 9c308ce
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 3 additions & 3 deletions tripal/includes/TripalJob.inc
Original file line number Diff line number Diff line change
Expand Up @@ -330,10 +330,10 @@ class TripalJob {
if (count($refparams) > 0) {
$lastparam = $refparams[count($refparams) - 1];
if ($lastparam->getName() == 'job_id') {
$arguments[] = $this->job->job_id;
$arguments['job_id'] = $this->job->job_id;
}
else {
$arguments[] = $this;
elseif ($lastparam->getName() == 'job') {
$arguments['job'] = $this;
}
}

Expand Down
6 changes: 4 additions & 2 deletions tripal/includes/tripal.bulk_update.inc
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@ function tripal_update_all_urls_and_titles($bundle_id, $update, $type) {
$elements = explode(',', $bundle_token[0]);
$field_name = array_shift($elements);
$field_array = field_info_field($field_name);
$fields[] = $field_array['id'];
if ($field_array) {
$fields[] = $field_array['id'];
}
}

$i = 1;
Expand Down Expand Up @@ -54,7 +56,7 @@ function tripal_update_all_urls_and_titles($bundle_id, $update, $type) {
}
}
// Check if 50 items have been updated, if so print message.
if ($i <= $num_entities) {
if (($i % 50 == 0) or ($i == $num_entities)) {
$mem = number_format(memory_get_usage());
print $i . "/" . $num_entities . " entities have been updated. Memory usage: $mem bytes.\r";
}
Expand Down

0 comments on commit 9c308ce

Please sign in to comment.