function xmlsitemap_link_delete_multiple

7.x xmlsitemap.module xmlsitemap_link_delete_multiple(array $conditions)
6.x xmlsitemap.module xmlsitemap_link_delete_multiple(array $conditions)

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/xmlsitemap.test
Tests for xmlsitemap_link_delete().
xmlsitemap_custom_uninstall in xmlsitemap/xmlsitemap_custom/xmlsitemap_custom.install
Implements hook_uninstall().
xmlsitemap_link_bundle_delete in xmlsitemap/xmlsitemap.module
xmlsitemap_link_delete in xmlsitemap/xmlsitemap.module
Delete a specific sitemap link from the database.

File

xmlsitemap/xmlsitemap.module, line 672
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().
  // @todo Remove this check when http://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();
}