@@ -123,11 +123,31 @@ function linkchecker_admin_settings_form(&$form_state) {
'#description'=>t('If a filter has been enabled for an input format it runs first and afterwards the link extraction. This helps the link checker module to find all links normally created by custom filters (e.g. Markdown filter, Bbcode). All filters used as an inline references (e.g. Weblink filter <code>[link: id]</code>) to other content and filters only wasting processing time (e.g. Line break converter) should be disabled. This setting does not have any effect on how content is shown on a page. This feature optimizes the internal link extraction process for link checker and prevents false alarms about broken links in content not having the real data of a link.'),
);
$count_lids_enabled=db_result(db_query("SELECT count(lid) FROM {linkchecker_links} WHERE status = %d",1));
$count_lids_disabled=db_result(db_query("SELECT count(lid) FROM {linkchecker_links} WHERE status = %d",0));
$form['check']=array(
'#type'=>'fieldset',
'#title'=>t('Check settings'),
'#description'=>t('For simultaneous link checks it is recommended to install the <a href="@httprl">HTTP Parallel Request & Threading Library</a>. This may be <strong>necessary</strong> on larger sites with very many links (30.000+), but will also improve overall link check duration on smaller sites. Currently the site has @count links (@count_enabled enabled / @count_disabled disabled).',array('@httprl'=>'http://drupal.org/project/httprl','@count'=>$count_lids_enabled+$count_lids_disabled,'@count_enabled'=>$count_lids_enabled,'@count_disabled'=>$count_lids_disabled)),
'#title'=>t('Number of simultaneous connections'),
'#description'=>t('Defines the maximum number of simultaneous connections that can be opened by the server. <em>HTTP Parallel Request & Threading Library</em> make sure that a single domain is not overloaded beyond RFC limits. For small hosting plans with very limited CPU and RAM it may be required to reduce the default limit.'),
$result=db_query_range("SELECT * FROM {linkchecker_links} WHERE last_checked < %d AND status = %d ORDER BY last_checked, lid ASC",time()-$linkchecker_check_links_interval,1,0,$check_links_max_per_cron_run);
while($link=db_fetch_object($result)){
$links=db_query_range("SELECT * FROM {linkchecker_links} WHERE last_checked < %d AND status = %d ORDER BY last_checked, lid ASC",time()-$linkchecker_check_links_interval,1,0,$check_links_max_per_cron_run);
// - Prevent E_ALL warnings in DB updates for non-existing $response->error.
...
...
@@ -411,6 +495,11 @@ function _linkchecker_status_handling($link, $response) {
}
switch($response->code){
case-4:// HTTPRL: httprl_send_request timed out.
// Skip these and try them again next cron run.
break;
case-2:// HTTPRL: maximum allowed redirects exhausted.
case301:
db_query("UPDATE {linkchecker_links} SET code = %d, error = '%s', fail_count = fail_count+1, last_checked = %d WHERE lid = %d",$response->redirect_code,$response->status_message,time(),$link->lid);
...
...
@@ -481,9 +570,9 @@ function _linkchecker_status_handling($link, $response) {
node_save($node);
watchdog('linkchecker','Changed permanently moved link in %node from %src to %dst.',array('%node'=>url('node/'.$row->nid),'%src'=>$link->url,'%dst'=>$response->redirect_url),WATCHDOG_INFO);
}
else{
watchdog('linkchecker','Link update in node failed. Permanently moved link %src not found in node %node. Manual fix required.',array('%node'=>url('node/'.$row->nid),'%src'=>$link->url),WATCHDOG_WARNING);
}
else{
watchdog('linkchecker','Link update in node failed. Permanently moved link %src not found in node %node. Manual fix required.',array('%node'=>url('node/'.$row->nid),'%src'=>$link->url),WATCHDOG_WARNING);
}
}
// COMMENTS: Autorepair all comments having this outdated link.
...
...
@@ -531,7 +620,7 @@ function _linkchecker_status_handling($link, $response) {
// There is no hook that fires on block_box_save(), therefore do link
...
...
@@ -539,9 +628,9 @@ function _linkchecker_status_handling($link, $response) {
_linkchecker_add_box_links($box,$row->bid);
watchdog('linkchecker','Changed permanently moved link in box %bid from %src to %dst.',array('%bid'=>$row->bid,'%src'=>$link->url,'%dst'=>$response->redirect_url),WATCHDOG_INFO);
}
else{
watchdog('linkchecker','Link update in block failed. Permanently moved link %src not found in block %bid. Manual fix required.',array('%bid'=>$row->bid,'%src'=>$link->url),WATCHDOG_WARNING);
}
else{
watchdog('linkchecker','Link update in block failed. Permanently moved link %src not found in block %bid. Manual fix required.',array('%bid'=>$row->bid,'%src'=>$link->url),WATCHDOG_WARNING);
}
}
// Revert user back to anonymous.
...
...
@@ -597,6 +686,8 @@ function _linkchecker_status_handling($link, $response) {
//watchdog('linkchecker', 'Unhandled link error %link has been found.', array('%link' => $link->url), WATCHDOG_ERROR, l(t('Broken links'), 'admin/reports/linkchecker'));