public static function trim()
{
// allow an option to be set to override the log retention - in days
$retention_days = Options::get('log_retention', 14);
// default to 14 days
// make it into the string we'll use
$retention = '-' . intval($retention_days) . ' days';
// Trim the log table down
$date = DateTime::create()->modify($retention);
$result = DB::query('DELETE FROM {log} WHERE timestamp < ?', array($date->sql));
if ($result) {
EventLog::log(_t('Entries over %d days old were trimmed from the EventLog', array($retention_days)), 'info');
} else {
EventLog::log(_t('There was an error trimming old entries from the EventLog!'), 'err');
}
return $result;
}