function facetapi_update_7000 in Facet API 7
Same name and namespace in other branches
- 7.2 facetapi.install \facetapi_update_7000()
Update hashed block deltas to a URL-safe form.
File
- ./
facetapi.install, line 106 - Install, update, and uninstall functions for the Facet API module.
Code
function facetapi_update_7000() {
$result = db_query("SELECT name FROM {facetapi}");
foreach ($result as $f) {
if (strlen($r->name) > 32) {
$orig_delta = substr(base64_encode(hash('sha256', $r->name, TRUE)), 0, 32);
$new_delta = strtr($orig_delta, array(
'+' => '-',
'/' => '_',
'=' => '',
));
db_update('block')
->fields(array(
'delta' => $new_delta,
))
->condition('module', 'facetapi')
->condition('delta', $orig_delta)
->execute();
}
}
}