Posted by kiamlaluno on August 23, 2008 at 12:34pm
Jump to:
| Project: | XML sitemap |
| Version: | 6.x-1.x-dev |
| Component: | xmlsitemap_node |
| Category: | bug report |
| Priority: | normal |
| Assigned: | kiamlaluno |
| Status: | closed (fixed) |
Issue Summary
xmlsitemap_node_priority() uses the variable $node->priority_override without to check if it is set.
Actually it checks that, but after it used its value.
The following code could then be changed from:
<?php
if (!isset($node->priority_override)) {
$priority = 0;
$priority += variable_get("xmlsitemap_node_type_priority_$node->type", 0.5);
// ...
}
?>to:
<?php
if (!isset($node->priority_override)) {
$priority = variable_get("xmlsitemap_node_type_priority_$node->type", 0.5);
// ...
}
?>I would change the full function into:
<?php
function xmlsitemap_node_priority($node) {
static $promote_priority;
static $comment_priority;
static $maxcomments;
$promote_priority = isset($promote_priority) ? $promote_priority : variable_get('xmlsitemap_node_promote_priority', 0.3);
$comment_priority = isset($comment_priority) ? $comment_priority : variable_get('xmlsitemap_node_comment_priority', 0.5);
if (!isset($maxcomments)) {
$maxcomments = 0;
if (module_exists('comment')) {
$maxcomments = db_result(db_query("SELECT MAX(comment_count) FROM {node_comment_statistics}"));
}
}
if (isset($node->priority_override)) {
$priority = $node->priority_override;
}
else {
$priority = variable_get("xmlsitemap_node_type_priority_$node->type", 0.5);
if ($node->promote) {
$priority += $promote_priority;
}
if (!empty($maxcomments)) {
$priority += $node->comment_count / $maxcomments * $comment_priority;
}
$priority = round($priority, 1);
$priority = min($priority, 0.9);
}
return $priority;
}
?>
Comments
#1
#2
Fixed in 6.x-1.x-dev.
#3
Automatically closed -- issue fixed for two weeks with no activity.