| Versions | |
|---|---|
| 4.7 – 5 | drupal_notify($server) |
Sends a ping to the Drupal directory server.
modules/
<?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);
}
}
?>