| 1 |
<?php |
<?php |
| 2 |
// $Id: xmlsitemap_node.module,v 1.19.2.7 2008/11/28 20:37:04 kiam Exp $ |
// $Id: xmlsitemap_node.module,v 1.19.2.8 2008/11/29 12:45:16 kiam Exp $ |
| 3 |
|
|
| 4 |
/** |
/** |
| 5 |
* @file |
* @file |
| 331 |
} |
} |
| 332 |
if (module_exists('comment')) { |
if (module_exists('comment')) { |
| 333 |
$columns = 'n.nid, n.type, n.promote, s.comment_count, n.changed, xn.previously_changed, s.last_comment_timestamp, xn.previous_comment, xn.priority_override'; |
$columns = 'n.nid, n.type, n.promote, s.comment_count, n.changed, xn.previously_changed, s.last_comment_timestamp, xn.previous_comment, xn.priority_override'; |
| 334 |
$query = " |
$query = "SELECT $columns, $coalesce(ua.dst) AS alias FROM {node} n LEFT JOIN {node_comment_statistics} s ON n.nid = s.nid"; |
|
SELECT $columns, $coalesce(ua.dst) AS alias |
|
|
FROM {node} n |
|
|
LEFT JOIN {node_comment_statistics} s ON n.nid = s.nid"; |
|
| 335 |
} |
} |
| 336 |
else { |
else { |
| 337 |
$columns = 'n.nid, n.type, n.promote, n.changed, xn.previously_changed, xn.priority_override'; |
$columns = 'n.nid, n.type, n.promote, n.changed, xn.previously_changed, xn.priority_override'; |
| 338 |
$query = " |
$query = "SELECT $columns, $coalesce(ua.dst) AS alias FROM {node} n"; |
| 339 |
SELECT $columns, $coalesce(ua.dst) AS alias |
} |
| 340 |
FROM {node} n"; |
$query .= "LEFT JOIN {url_alias} ua ON ua.src = CONCAT('node/', CAST(n.nid AS $cast)) LEFT JOIN {xmlsitemap_node} xn ON n.nid = xn.nid WHERE n.status > 0 AND (n.type NOT IN ('". implode("', '", $excludes) ."') AND xn.priority_override IS NULL OR xn.priority_override >= 0) AND n.nid <> %d GROUP BY $columns"; |
|
} |
|
|
$query .= " |
|
|
LEFT JOIN {url_alias} ua ON ua.src = CONCAT('node/', CAST(n.nid AS $cast)) |
|
|
LEFT JOIN {xmlsitemap_node} xn ON n.nid = xn.nid |
|
|
WHERE n.status > 0 |
|
|
AND (n.type NOT IN ('". implode("', '", $excludes) ."') AND xn.priority_override IS NULL OR xn.priority_override >= 0) |
|
|
AND n.nid <> %d |
|
|
GROUP BY $columns"; |
|
| 341 |
$result = db_query(db_rewrite_sql($query), _xmlsitemap_node_frontpage()); |
$result = db_query(db_rewrite_sql($query), _xmlsitemap_node_frontpage()); |
| 342 |
while ($node = db_fetch_object($result)) { |
while ($node = db_fetch_object($result)) { |
| 343 |
db_query("INSERT INTO {xmlsitemap} (loc, lastmod, changefreq, priority) VALUES ('%s', %d, %d, %f)", xmlsitemap_url('node/'. $node->nid, $node->alias, NULL, NULL, TRUE), variable_get('xmlsitemap_node_count_comments', TRUE) ? max($node->changed, $node->last_comment_timestamp) : $node->changed, xmlsitemap_node_frequency($node), xmlsitemap_node_priority($node)); |
db_query("INSERT INTO {xmlsitemap} (loc, lastmod, changefreq, priority) VALUES ('%s', %d, %d, %f)", xmlsitemap_url('node/'. $node->nid, $node->alias, NULL, NULL, TRUE), variable_get('xmlsitemap_node_count_comments', TRUE) ? max($node->changed, $node->last_comment_timestamp) : $node->changed, xmlsitemap_node_frequency($node), xmlsitemap_node_priority($node)); |