Commit cfbe8c9e authored by Dave Reid's avatar Dave Reid
Browse files

Issue #2416983 by Dave Reid: Added hook_xmlsitemap_rebuild_clear().

parent cd45c8be
Loading
Loading
Loading
Loading
+14 −0
Changes for xmlsitemap.api.php: 14 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -113,6 +113,20 @@ function hook_xmlsitemap_link_update(array $link, array $context) {
    ->execute();
}

/**
 * Respond to XML sitemap link clearing and rebuilding.
 *
 * @param array $types
 *   An array of link types that are being rebuilt.
 * @param bool $save_custom
 *   If links with overridden status and/or priority are being removed or not.
 */
function hook_xmlsitemap_rebuild_clear(array $types, $save_custom) {
  db_delete('mytable')
    ->condition('link_type', $types, 'IN')
    ->execute();
}

/**
 * Index links for the XML sitemaps.
 */
+3 −0
Changes for xmlsitemap.generate.inc: 3 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -424,6 +424,9 @@ function xmlsitemap_batch_variable_set(array $variables) {
 */
function xmlsitemap_rebuild_batch_clear(array $entities, $save_custom, &$context) {
  if (!empty($entities)) {
    // Let other modules respond to the rebuild clearing.
    module_invoke_all('xmlsitemap_rebuild_clear', $entities, $save_custom);

    $query = db_delete('xmlsitemap');
    $query->condition('type', $entities);