Index: stringoverrides.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/stringoverrides/Attic/stringoverrides.install,v retrieving revision 1.3.2.4.2.1 diff -u -r1.3.2.4.2.1 stringoverrides.install --- stringoverrides.install 16 Dec 2009 22:59:28 -0000 1.3.2.4.2.1 +++ stringoverrides.install 26 Jan 2010 17:33:22 -0000 @@ -5,17 +5,32 @@ * Implements hook_uninstall(). */ function stringoverrides_uninstall() { - // Remove all stored string replacements - db_query('DELETE FROM {variable} WHERE name LIKE "locale_custom_strings_%"'); - db_query('DELETE FROM {variable} WHERE name LIKE "locale_custom_disabled_strings_%"'); + // Remove all stored string replacements. + $or = db_or() + ->condition('name', 'locale_custom_strings_%', 'LIKE') + ->condition('name', 'locale_custom_disabled_strings_%', 'LIKE'); + db_delete('variable')->condition($or)->execute(); } /** - * Update to Drupal 7. - * Will be solved later. Set the version number for new installs for now. + * Update to Drupal 7. This will add the context support to custom strings. */ function stringoverrides_update_7000() { $ret = array(); + // Retrieve all existing overrides. + $or = db_or() + ->condition('name', 'locale_custom_strings_%', 'LIKE') + ->condition('name', 'locale_custom_disabled_strings_%', 'LIKE'); + $result = db_select('variable') + ->addField('variable', 'name') + ->addField('variable', 'value') + ->condition($or); + ->execute(); + + // Push the overrides one level deeper for context support. + foreach ($result as $variable) { + variable_set($variable->name, array('' => $variable->value)); + } return $ret; }