function xmlsitemap_node_update_1 in XML sitemap 5
Implementation of hook_update_N(). Fix scrambled values.
File
- xmlsitemap_node/
xmlsitemap_node.install, line 194
Code
function xmlsitemap_node_update_1() {
$ret = array();
$result = db_query("SELECT xn.nid FROM {xmlsitemap_node} xn LEFT JOIN {node} n ON n.nid = xn.nid WHERE n.nid IS NULL");
$bad_nids = array();
while ($node = db_fetch_object($result)) {
$bad_nids[] = $node->nid;
}
if (!empty($bad_nids)) {
$ret[] = update_sql("DELETE FROM {xmlsitemap_node} WHERE nid IN (" . db_escape_string(implode(', ', $bad_nids)) . ")");
$ret[] = update_sql(_xmlsitemap_node_insert_query());
xmlsitemap_update_sitemap();
}
return $ret;
}