function xmlsitemap_link_delete_multiple in XML sitemap 7.2
Same name and namespace in other branches
- 6.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
array $conditions: An array of conditions on the {xmlsitemap} table in the form 'field' => $value.
Return value
int 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 - Bundle Delete.
- xmlsitemap_link_delete in ./
xmlsitemap.module - Delete a specific sitemap link from the database.
File
- ./
xmlsitemap.module, line 761 - xmlsitemap XML sitemap
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().
// @todo Remove this check when https://www.drupal.org/node/151452 is fixed.
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.
$query = db_delete('xmlsitemap');
foreach ($conditions as $field => $value) {
$query
->condition($field, $value);
}
return $query
->execute();
}