You are here

function _xmlsitemap_check_changed_links in XML sitemap 7.2

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

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

Parameters

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

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

Return value

bool 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 796
xmlsitemap XML sitemap

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;
}