Back to MetadataManager class

Method deletePriorTo

public void
deletePriorTo
(mixed $time)
Delete records with a timestamp prior to the given time.
Parameters
  • int $time The time records should be deleted if expired before.
Returns
  • void
Since
  • 3.8.6

Method deletePriorTo - Source code

/**
 * Delete records with a timestamp prior to the given time.
 *
 * @param   integer  $time  The time records should be deleted if expired before.
 *
 * @return  void
 *
 * @since   3.8.6
 */
public function deletePriorTo($time)
{
    $query = $this->db->getQuery(true)->delete($this->db->quoteName('#__session'))->where($this->db->quoteName('time') . ' < :time')->bind(':time', $time, ParameterType::INTEGER);
    $this->db->setQuery($query);
    try {
        $this->db->execute();
    } catch (ExecutionFailureException $exception) {
        // Since garbage collection does not result in a fatal error when run in the session API, we don't allow it here either.
    }
}