|
@@ -224,6 +224,8 @@ function chado_publish_records($values, $job = NULL) {
|
|
|
// Perform the query in chunks.
|
|
|
$sql = $select . $from . $where . ' LIMIT ' . $chunk_size;
|
|
|
$more_records_to_publish = TRUE;
|
|
|
+ $num_actually_published = 0; // the full number of records published.
|
|
|
+ $i = 0; //reset on each chunk.
|
|
|
while ($more_records_to_publish) {
|
|
|
|
|
|
$records = chado_query($sql, $args);
|
|
@@ -236,6 +238,9 @@ function chado_publish_records($values, $job = NULL) {
|
|
|
// are already in one.
|
|
|
$transaction = db_transaction();
|
|
|
try {
|
|
|
+ // Keep track of how many we've published so far
|
|
|
+ // before clearing our chunk,
|
|
|
+ $num_actually_published = $num_actually_published + $i;
|
|
|
$i = 0;
|
|
|
while ($record = $records->fetchObject()) {
|
|
|
|
|
@@ -293,7 +298,7 @@ function chado_publish_records($values, $job = NULL) {
|
|
|
return FALSE;
|
|
|
}
|
|
|
|
|
|
- // If we get through the loop and haven't completed 100 records, then
|
|
|
+ // If we get through the loop and haven't completed 100 records, then
|
|
|
// we're done!
|
|
|
if ($i < $chunk_size) {
|
|
|
$more_records_to_publish = FALSE;
|
|
@@ -303,9 +308,12 @@ function chado_publish_records($values, $job = NULL) {
|
|
|
unset($transaction);
|
|
|
}
|
|
|
|
|
|
+ // Add the last number published to our total.
|
|
|
+ $num_actually_published = $num_actually_published + $i;
|
|
|
+
|
|
|
tripal_report_error($message_type, TRIPAL_INFO,
|
|
|
"Successfully published !count !type record(s).",
|
|
|
- ['!count' => $i, '!type' => $bundle->label], $message_opts);
|
|
|
+ ['!count' => $num_actually_published, '!type' => $bundle->label], $message_opts);
|
|
|
|
|
|
return TRUE;
|
|
|
}
|