From a5b2ef7494fa50bfd15c8edf462c8ca7e1978291 Mon Sep 17 00:00:00 2001 From: Dries Buytaert Date: Mon, 17 Dec 2001 19:14:07 +0000 Subject: - 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). --- modules/drupal.module | 28 +++++++++++++++------------- modules/drupal/drupal.module | 28 +++++++++++++++------------- 2 files changed, 30 insertions(+), 26 deletions(-) (limited to 'modules') diff --git a/modules/drupal.module b/modules/drupal.module index a32303731..5c00536a9 100644 --- a/modules/drupal.module +++ b/modules/drupal.module @@ -8,22 +8,24 @@ function drupal_conf_options() { } 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 - ** stopped sending "ping" messages. - */ - - db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'"); + /* + ** If this site acts as a Drupal XML-RPC server, delete the sites that + ** stopped sending "ping" messages. + */ - /* - ** If this site acts as a Drupal XML-RPC client, send a message to the - ** Drupal XML-RPC server. - */ + db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'"); + /* + ** If this site acts as a Drupal XML-RPC client, send a message to the + ** Drupal XML-RPC server. + */ - if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) { - drupal_notify(variable_get("drupal_server", "")); + if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) { + drupal_notify(variable_get("drupal_server", "")); + } } } @@ -49,7 +51,7 @@ function drupal_directory_ping($arguments) { */ 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() ."')"); watchdog("message", "directory: ping from '$name' ($link)"); diff --git a/modules/drupal/drupal.module b/modules/drupal/drupal.module index a32303731..5c00536a9 100644 --- a/modules/drupal/drupal.module +++ b/modules/drupal/drupal.module @@ -8,22 +8,24 @@ function drupal_conf_options() { } 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 - ** stopped sending "ping" messages. - */ - - db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'"); + /* + ** If this site acts as a Drupal XML-RPC server, delete the sites that + ** stopped sending "ping" messages. + */ - /* - ** If this site acts as a Drupal XML-RPC client, send a message to the - ** Drupal XML-RPC server. - */ + db_query("DELETE FROM directory WHERE timestamp < '". (time() - 259200) ."'"); + /* + ** If this site acts as a Drupal XML-RPC client, send a message to the + ** Drupal XML-RPC server. + */ - if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) { - drupal_notify(variable_get("drupal_server", "")); + if (variable_get("drupal_directory", 0) && variable_get("drupal_server", 0)) { + drupal_notify(variable_get("drupal_server", "")); + } } } @@ -49,7 +51,7 @@ function drupal_directory_ping($arguments) { */ 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() ."')"); watchdog("message", "directory: ping from '$name' ($link)"); -- cgit v1.2.3