You are here

function _xmlsitemap_check_changed_links in XML sitemap 6.2

Same name and namespace in other branches
  1. 7.2 xmlsitemap.module \_xmlsitemap_check_changed_links()

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.module
Delete multiple sitemap links from the database.
xmlsitemap_link_update_multiple in ./xmlsitemap.module
Perform a mass update of sitemap data.

File

./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;
  module_load_include('inc', 'xmlsitemap');
  $args = _xmlsitemap_build_conditions($conditions);
  $sql = "SELECT 1 FROM {xmlsitemap} WHERE " . implode(' AND ', $conditions);
  $changed = db_result(db_query_range($sql, $args, 0, 1));
  if ($changed && $flag) {
    variable_set('xmlsitemap_regenerate_needed', TRUE);
  }
  return $changed;
}