You are here

function linkchecker_update_6220 in Link checker 6.2

Upgrade outdated HTTP user agents.

File

./linkchecker.install, line 675
Installation file for Link Checker module.

Code

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;
}