function xmlsitemap_link_delete_multiple in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap.module \xmlsitemap_link_delete_multiple()
Delete multiple sitemap links from the database.
If visible sitemap links were deleted, this will automatically set the regenerate needed flag.
Parameters
$conditions: An array of conditions on the {xmlsitemap} table in the form 'field' => $value.
Return value
The number of links that were deleted.
Related topics
4 calls to xmlsitemap_link_delete_multiple()
- XMLSitemapUnitTest::testLinkDelete in ./
xmlsitemap.test - Tests for xmlsitemap_link_delete().
- xmlsitemap_custom_uninstall in xmlsitemap_custom/
xmlsitemap_custom.install - Implements hook_uninstall().
- xmlsitemap_link_bundle_delete in ./
xmlsitemap.module - xmlsitemap_link_delete in ./
xmlsitemap.module - Delete a specific sitemap link from the database.
File
- ./
xmlsitemap.module, line 674 - Main file for the xmlsitemap module.
Code
function xmlsitemap_link_delete_multiple(array $conditions) {
// Because this function is called from sub-module uninstall hooks, we have
// to manually check if the table exists since it could have been removed
// in xmlsitemap_uninstall().
// @see http://drupal.org/node/151452
if (!db_table_exists('xmlsitemap')) {
return FALSE;
}
if (!variable_get('xmlsitemap_regenerate_needed', TRUE)) {
_xmlsitemap_check_changed_links($conditions, array(), TRUE);
}
// @todo Add a hook_xmlsitemap_link_delete() hook invoked here.
module_load_include('inc', 'xmlsitemap');
$args = _xmlsitemap_build_conditions($conditions);
db_query("DELETE FROM {xmlsitemap} WHERE " . implode(' AND ', $conditions), $args);
return db_affected_rows();
}