New version 6.x-2.9 of Link Checker module

This commit is contained in:
Manuel Cillero 2017-08-05 01:49:58 +02:00
parent 28b61ec2d4
commit cd51ed4595
6 changed files with 52 additions and 11 deletions

View file

@ -27,7 +27,7 @@ SuiteDesk 0.1.0, 2017-07-24
+ Extended Path Aliases 6.x-1.3
+ Frequently Asked Questions 6.x-1.13
+ Lexicon 6.x-1.4
+ Link checker 6.x-2.8
+ Link checker 6.x-2.9
+ Node Comment 6.x-3.0-beta1
+ Pathauto 6.x-1.6
+ Recently read 6.x-1.0-beta1

View file

@ -1,3 +1,11 @@
linkchecker 6.x-2.9, August 6, 2016
-----------------------------------
* Upgrade outdated HTTP user agents.
* Issue #2664260 by hass: num_rows only exists in mysqli
* Fixed two typos
* Issue #2303177: "Back to Top" Page anchor being reported as a 404 error
linkchecker 6.x-2.8, June 7, 2014
---------------------------------

View file

@ -155,10 +155,10 @@ function linkchecker_admin_settings_form(&$form_state) {
'#default_value' => variable_get('linkchecker_check_useragent', 'Drupal (+http://drupal.org/)'),
'#options' => array(
'Drupal (+http://drupal.org/)' => 'Drupal (+http://drupal.org/)',
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)' => 'Windows 7 (x64), Internet Explorer 9.0',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0' => 'Windows 7 (x64), Mozilla Firefox 17.0',
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)' => 'Windows 8 (x64), Internet Explorer 10.0',
'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0' => 'Windows 8 (x64), Mozilla Firefox 17.0',
'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko' => 'Windows 8.1 (x64), Internet Explorer 11.0',
'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586' => 'Windows 10 (x64), Edge',
'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0' => 'Windows 8.1 (x64), Mozilla Firefox 47.0',
'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0' => 'Windows 10 (x64), Mozilla Firefox 47.0',
),
);
$form['check']['linkchecker_check_links_interval'] = array(

View file

@ -3,8 +3,8 @@ description = "Periodically checks for broken links in node types, blocks and cc
package = Core - extended
core = 6.x
; Information added by Drupal.org packaging script on 2014-06-07
version = "6.x-2.8"
; Information added by Drupal.org packaging script on 2016-08-05
version = "6.x-2.9"
core = "6.x"
project = "linkchecker"
datestamp = "1402132729"
datestamp = "1470438861"

View file

@ -668,3 +668,29 @@ function linkchecker_update_6219() {
return $ret;
}
/**
* Upgrade outdated HTTP user agents.
*/
function linkchecker_update_6220() {
$ret = array();
$linkchecker_check_useragent = variable_get('linkchecker_check_useragent', 'Drupal (+http://drupal.org/)');
$useragent_upgrade = array(
'Mozilla/5.0 (compatible; MSIE 9.0; Windows NT 6.1; WOW64; Trident/5.0)' => 'Mozilla/5.0 (Windows NT 6.3; WOW64; Trident/7.0; Touch; rv:11.0) like Gecko',
'Mozilla/5.0 (compatible; MSIE 10.0; Windows NT 6.2; WOW64; Trident/6.0)' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2486.0 Safari/537.36 Edge/13.10586',
'Mozilla/5.0 (Windows NT 6.1; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0' => 'Mozilla/5.0 (Windows NT 6.3; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0',
'Mozilla/5.0 (Windows NT 6.2; WOW64; rv:17.0) Gecko/20100101 Firefox/17.0' => 'Mozilla/5.0 (Windows NT 10.0; WOW64; rv:47.0) Gecko/20100101 Firefox/47.0',
);
if (isset($useragent_upgrade[$linkchecker_check_useragent])) {
variable_set('linkchecker_check_useragent', $useragent_upgrade[$linkchecker_check_useragent]);
$ret[] = array('success' => TRUE, 'query' => 'Upgraded outdated HTTP user agent.');
}
else {
$ret[] = array('success' => TRUE, 'query' => 'User agent already up to date.');
}
return $ret;
}

View file

@ -390,14 +390,14 @@ function _linkchecker_check_links() {
// run and guess that 2 links can be checked per second with 1 thread, what is
// nevertheless uncommon. The max_execution_time can be used to calculate
// a useful value that is higher, but not totally out of scope and limits the
// query resultset to a resonable size.
// query result set to a reasonable size.
$linkchecker_check_connections_max = variable_get('linkchecker_check_connections_max', 8);
$check_links_max_per_cron_run = ($has_httprl) ? ($linkchecker_check_connections_max * $max_execution_time) : $max_execution_time;
$linkchecker_check_links_interval = variable_get('linkchecker_check_links_interval', 2419200);
$linkchecker_check_useragent = variable_get('linkchecker_check_useragent', 'Drupal (+http://drupal.org/)');
// Connection limit can be overriden via settings.php. Two connections is the
// Connection limit can be overridden via settings.php. Two connections is the
// limit defined in RFC http://www.ietf.org/rfc/rfc2616.txt. Modern browsers
// are typically using 6-8 connections and no more. Never use more and keep
// in mind that you can overload other people servers.
@ -405,7 +405,10 @@ function _linkchecker_check_links() {
// Get URLs for checking.
$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);
$links_remaining = $links->num_rows;
// D6 database API does not provide a generic way to return the number of rows
// in a result set and $links->num_rows only works with 'mysqli'. The only
// workaround is to run the statement again with a COUNT query.
$links_remaining = db_result(db_query_range("SELECT COUNT(lid) AS num_rows 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($links)) {
$headers = array();
@ -518,10 +521,14 @@ function _linkchecker_status_handling(&$response, $link) {
// element (naming it with the name attribute), or by any other element
// (naming with the id attribute).
// See http://www.w3.org/TR/html401/struct/links.html
//
// Notes:
// - '#top' is a reserved fragment that must not exist in a page.
if ($response->code == 200
&& !empty($response->data)
&& !empty($response->headers['content-type'])
&& !empty($response->uri['fragment'])
&& !in_array($response->uri['fragment'], array('#top'))
&& in_array($response->headers['content-type'], array('text/html', 'application/xhtml+xml', 'application/xml'))
&& !preg_match('/(\s[^>]*(name|id)(\s+)?=(\s+)?["\'])(' . preg_quote($response->uri['fragment'], '/') . ')(["\'][^>]*>)/i', $response->data)
) {