function _xmlsitemap_check_changed_links

7.x xmlsitemap.module _xmlsitemap_check_changed_links(array $conditions = array(), array $updates = array(), $flag = FALSE)
6.x xmlsitemap.module _xmlsitemap_check_changed_links(array $conditions = array(), array $updates = array(), $flag = FALSE)

Check if there is a visible sitemap link given a certain set of conditions.

Parameters

$conditions: An array of values to match keyed by field.

$flag: An optional boolean that if TRUE, will set the regenerate needed flag if there is a match. Defaults to FALSE.

Return value

TRUE if there is a visible link, or FALSE otherwise.

Related topics

2 calls to _xmlsitemap_check_changed_links()
xmlsitemap_link_delete_multiple in xmlsitemap/xmlsitemap.module
Delete multiple sitemap links from the database.
xmlsitemap_link_update_multiple in xmlsitemap/xmlsitemap.module
Perform a mass update of sitemap data.

File

xmlsitemap/xmlsitemap.module, line 706
Main file for the xmlsitemap module.

Code

function _xmlsitemap_check_changed_links(array $conditions = array(), array $updates = array(), $flag = FALSE) {
  // If we are changing status or access, check for negative current values.
  $conditions['status'] = (!empty($updates['status']) && empty($conditions['status'])) ? 0 : 1;
  $conditions['access'] = (!empty($updates['access']) && empty($conditions['access'])) ? 0 : 1;

  $query = db_select('xmlsitemap');
  $query->addExpression('1');
  foreach ($conditions as $field => $value) {
    $query->condition($field, $value);
  }
  $query->range(0, 1);
  $changed = $query->execute()->fetchField();

  if ($changed && $flag) {
    variable_set('xmlsitemap_regenerate_needed', TRUE);
  }

  return $changed;
}