/**
* Garbage collects old alarms in the backend.
*
+ * @param boolean $force Force garbace collection? If false, GC happens
+ * with a 1% chance.
+ *
* @throws Horde_Alarm_Exception
*/
- public function gc()
+ public function gc($force = false)
{
/* A 1% chance we will run garbage collection during a call. */
- if (rand(0, 99) == 0) {
+ if ($force || rand(0, 99) == 0) {
$this->_gc();
}
}
{
$query = sprintf('DELETE FROM %s WHERE alarm_end IS NOT NULL AND alarm_end < ?', $this->_params['table']);
$end = new Horde_Date(time());
- $this->_db->delete($query, (string)$end->setTimezone('UTC'));
+ $this->_db->delete($query, array((string)$end->setTimezone('UTC')));
}
/**