You are here

function facetapi_update_7002 in Facet API 7

Same name and namespace in other branches
  1. 7.2 facetapi.install \facetapi_update_7002()

Ensures hashes are alpha-numeric.

File

./facetapi.install, line 184
Install, update, and uninstall functions for the Facet API module.

Code

function facetapi_update_7002() {

  // Updates the block table with alpha-numeric hashes.
  $result = db_query("SELECT delta, bid FROM {block} WHERE module = 'facetapi'");
  foreach ($result as $record) {
    $hash = strtr($record->delta, array(
      '-' => '0',
      '_' => '1',
    ));
    db_update('block')
      ->fields(array(
      'delta' => $hash,
    ))
      ->condition('module', 'facetapi')
      ->condition('delta', $record->delta)
      ->execute();
  }

  // Clears the delta cache.
  cache_clear_all('facetapi:delta_map', 'cache');
}