From 4489759b74ac1a2cd9d0fc45982147746145219b Mon Sep 17 00:00:00 2001 From: webchick Date: Wed, 4 Apr 2012 10:07:00 -0700 Subject: Issue #1280792 follow-up BTMash, irunflower, Zgear: Fixed Trigger upgrade path: Node triggers removed when upgrading to 7-dev from 6.25. --- modules/trigger/trigger.install | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'modules/trigger') diff --git a/modules/trigger/trigger.install b/modules/trigger/trigger.install index 4deecf3af..20d5c3a3d 100644 --- a/modules/trigger/trigger.install +++ b/modules/trigger/trigger.install @@ -89,3 +89,19 @@ function trigger_update_7001() { db_drop_primary_key('trigger_assignments'); db_change_field('trigger_assignments', 'hook', 'hook', array('type' => 'varchar', 'length' => 78, 'not null' => TRUE, 'default' => '', 'description' => 'Primary Key: The name of the internal Drupal hook; for example, node_insert.', ), array('primary key' => array('hook', 'aid'))); } + +/** + * Renames nodeapi to node. + */ +function trigger_update_7002() { + $result = db_query("SELECT hook, aid FROM {trigger_assignments}"); + + foreach($result as $record) { + $new_hook = str_replace('nodeapi', 'node', $record->hook); + db_update('trigger_assignments') + ->fields(array('hook' => $new_hook)) + ->condition('hook', $record->hook) + ->condition('aid', $record->aid) + ->execute(); + } +} -- cgit v1.2.3