diff options
| author | Bharat Mediratta <bharat@menalto.com> | 2009-03-26 20:26:06 +0000 | 
|---|---|---|
| committer | Bharat Mediratta <bharat@menalto.com> | 2009-03-26 20:26:06 +0000 | 
| commit | d7719a7e72de2ddc46c9173b0871f53e32ef40fc (patch) | |
| tree | 8cc35bd0a1060b19f25a4dd211b9f85fdf84f302 /modules/search | |
| parent | 9f8393c9d559bb93c29dc9931a2cbd260d1e3fb8 (diff) | |
Gracefully deal with the case where we resume a stalled task but there
was no work left to be done.  This fixes a divide by zero error.
Diffstat (limited to 'modules/search')
| -rw-r--r-- | modules/search/helpers/search_task.php | 10 | 
1 files changed, 7 insertions, 3 deletions
| diff --git a/modules/search/helpers/search_task.php b/modules/search/helpers/search_task.php index 7aba640e..8d69d3dc 100644 --- a/modules/search/helpers/search_task.php +++ b/modules/search/helpers/search_task.php @@ -53,10 +53,14 @@ class search_task_Core {      $task->set("completed", $completed);      list ($remaining, $total, $percent) = self::_get_stats(); -    $task->percent_complete = round(100 * $completed / ($remaining + $completed)); +    if ($remaining + $completed) { +      $task->percent_complete = round(100 * $completed / ($remaining + $completed)); -    $task->status = t("%done records records updated, index is %percent% up-to-date", -                      array("done" => $completed, "percent" => $percent)); +      $task->status = t("%done records records updated, index is %percent% up-to-date", +                        array("done" => $completed, "percent" => $percent)); +    } else { +      $task->percent_complete = 100; +    }      if ($remaining == 0) {        $task->done = true; | 
