You are here

function xmlsitemap_link_update_multiple in XML sitemap 7.2

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

Perform a mass update of sitemap data.

If visible links are updated, this will automatically set the regenerate needed flag to TRUE.

@codingStandardsIgnoreStart

Parameters

array $updates: An array of values to update fields to, keyed by field name.

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

Return value

int The number of links that were updated.

Related topics

4 calls to xmlsitemap_link_update_multiple()
XMLSitemapUnitTest::testUpdateLinks in ./xmlsitemap.test
Tests for xmlsitemap_link_update_multiple().
xmlsitemap_link_bundle_rename in ./xmlsitemap.module
Bundle Rename.
xmlsitemap_link_bundle_settings_save in ./xmlsitemap.module
Budle Settings.
xmlsitemap_link_type_rename in ./xmlsitemap.module
Rename a link type.

File

./xmlsitemap.module, line 711
xmlsitemap XML sitemap

Code

function xmlsitemap_link_update_multiple($updates = array(), $conditions = array(), $check_flag = TRUE) {

  // @codingStandardsIgnoreEnd
  // If we are going to modify a visible sitemap link, we will need to set
  // the regenerate needed flag.
  if ($check_flag && !variable_get('xmlsitemap_regenerate_needed', FALSE)) {
    _xmlsitemap_check_changed_links($conditions, $updates, TRUE);
  }

  // Process updates.
  $query = db_update('xmlsitemap');
  $query
    ->fields($updates);
  foreach ($conditions as $field => $value) {
    $query
      ->condition($field, $value);
  }
  return $query
    ->execute();
}