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

kiamlaluno - May 15, 2009 - 11:52
Project:XML sitemap
Version:6.x-1.x-dev
Component:Code
Category:task
Priority:normal
Assigned:earnie
Status:closed
Issue tags:release 6.x-1.1
Description

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.

#1

kiamlaluno - May 15, 2009 - 12:49

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

#2

kiamlaluno - May 23, 2009 - 04:06
Status:active» fixed

The central database table has been removed.

#3

System Message - June 6, 2009 - 04:10
Status:fixed» closed

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

#4

kiamlaluno - June 7, 2009 - 18:38
Status:closed» 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

earnie - June 8, 2009 - 12:43
Status:active» postponed

#6

earnie - July 2, 2009 - 15:40
Assigned to:Anonymous» earnie

#7

Dave Reid - October 19, 2009 - 16:21
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

System Message - November 2, 2009 - 16:30
Status:fixed» closed

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

 
 

Drupal is a registered trademark of Dries Buytaert.