Update of /cvsroot/phpmix/drupal/modules/akismet
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv14040
Modified Files:
akismet.module
Log Message:
Woohoo, forgot to call the version checker from cron.
Implemented cron using register_shutdown_function.
Also, fixed a couple of minor typos
Index: akismet.module
===================================================================
RCS file: /cvsroot/phpmix/drupal/modules/akismet/akismet.module,v
retrieving revision 1.12
retrieving revision 1.13
diff -C2 -d -r1.12 -r1.13
*** akismet.module 10 Jun 2006 00:57:54 -0000 1.12
--- akismet.module 10 Jun 2006 01:51:37 -0000 1.13
***************
*** 41,44 ****
--- 41,45 ----
*/
function _akismet_check_version($refresh = FALSE) {
+ global $base_url;
$version_string = variable_get('akismet_version_string', FALSE);
$timestamp_now = time();
***************
*** 57,61 ****
if ($refresh) {
$version_url = AKISMET_MODULE_HOMEURL .'/version';
! $result = drupal_http_request($version_url);
if (!isset($result->code) || !in_array($result->code, array(200,302,307)) || empty($result->data)) {
watchdog('version check', t('Could not check version of akismet module, due to "%error".', array('%error' => theme('placeholder', $result->code .' '. $result->error))), WATCHDOG_ERROR, l(t('check'), $version_url, array('target'=>'_blank'), NULL, NULL, TRUE));
--- 58,62 ----
if ($refresh) {
$version_url = AKISMET_MODULE_HOMEURL .'/version';
! $result = drupal_http_request($version_url, array('User-Agent' => AKISMET_USERAGENT, 'Referer' => $base_url . base_path()));
if (!isset($result->code) || !in_array($result->code, array(200,302,307)) || empty($result->data)) {
watchdog('version check', t('Could not check version of akismet module, due to "%error".', array('%error' => theme('placeholder', $result->code .' '. $result->error))), WATCHDOG_ERROR, l(t('check'), $version_url, array('target'=>'_blank'), NULL, NULL, TRUE));
***************
*** 183,186 ****
--- 184,195 ----
*/
function akismet_cron() {
+ register_shutdown_function('akismet_cron_shutdown');
+ }
+ function akismet_cron_shutdown() {
+ watchdog('cron', t('Akismet cron started at %time.', array('%time' => format_date(time(), 'custom', 'H:i:s'))));
+
+ // Update version information, if requested to.
+ _akismet_check_version();
+
// Expired content spam that we have to remove from each content repository.
$expired_content_spam = array('nids'=>array(), 'cids'=>array());
***************
*** 291,294 ****
--- 300,304 ----
akismet_clear_cache();
}
+ watchdog('cron', t('Akismet cron completed at %time.', array('%time' => format_date(time(), 'custom', 'H:i:s'))));
}
***************
*** 509,513 ****
'#type' => 'date', '#title' => t('Counting since'),
'#default_value' => variable_get('akismet_counter_since', array('day' => date('j'), 'month' => date('n'), 'year' => date('Y'))),
! '#description' => t('This is the date that will tell your visitor when your Akismet spam counter started to increment.')
);
$form['counter_options']['akismet_counter_date_format'] = array(
--- 519,523 ----
'#type' => 'date', '#title' => t('Counting since'),
'#default_value' => variable_get('akismet_counter_since', array('day' => date('j'), 'month' => date('n'), 'year' => date('Y'))),
! '#description' => t('This is the date that will tell your visitors when your Akismet spam counter started to increment.')
);
$form['counter_options']['akismet_counter_date_format'] = array(
|