drupal_notify

Versions
4.6 – 5
drupal_notify($server)

Sends a ping to the Drupal directory server.

▾ 1 function calls drupal_notify()

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

Code

modules/drupal.module, line 264

<?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' => theme('placeholder', $server), '%errno' => theme('placeholder', xmlrpc_errno()), '%error_msg' => theme('placeholder', xmlrpc_error_msg()))), WATCHDOG_WARNING);
  }
}
?>
Login or register to post comments
 
 

All source code and documentation on this site is released under the terms of the GNU General Public License, version 2 and later. Drupal is a registered trademark of Dries Buytaert.