Download & Extend

Function xmlsitemap_node_get_timestamps() requires only nid as argument

Project:XML sitemap
Version:7.x-2.0-rc1
Component:xmlsitemap_node.module
Category:task
Priority:normal
Assigned:Dave Reid
Status:postponed (maintainer needs more info)

Issue Summary

I try to attach lastmod field to taxonomy term using following rule:
Get max timestamp from list of all nodes referenced to current term.

<?php
/**
* Implements hook_xmlsitemap_link_alter().
*/
function [my_super_module]_xmlsitemap_link_alter(&$link) {
  if (
$link['type'] == 'taxonomy_term') {
   
// search for nodes referenced to current taxonomy term
   
$nids = db_select('taxonomy_index', 'ti')
      ->
fields('ti', array('nid'))
      ->
condition('ti.tid', $link['id'])
      ->
execute()
      ->
fetchAll(PDO::FETCH_COLUMN, 0);
 
   
$timestamps = array();
    foreach(
$nids as $nid) {
     
$node = node_load($nid); // Here i have to load node. Why?
      // Always recalculate changefreq and changecount.
     
$timestamps = array_merge($timestamps, xmlsitemap_node_get_timestamps($node));
    }
   
$link['lastmod'] = count($timestamps) ? max($timestamps) : 0;
  }
}
?>

It's okey but xmlsitemap_node_get_timestamps() doesn't requires full-loaded node at all. It's enough just node->nid as argument.

Comments

#1

Here the patch

AttachmentSizeStatusTest resultOperations
1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch2.05 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch. Unable to apply patch. See the log in the details link for more information.View details | Re-test

#2

Status:active» needs review

#3

Status:needs review» needs work

The last submitted patch, 1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.

#4

Status:needs work» needs review

#1: 1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch queued for re-testing.

#5

Status:needs review» needs work

The last submitted patch, 1856572-2-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.

#6

Status:needs work» needs review
AttachmentSizeStatusTest resultOperations
1856572-6-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch2.05 KBIdleFAILED: [[SimpleTest]]: [MySQL] Unable to apply patch 1856572-6-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch. Unable to apply patch. See the log in the details link for more information.View details | Re-test

#7

Status:needs review» needs work

The last submitted patch, 1856572-6-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.

#8

Status:needs work» needs review

Third try

AttachmentSizeStatusTest resultOperations
1856572-8-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch2.01 KBIdleFAILED: [[SimpleTest]]: [MySQL] Repository checkout: failed to create dependency directory.View details | Re-test

#9

Status:needs review» needs work

The last submitted patch, 1856572-8-xmlsitemap_node_xmlsitemap_node_get_timestamps_fixes.patch, failed testing.

#10

Assigned to:Anonymous» Dave Reid
Status:needs work» postponed (maintainer needs more info)

I think this is a won't fix. Dave Reid, can you please chime in on this?

nobody click here