X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=web%2Fmodules%2Fcontrib%2Flinkchecker%2Flinkchecker.redirect.inc;fp=web%2Fmodules%2Fcontrib%2Flinkchecker%2Flinkchecker.redirect.inc;h=0b1ea20922c33e19a134fb8c3314d227489c27d3;hp=0000000000000000000000000000000000000000;hb=8acec36f19c470dfcda1ae2336826a782f41874c;hpb=e0411c4e83ba0d079034db83c3f7f55be24a0e35 diff --git a/web/modules/contrib/linkchecker/linkchecker.redirect.inc b/web/modules/contrib/linkchecker/linkchecker.redirect.inc new file mode 100644 index 000000000..0b1ea2092 --- /dev/null +++ b/web/modules/contrib/linkchecker/linkchecker.redirect.inc @@ -0,0 +1,52 @@ +source, array('absolute' => TRUE, $redirect->source_options)); + $url_https = url($redirect->source, array('absolute' => TRUE, 'https' => TRUE, $redirect->source_options)); + + $urls = array( + $url_http, + $url_https, + rawurldecode($url_http), + rawurldecode($url_https), + ); + + _linkchecker_redirect_reset($urls); +} + +/** + * Reset last_checked status. + * + * @param array $urls + * An array of urls that should be checked on next cron run. + */ +function _linkchecker_redirect_reset($urls = array()) { + $urls = array_unique($urls); + + $num_updated = db_update('linkchecker_link') + ->condition('urlhash', array_map('drupal_hash_base64', $urls)) + ->condition('fail_count', 0, '>') + ->condition('status', 1) + ->fields(array('last_checked' => 0)) + ->execute(); + + if ($num_updated) { + drupal_set_message(t('The link %url will be checked again on the next cron run.', array('%url' => $urls[0]))); + } +}