function lc_DoLinkChecks in Link checker 5
1 call to lc_DoLinkChecks()
- linkchecker_cron in ./
linkchecker.module - Implementation of hook_cron() Rebuild the table if necessary.
File
- ./
linkchecker.module, line 306 - This module periodically check html links referenced by drupal nodes Developed and maintained by Marek Tichy, marek@ecn.cz
Code
function lc_DoLinkChecks($task, $maxtime, &$report) {
$nid = lc_Task2Nid($task);
d_("Loading node {$nid}");
$node = node_load($nid);
$nodecontent = node_view($node);
$uurls = lc_RandReduce(lc_GetUniqueUrls($nodecontent));
d_("Checking " . sizeof($uurls) . " links.");
foreach ($uurls as $url) {
if (lc_CheckRuntime($maxtime) == false) {
d_("Time is up, bailing out");
return false;
}
d_("<br />Testing {$url} found in node {$nid}");
$r = trim(lc_GetResponse($url));
list($code) = split(" ", $r);
d_("<br />Got response code: {$code} ( {$r} )");
if ($code >= "400" || $code < 0) {
if (!lc_ignore_response($r, $code)) {
$report[] = array(
'taskid' => $task["taskid"],
'url' => $url,
'response' => $r,
);
}
else {
d_("<br />Ignoring response: {$code} ( {$r} )");
}
}
}
unset($node);
unset($nodecontent);
return true;
}