You are here

function i18nblocks_update_6001 in Internationalization 6

Rework block string keys, all must use module, delta

File

i18nblocks/i18nblocks.install, line 140
Installation file for i18nblocks module.

Code

function i18nblocks_update_6001() {
  $ret = array();
  $result = db_query("SELECT * FROM {i18n_blocks} WHERE module = 'block' AND language = ''");
  while ($block = db_fetch_object($result)) {
    foreach (array(
      'title' => 'title',
      'content' => 'body',
    ) as $property => $rename) {
      $old = "blocks:block:{$block->ibid}:{$property}";
      $new = "blocks:block:{$block->delta}:{$rename}";
      i18nstrings_update_context($old, $new);
    }
  }
  return $ret;
}