Community Documentation

drupal_notify

5 drupal.module drupal_notify($server)

Sends a ping to the Drupal directory server.

▾ 1 function calls drupal_notify()

drupal_cron in modules/drupal/drupal.module
Implementation of hook_cron(); handles pings to and from the site.

File

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

Code

<?php
function drupal_notify($server) {
  global $base_url;
  $client = array(
    'link' => $base_url, 
    'name' => variable_get('site_name', ''), 
    'mail' => variable_get('site_mail', ''), 
    'slogan' => variable_get('site_slogan', ''), 
    'mission' => variable_get('site_mission', ''), 
    'version' => VERSION,
  );
  if (variable_get('drupal_system', 0)) {
    $system = array();
    $result = db_query("SELECT name, type FROM {system} WHERE status = 1");
    while ($item = db_fetch_array($result)) {
      $system[] = $item;
    }
  }
  if (variable_get('drupal_statistics', 0)) {
    $users = db_fetch_object(db_query("SELECT COUNT(uid) AS count FROM {users}"));
    $client['users'] = $users->count;
    $nodes = db_fetch_object(db_query("SELECT COUNT(nid) AS count FROM {node}"));
    $client['nodes'] = $nodes->count;
  }
  $result = xmlrpc($server, 'drupal.client.ping', $client, $system);

  if ($result === FALSE) {
    watchdog('server ping', t('Failed to notify %server; error code: %errno; error message: %error_msg.', array('%server' => $server, '%errno' => xmlrpc_errno(), '%error_msg' => xmlrpc_error_msg())), WATCHDOG_WARNING);
  }
}
?>
Login or register to post comments