$nids=db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {xmlsitemap} x ON x.type = 'node' AND n.nid = x.id WHERE x.id IS NULL AND n.type IN (:types) ORDER BY n.nid DESC",0,$limit,array(':types'=>$types));
foreach($nidsas$nid){
$node=node_load($nid,NULL,TRUE);
$nids=db_query_range("SELECT n.nid FROM {node} n LEFT JOIN {xmlsitemap} x ON x.type = 'node' AND n.nid = x.id WHERE x.id IS NULL AND n.type IN (:types) ORDER BY n.nid DESC",0,$limit,array(':types'=>$types))->fetchCol();
$nodes=node_load_multiple($nids);
foreach($nodesas$node){
$link=xmlsitemap_node_create_link($node);
xmlsitemap_save_link($link);
}
...
...
@@ -25,64 +25,66 @@ function xmlsitemap_node_xmlsitemap_index_links($limit) {
$form['xmlsitemap']['#description']=t('The default XML sitemap settings for this content type can be changed <a href="@link-type">here</a>.',array('@link-type'=>url('admin/content/node-type/'.$node->type,array('query'=>drupal_get_destination()))));
$form['xmlsitemap']['#description']=t('The default XML sitemap settings for this content type can be changed <a href="@link-type">here</a>.',array('@link-type'=>url('admin/structure/types/manage/'.str_replace('_','-',$node->type),array('query'=>drupal_get_destination()))));
}
//// The following values should not exist for new nodes.
@@ -252,16 +238,17 @@ function xmlsitemap_node_get_types() {
}
/**
* Implements hook_content_extra_fields().
*
* This is so that the XML sitemap fieldset is sortable on the node edit form.
* Implements hook_field_extra_fields().
*/
functionxmlsitemap_node_content_extra_fields(){
$extras['xmlsitemap']=array(
'label'=>t('XML sitemap'),
'description'=>t('XML sitemap module form.'),
'weight'=>30,
);
functionxmlsitemap_node_field_extra_fields(){
$extras=array();
foreach(xmlsitemap_node_get_types()as$type){
$extras['node'][$type]['xmlsitemap']=array(
'label'=>t('XML sitemap'),
'description'=>t('XML sitemap module element'),
'weight'=>30,
);
}
return$extras;
}
...
...
@@ -277,7 +264,7 @@ function xmlsitemap_node_get_timestamps($node) {
static$timestamps=array();
if(!isset($timestamps[$node->nid])){
$timestamps[$node->nid]=db_query("SELECT c.timestamp FROM {comments} c WHERE c.nid = %d AND c.status = %d UNION ALL SELECT nr.timestamp FROM {node_revisions} nr WHERE nr.nid = %d",$node->nid,COMMENT_PUBLISHED,$node->nid)->fetchCol();
$timestamps[$node->nid]=db_query("SELECT c.created FROM {comment} c WHERE c.nid = :nid AND c.status = :status UNION ALL SELECT nr.timestamp FROM {node_revision} nr WHERE nr.nid = :nid2",array(':nid'=>$node->nid,':status'=>COMMENT_PUBLISHED,':nid2'=>$node->nid))->fetchCol();
}
return$timestamps[$node->nid];
...
...
@@ -292,8 +279,11 @@ function xmlsitemap_node_get_timestamps($node) {