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=cab71bfdefa36e700cf4a450443a91edde9cc5d5;hp=0b1ea20922c33e19a134fb8c3314d227489c27d3;hb=af6d1fb995500ae68849458ee10d66abbdcfb252;hpb=680c79a86e3ed402f263faeac92e89fb6d9edcc0 diff --git a/web/modules/contrib/linkchecker/linkchecker.redirect.inc b/web/modules/contrib/linkchecker/linkchecker.redirect.inc index 0b1ea2092..cab71bfde 100644 --- a/web/modules/contrib/linkchecker/linkchecker.redirect.inc +++ b/web/modules/contrib/linkchecker/linkchecker.redirect.inc @@ -5,6 +5,8 @@ * Redirect interface to linkchecker functionalities. */ +use Drupal\Core\Url; + /** * Implements hook_redirect_insert(). */ @@ -17,15 +19,15 @@ function linkchecker_redirect_insert($redirect) { */ function linkchecker_redirect_update($redirect) { // It's unknown if this is a redirect for HTTP/HTTPS or the encoded urls. - $url_http = url($redirect->source, array('absolute' => TRUE, $redirect->source_options)); - $url_https = url($redirect->source, array('absolute' => TRUE, 'https' => TRUE, $redirect->source_options)); + $url_http = Url::fromUri('internal:' . $redirect->source)->toString(); + $url_https = Url::fromUri('internal:' . $redirect->source, ['https' => TRUE])->toString(); - $urls = array( + $urls = [ $url_http, $url_https, rawurldecode($url_http), rawurldecode($url_https), - ); + ]; _linkchecker_redirect_reset($urls); } @@ -36,17 +38,16 @@ function linkchecker_redirect_update($redirect) { * @param array $urls * An array of urls that should be checked on next cron run. */ -function _linkchecker_redirect_reset($urls = array()) { +function _linkchecker_redirect_reset(array $urls = []) { $urls = array_unique($urls); - - $num_updated = db_update('linkchecker_link') - ->condition('urlhash', array_map('drupal_hash_base64', $urls)) + $num_updated = \Drupal::database()->update('linkchecker_link') + ->condition('urlhash', array_map('\Drupal\Component\Utility\Crypt::hashBase64', $urls)) ->condition('fail_count', 0, '>') ->condition('status', 1) - ->fields(array('last_checked' => 0)) + ->fields(['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]))); + drupal_set_message(t('The link %url will be checked again on the next cron run.', ['%url' => $urls[0]])); } }