You are here

public static function MostPopularLastRun::resetThrottles in Drupal Most Popular 7

Same name and namespace in other branches
  1. 6 classes/lastrun.php \MostPopularLastRun::resetThrottles()

Resets the throttles for the given service to the defaults.

Parameters

integer $sid: The service ID. If null, all services are reset.

integer $iid: The interval ID. If null, all intervals are reset.

File

classes/lastrun.php, line 231
Defines a wrapper for the mostpopular_last_run table.

Class

MostPopularLastRun
@file Defines a wrapper for the mostpopular_last_run table.

Code

public static function resetThrottles($sid = NULL, $iid = NULL) {
  $runs = self::fetchAll($sid, $iid);
  foreach ($runs as $run) {
    $defaults = self::getDefaultThrottles($run->sid);
    if (isset($defaults[$run->sid][$run->iid])) {
      $run->throttle = $defaults[$run->sid][$run->iid];
      $run
        ->save();
    }
    else {
      $run
        ->remove();
    }
  }
}