You are here

function drupalchat_cron in DrupalChat 7.2

Same name and namespace in other branches
  1. 8 drupalchat.module \drupalchat_cron()
  2. 6.2 drupalchat.module \drupalchat_cron()
  3. 6 drupalchat.module \drupalchat_cron()
  4. 7 drupalchat.module \drupalchat_cron()

Implements hook_cron().

File

./drupalchat.module, line 437
Module code for DrupalChat.

Code

function drupalchat_cron() {
  if (check_plain(variable_get('drupalchat_log_messages', 1)) != 1) {
    db_delete('drupalchat_msg')
      ->condition('timestamp', time() - 10, '<')
      ->execute();
    db_delete('drupalchat_users')
      ->condition('timestamp', time() - 10, '<')
      ->execute();
  }
  if (check_plain(variable_get('drupalchat_polling_method', DRUPALCHAT_AJAX)) == DRUPALCHAT_COMMERCIAL) {
    db_delete('drupalchat_users')
      ->condition('timestamp', time() - 60 * 60 * 24 * 14, '<')
      ->execute();
  }
}