Skip to content
Snippets Groups Projects
Commit 9cb1bc4c authored by Dries Buytaert's avatar Dries Buytaert
Browse files

- Substituted the weblogs module with a more generic ping module.  We're
  now pinging http://blo.gs/ as well as support the new Weblogs.com RSS
  format.  Thanks Breyten.
parent c9157a23
No related branches found
No related tags found
2 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!789Issue #3210310: Adjust Database API to remove deprecated Drupal 9 code in Drupal 10
<?php
// $Id$
function ping_help() {
$output = "<p>Drupal can pings sites automatically to notify them that your site has changed. It can ping the following sites :</p>";
$output .= "<p><a href=\"http://www.weblogs.com/\">Weblogs.com</a>, a website that tracks and displays links to changed weblogs and news-oriented websites. To get your Drupal site listed, weblogs.com must be informed about your site's updates. This is the job of the ping module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://www.weblogs.com/\">weblogs.com system</a>. The weblog module automatically notifies weblogs.com when your site is updated. To do so, Drupal implements the <a href=\"http://www.xmlrpc.com/weblogsCom/\">XML-RPC interface of weblogs.com</a>.</p>";
$output .= "<p><a href=\"http://www.xmlrpc.com/weblogsComForRss\">Weblogs.Com for RSS</a>, a website that tracks and displays links to recently changed RSS feeds in XML format. To get your Drupal site listed, weblogs.com for RSS must be informed about updates to your RSS feed. This is the job of the ping module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://www.weblogs.com/rssUpdates/changes.xml\">weblogs.com for RSS system</a>. The ping module automatically notifies weblogs.com for RSS when your site is updated.</p>";
$output .= "<p><a href=\"http://blo.gs/\">blo.gs</a>, a directory of recently updated weblogs and tools for tracking interesting weblogs, in the spirit of services like <a href=\"http://www.weblogs.com/\">weblogs.com</a>, <a href=\"http://www.dansanderson.com/blogtracker/\">blogtracker</a> and <a href=\"http://www.blogrolling.com/\">blogrolling.com</a>. To get your Drupal site listed, blo.gs must be informed about your site's updates. This is the job of the ping module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://blo.gs/\">blo.gs system</a>. The ping module automatically notifies blo.gs when your site is updated. To do so, Drupal implements the <a href=\"http://blo.gs/ping.php\">XML-RPC interface of blo.gs</a>.</p>";
// for optional modules that ping other sites
// $output .= module_invoke_all("ping_help");
$output .= "<p>The ping feature requires crontab.</p>";
print $output;
}
function ping_system($field){
$system["description"] = t("Alerts other site(s) that your site has been updated.");
return $system[$field];
}
function ping_cron() {
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 moderate = 0 AND (created > '". variable_get("ping_cron_last", time()) ."' OR changed > '". variable_get("ping_cron_last", time()) ."')"), 1)) {
_ping_notify(variable_get("site_name", "") ." - ". variable_get("site_slogan", ""), path_uri());
}
variable_set("ping_cron_last", time());
}
}
function _ping_notify($name, $url) {
module_invoke_all("ping", $name, $url);
}
function ping_ping($name = "", $url = "") {
$feed = $url . drupal_url(array("mod" => "node", "op" => "feed"), "module");
$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' (site)");
}
unset($client);
$client = new xmlrpc_client("/RPC2", "rssrpc.weblogs.com", 80);
$message = new xmlrpcmsg("rssUpdate", array(new xmlrpcval($name), new xmlrpcval($feed)));
$result = $client->send($message);
if (!$result || $result->faultCode()) {
watchdog("error", "failed to notify 'weblogs.com' (RSS)");
}
unset($client);
$client = new xmlrpc_client("/", "ping.blo.gs", 80);
$message = new xmlrpcmsg("weblogUpdates.extendedPing", array(new xmlrpcval($name), new xmlrpcval($url), new xmlrpcval($url), new xmlrpcval($feed)));
$result = $client->send($message);
if (!$result || $result->faultCode()) {
watchdog("error", "failed to notify 'blo.gs' ");
}
}
?>
<?php
// $Id$
function ping_help() {
$output = "<p>Drupal can pings sites automatically to notify them that your site has changed. It can ping the following sites :</p>";
$output .= "<p><a href=\"http://www.weblogs.com/\">Weblogs.com</a>, a website that tracks and displays links to changed weblogs and news-oriented websites. To get your Drupal site listed, weblogs.com must be informed about your site's updates. This is the job of the ping module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://www.weblogs.com/\">weblogs.com system</a>. The weblog module automatically notifies weblogs.com when your site is updated. To do so, Drupal implements the <a href=\"http://www.xmlrpc.com/weblogsCom/\">XML-RPC interface of weblogs.com</a>.</p>";
$output .= "<p><a href=\"http://www.xmlrpc.com/weblogsComForRss\">Weblogs.Com for RSS</a>, a website that tracks and displays links to recently changed RSS feeds in XML format. To get your Drupal site listed, weblogs.com for RSS must be informed about updates to your RSS feed. This is the job of the ping module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://www.weblogs.com/rssUpdates/changes.xml\">weblogs.com for RSS system</a>. The ping module automatically notifies weblogs.com for RSS when your site is updated.</p>";
$output .= "<p><a href=\"http://blo.gs/\">blo.gs</a>, a directory of recently updated weblogs and tools for tracking interesting weblogs, in the spirit of services like <a href=\"http://www.weblogs.com/\">weblogs.com</a>, <a href=\"http://www.dansanderson.com/blogtracker/\">blogtracker</a> and <a href=\"http://www.blogrolling.com/\">blogrolling.com</a>. To get your Drupal site listed, blo.gs must be informed about your site's updates. This is the job of the ping module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://blo.gs/\">blo.gs system</a>. The ping module automatically notifies blo.gs when your site is updated. To do so, Drupal implements the <a href=\"http://blo.gs/ping.php\">XML-RPC interface of blo.gs</a>.</p>";
// for optional modules that ping other sites
// $output .= module_invoke_all("ping_help");
$output .= "<p>The ping feature requires crontab.</p>";
print $output;
}
function ping_system($field){
$system["description"] = t("Alerts other site(s) that your site has been updated.");
return $system[$field];
}
function ping_cron() {
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 moderate = 0 AND (created > '". variable_get("ping_cron_last", time()) ."' OR changed > '". variable_get("ping_cron_last", time()) ."')"), 1)) {
_ping_notify(variable_get("site_name", "") ." - ". variable_get("site_slogan", ""), path_uri());
}
variable_set("ping_cron_last", time());
}
}
function _ping_notify($name, $url) {
module_invoke_all("ping", $name, $url);
}
function ping_ping($name = "", $url = "") {
$feed = $url . drupal_url(array("mod" => "node", "op" => "feed"), "module");
$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' (site)");
}
unset($client);
$client = new xmlrpc_client("/RPC2", "rssrpc.weblogs.com", 80);
$message = new xmlrpcmsg("rssUpdate", array(new xmlrpcval($name), new xmlrpcval($feed)));
$result = $client->send($message);
if (!$result || $result->faultCode()) {
watchdog("error", "failed to notify 'weblogs.com' (RSS)");
}
unset($client);
$client = new xmlrpc_client("/", "ping.blo.gs", 80);
$message = new xmlrpcmsg("weblogUpdates.extendedPing", array(new xmlrpcval($name), new xmlrpcval($url), new xmlrpcval($url), new xmlrpcval($feed)));
$result = $client->send($message);
if (!$result || $result->faultCode()) {
watchdog("error", "failed to notify 'blo.gs' ");
}
}
?>
<?php
// $Id$
function weblogs_help() {
$output = "<p><a href=\"http://www.weblogs.com/\">Weblogs.com</a> is a website that tracks and displays links to changed weblogs and news-oriented websites. To get your Drupal site listed, weblogs.com must be informed about your site's updates. This is the job of the weblog module and when installed, the administrator doesn't have to do anything to participate in the <a href=\"http://www.weblogs.com/\">weblogs.com system</a>. The weblog module automatically notifies weblogs.com when your site is updated. To do so, Drupal implements the <a href=\"http://www.xmlrpc.com/weblogsCom/\">XML-RPC interface of weblogs.com</a>. Requires crontab.</p>";
return $output;
}
function weblogs_system($field){
$system["description"] = t("Alerts weblogs.com that your site has been updated.");
return $system[$field];
}
function weblogs_cron() {
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 moderate = 0 AND (created > '". variable_get("weblogs_cron_last", time()) ."' OR changed > '". variable_get("weblogs_cron_last", time()) ."')"), 1)) {
weblogs_notify(variable_get("site_name", "") ." - ". variable_get("site_slogan", ""), 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' (site)");
}
$feed = $url . drupal_url(array("mod" => "node", "op" => "feed"), "module");
$message = new xmlrpcmsg("weblogUpdates.ping", array(new xmlrpcval($name), new xmlrpcval($feed), new xmlrpcval($feed), new xmlrpcval("rss")));
$result = $client->send($message);
if (!$result || $result->faultCode()) {
watchdog("error", "failed to notify 'weblogs.com' (RSS)");
}
}
?>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment