Same name and namespace in other branches
  1. 4.7.x modules/drupal.module \drupal_cron()
  2. 5.x modules/drupal/drupal.module \drupal_cron()

Implementation of hook_cron(); handles pings to and from the site.

File

modules/drupal.module, line 53
Lets users log in using a Drupal ID and can notify a central server about your site.

Code

function drupal_cron() {
  if (time() - variable_get('drupal_cron_last', 0) > 21600) {
    variable_set('drupal_cron_last', time());

    // If this site acts as a Drupal XML-RPC server, delete the sites that
    // stopped sending "ping" messages.
    db_query("DELETE FROM {directory} WHERE timestamp < '" . (time() - 259200) . "'");

    // If this site acts as a Drupal XML-RPC client, send a message to the
    // Drupal XML-RPC server.
    if (variable_get('drupal_directory', 0) && variable_get('drupal_server', 0)) {
      drupal_notify(variable_get('drupal_server', ''));
    }
  }
}