function drupal_cron in Drupal 4
Same name and namespace in other branches
- 5 modules/drupal/drupal.module \drupal_cron()
Implementation of hook_cron(); handles pings to and from the site.
File
- modules/
drupal.module, line 140 - 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('cron_last', 0) > 21600) {
// If this site acts as a Drupal XML-RPC server, delete the sites that
// stopped sending "ping" messages.
if (variable_get('drupal_client_service', 0)) {
$result = db_query("SELECT cid FROM {client} WHERE changed < %d", time() - 259200);
while ($client = db_fetch_object($result)) {
db_query("DELETE FROM {client_system} WHERE cid = %d", $client->cid);
db_query("DELETE FROM {client} WHERE cid = %d", $client->cid);
}
}
// If this site acts as a Drupal XML-RPC client, send a message to the
// Drupal XML-RPC server.
if (variable_get('drupal_register', 0) && variable_get('drupal_server', 0)) {
drupal_notify(variable_get('drupal_server', ''));
}
}
}