diff options
author | Dries Buytaert <dries@buytaert.net> | 2001-12-17 19:14:07 +0000 |
---|---|---|
committer | Dries Buytaert <dries@buytaert.net> | 2001-12-17 19:14:07 +0000 |
commit | a5b2ef7494fa50bfd15c8edf462c8ca7e1978291 (patch) | |
tree | c0d59f8a2b8b676a8e834c34e7deb5a617997204 /modules | |
parent | 124e50c845c54658d3e70d289e28eb1e54fdfe4d (diff) | |
download | brdo-a5b2ef7494fa50bfd15c8edf462c8ca7e1978291.tar.gz brdo-a5b2ef7494fa50bfd15c8edf462c8ca7e1978291.tar.bz2 |
- 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).
Diffstat (limited to 'modules')
-rw-r--r-- | modules/drupal.module | 28 | ||||
-rw-r--r-- | modules/drupal/drupal.module | 28 |
2 files changed, 30 insertions, 26 deletions
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)"); |