You are here

function progress_set_intervalled_progress in Progress 7

Same name and namespace in other branches
  1. 8 progress.module \progress_set_intervalled_progress()
  2. 6 progress.module \progress_set_intervalled_progress()

Set intervalled progress Use when you don't need to spam the progress table every time.

Parameters

string $name: Name of progress

string $message: Message for progress

double $progress: Current progress (0 - 1)

double $interval: Interval in seconds

Return value

mixed Result from db execute()

File

./progress.module, line 116
Progress framework for keeping track of progresses

Code

function progress_set_intervalled_progress($name, $message, $progress, $interval = NULL) {
  static $set = array();
  if (isset($interval, $set[$name])) {
    if ($set[$name] + $interval > microtime(TRUE)) {
      return TRUE;
    }
  }
  $result = progress_set_progress($name, $message, $progress);
  $set[$name] = microtime(TRUE);
  return $result;
}