Download & Extend

Code should delete the data in xmlsitemap table that refers to deleted objects

Project:XML sitemap
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:earnie
Status:closed (fixed)
Issue tags:release 6.x-1.1

Issue Summary

The code should be remove the rows in the xmlsitemap table that are relative to objects (node, taxonomy terms, users) that have been deleted.
I.e., when hook_nodeapi() is notified that a node has been deleted, the hook should remove the relative row not only in the database table, but also in the central table used to populate the sitemap. It's possible to do it because the central table contains already all the data needed to localize the correct row that must be deleted.

Comments

#1

This will change once that #463564: Remove the central database table is implemented.

#2

Status:active» fixed

The central database table has been removed.

#3

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

#4

Status:closed (fixed)» active

As the code has been rolled-back, it is still using a central database table, which can contain data referred to deleted nodes, deleted or blocked users, etc...

#5

Status:active» postponed

#6

Assigned to:Anonymous» earnie

#7

Status:postponed» fixed

The current code already implements this.

<?php
function xmlsitemap_node_nodeapi(&$node, $op, $teaser = NULL, $page = NULL) {
  switch (
$op) {
    ...
    case
'delete':
     
db_query("DELETE FROM {xmlsitemap_node} WHERE nid = %d", $node->nid);
     
db_query("DELETE FROM {xmlsitemap} WHERE type = 'node' AND id = %d", $node->nid);
      if (
$node->status) {
       
xmlsitemap_flag_sitemap();
      }
      break;
  }
}

function
xmlsitemap_taxonomy_taxonomy($op, $type, $array = NULL) {
  if (
$type == 'vocabulary') {
    switch (
$op) {
      case
'delete':
       
db_query("DELETE FROM {xmlsitemap_taxonomy} WHERE vid = %d", $array['vid']);
       
variable_del('xmlsitemap_taxonomy_vocabulary_priority_'. $array['vid']);
       
xmlsitemap_flag_sitemap();
        break;
       ...
    }
  }
  else {
    switch (
$op) {
      case
'delete':
       
db_query("DELETE FROM {xmlsitemap_taxonomy} WHERE tid = %d", $array['tid']);
       
db_query("DELETE FROM {xmlsitemap} WHERE type = 'taxonomy' AND id = %d", $array['tid']);
        break;
      ...
    }
   
xmlsitemap_flag_sitemap();
  }
}
?>

#8

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.