- Made the Drupal sites ping less often (only once every 6 hours), added
some logic to prevent duplicate items at a best effort basis, and made the server-side watchdogs slightly less verbose (still in testing mode though).4.0.x
parent
124e50c845
commit
a5b2ef7494
|
@ -8,22 +8,24 @@ function drupal_conf_options() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function drupal_cron() {
|
function drupal_cron() {
|
||||||
|
if (time() - variable_get("drupal_cron_last", 0) > 21600) {
|
||||||
|
variable_set("drupal_cron_last", time());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** If this site acts as a Drupal XML-RPC server, delete the sites that
|
** If this site acts as a Drupal XML-RPC server, delete the sites that
|
||||||
** stopped sending "ping" messages.
|
** stopped sending "ping" messages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'");
|
db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** If this site acts as a Drupal XML-RPC client, send a message to the
|
** If this site acts as a Drupal XML-RPC client, send a message to the
|
||||||
** Drupal XML-RPC server.
|
** Drupal XML-RPC server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) {
|
||||||
if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) {
|
drupal_notify(variable_get("drupal_server", ""));
|
||||||
drupal_notify(variable_get("drupal_server", ""));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ function drupal_directory_ping($arguments) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($link && $name && $mail && $slogan && $mission) {
|
if ($link && $name && $mail && $slogan && $mission) {
|
||||||
db_query("DELETE FROM directory WHERE link = '". check_query($link) ."'");
|
db_query("DELETE FROM directory WHERE link = '". check_query($link) ."' OR mail = '". check_query($mail) ."'");
|
||||||
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
|
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
|
||||||
|
|
||||||
watchdog("message", "directory: ping from '$name' ($link)");
|
watchdog("message", "directory: ping from '$name' ($link)");
|
||||||
|
|
|
@ -8,22 +8,24 @@ function drupal_conf_options() {
|
||||||
}
|
}
|
||||||
|
|
||||||
function drupal_cron() {
|
function drupal_cron() {
|
||||||
|
if (time() - variable_get("drupal_cron_last", 0) > 21600) {
|
||||||
|
variable_set("drupal_cron_last", time());
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** If this site acts as a Drupal XML-RPC server, delete the sites that
|
** If this site acts as a Drupal XML-RPC server, delete the sites that
|
||||||
** stopped sending "ping" messages.
|
** stopped sending "ping" messages.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'");
|
db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
** If this site acts as a Drupal XML-RPC client, send a message to the
|
** If this site acts as a Drupal XML-RPC client, send a message to the
|
||||||
** Drupal XML-RPC server.
|
** Drupal XML-RPC server.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) {
|
||||||
if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) {
|
drupal_notify(variable_get("drupal_server", ""));
|
||||||
drupal_notify(variable_get("drupal_server", ""));
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -49,7 +51,7 @@ function drupal_directory_ping($arguments) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
if ($link && $name && $mail && $slogan && $mission) {
|
if ($link && $name && $mail && $slogan && $mission) {
|
||||||
db_query("DELETE FROM directory WHERE link = '". check_query($link) ."'");
|
db_query("DELETE FROM directory WHERE link = '". check_query($link) ."' OR mail = '". check_query($mail) ."'");
|
||||||
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
|
db_query("INSERT INTO directory (link, name, mail, slogan, mission, timestamp) VALUES ('". check_query($link) ."', '". check_query($name) ."', '". check_query($mail) ."', '". check_query($slogan) ."', '". check_query($mission) ."', '". time() ."')");
|
||||||
|
|
||||||
watchdog("message", "directory: ping from '$name' ($link)");
|
watchdog("message", "directory: ping from '$name' ($link)");
|
||||||
|
|
Loading…
Reference in New Issue