From 63fbce82b2b24d4c3542373a4c842f2c6399101c Mon Sep 17 00:00:00 2001
From: Dries Buytaert
'. t('The ping module requires cron
or a similar periodic job scheduler to be enabled.') .'
You can:
-'. t('For more information please read the configuration and customization handbook Ping page.', array('%ping' => 'http://drupal.org/handbook/modules/ping/')) .'
'; - return $output; - case 'admin/modules#description': - return t('Alerts other sites when your site has been updated.'); - } -} - -/** - * Implementation of hook_cron(). - * - * Fire off notifications of updates to remote sites. - */ -function ping_cron() { - global $base_url; - - if (variable_get('site_name', 0) && variable_get('site_slogan', 0)) { - if (db_num_rows(db_query("SELECT nid FROM {node} WHERE status = 1 AND (created > '". variable_get('cron_last', time()) ."' OR changed > '". variable_get('cron_last', time()) ."')"))) { - _ping_notify(variable_get('site_name', '') .' - '. variable_get('site_slogan', ''), $base_url); - } - } -} - -/** - * Call hook_ping() in all modules to notify remote sites that there is - * new content at this one. - */ -function _ping_notify($name, $url) { - module_invoke_all('ping', $name, $url); -} - -/** - * Implementation of hook_ping(). - * - * Notifies pingomatic.com, blo.gs, and technorati.com of changes at this site. - */ -function ping_ping($name = '', $url = '') { - - $result = xmlrpc('http://rpc.pingomatic.com', 'weblogUpdates.ping', $name, $url); - - if ($result === FALSE) { - watchdog('directory ping', t('Failed to notify pingomatic.com (site).'), WATCHDOG_WARNING); - } -} - - -- cgit v1.2.3