function _linkchecker_cleanup_box_references in Link checker 5.2
Same name and namespace in other branches
- 6.2 linkchecker.module \_linkchecker_cleanup_box_references()
Cleanup no longer used box references to links in the linkchecker_boxes table.
1 call to _linkchecker_cleanup_box_references()
- _linkchecker_add_box_links in ./
linkchecker.module - Add box links to database.
File
- ./
linkchecker.module, line 1256 - This module periodically check links in given node types, blocks, cck fields, etc.
Code
function _linkchecker_cleanup_box_references($bid = 0, $links = array()) {
if (empty($links)) {
// Block do not have links. Delete all references if exists.
db_query("DELETE FROM {linkchecker_boxes} WHERE bid = %d", $bid);
}
else {
// The block still have more than one link, but other links may have been
// removed and links no longer in the content need to be deleted from the
// linkchecker_boxes reference table.
$placeholders = implode(',', array_fill(0, count($links), "'%s'"));
db_query("DELETE FROM {linkchecker_boxes} WHERE bid = %d AND lid NOT IN (SELECT lid FROM {linkchecker_links} WHERE token IN (" . $placeholders . "))", array_merge(array(
$bid,
), array_map('md5', $links)));
}
}