function redirect_update_7102 in Redirect 7.2
Same name and namespace in other branches
- 7 redirect.install \redirect_update_7102()
Disable redirects that could cause infinite loops.
File
- ./
redirect.install, line 273 - Install, update and uninstall functions for the redirect module.
Code
function redirect_update_7102() {
$rids = db_query("SELECT r.rid FROM {redirect} r INNER JOIN {url_alias} u ON r.source = u.alias AND r.redirect = u.source AND r.language = u.language")
->fetchCol();
if ($rids) {
// Disable redirects
$count = db_update('redirect')
->fields(array(
'status' => 0,
))
->condition('rid', $rids)
->execute();
$disabled_redirects_message = format_plural($count, '1 circular redirect causing infinite loop was disabled.', '@count circular redirects causing infinite loop were disabled.');
return $disabled_redirects_message;
}
else {
return t('No circular redirects were found that could cause infinite loops.');
}
}