diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-10-02 20:15:21 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-10-02 20:15:21 +0000 |
commit | 4050feefce577a48a476e8dfcf4a631d97dbf48b (patch) | |
tree | c9c34482d26c80f07b1c2ad6c631d249a7ca2cdf | |
parent | 7e7c457cf6822a4b9bba82a4f7d6532fb341b6b1 (diff) | |
download | brdo-4050feefce577a48a476e8dfcf4a631d97dbf48b.tar.gz brdo-4050feefce577a48a476e8dfcf4a631d97dbf48b.tar.bz2 |
- a small module to notify or ping weblogs.com
-rw-r--r-- | modules/weblogs.module | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/modules/weblogs.module b/modules/weblogs.module new file mode 100644 index 000000000..5490572cf --- /dev/null +++ b/modules/weblogs.module @@ -0,0 +1,24 @@ +<? + +function weblogs_cron() { + + if (db_num_rows(db_query("SELECT nid FROM node WHERE status = '". node_status("posted") ."' AND timestamp > '". variable_get("weblogs_cron_last", time()) ."'", 1))) { + weblogs_notify(variable_get("site_name", "drupal") , path_uri()); + } + variable_set("weblogs_cron_last", time()); +} + +function weblogs_notify($name, $url) { + + $client = new xmlrpc_client("/RPC2", "rpc.weblogs.com", 80); + + $message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval($name), new xmlrpcval($url))); + + $result = $client->send($message); + + if (!$result || $result->faultCode()) { + watchdog("error", "failed to notify 'weblogs.com'"); + } +} + +?>
\ No newline at end of file |