RCS file: /cvs/drupal-contrib/contributions/modules/janode/janode.module,v retrieving revision 1.2 diff -u -p -r1.2 janode.module --- janode.module 24 May 2006 00:12:55 -0000 1.2 +++ janode.module 25 May 2006 23:42:34 -0000 @@ -34,6 +34,7 @@ class _janode_defaults { // place a limit on how many nodes to 404 check on each cron run var $index_how_many_per_cron = 10; + var $enable_404_check = 1; // the follow control theme appearence var $html_link_class = 'class="janode_link"'; @@ -147,6 +148,12 @@ function janode_settings() { '#description' => t('The maximum janodes to 404 test on each cron run. '. "Don't set this too high or the cron may stall.") ); + $form['janode']['enable_404_check'] = array( + '#type' => 'checkbox', + '#title' => t('Enable link checking by cron'), + '#default_value' => _janode_local_settings('enable_404_check'), + '#description' => t('Uncheck to disable link checking by cron') + ); $form['janode']['markup1'] = array( '#type' => 'markup', '#value' => t('The following allow the admin to "wrap" the link up in custom html') @@ -332,6 +339,10 @@ function theme_janode_http_link($node) { */ function janode_cron() { + if (!(int)_janode_local_settings('enable_404_check')) { + return; + } + $max_to_do = (int)_janode_local_settings('index_how_many_per_cron'); $limit_sql = ($max_to_do > 0) ? ("LIMIT $max_to_do") : (""); $r = db_query("SELECT * FROM {janode} ORDER BY last_checked ASC $limit_sql"); @@ -356,6 +367,16 @@ function janode_cron() { * void, act's directly on the db table */ function _janode_check_404($janode) { + static $message_once_65467 = TRUE; + + // check php var "allow_url_fopen" is true as we need it to fetch the URL + if (!ini_get('allow_url_fopen')) { + if ($message_once_65467) { + watchdog('cron', 'PHP INI "allow_url_fopen" is false', WATCHDOG_NOTICE); + $message_once_65467 = FALSE; + return; + } + } // There are a number of HTTP status return codes. However, below 300 // usually means all went ok. We use 250 series for our own internal