summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwebchick <webchick@24967.no-reply.drupal.org>2012-04-04 10:07:00 -0700
committerwebchick <webchick@24967.no-reply.drupal.org>2012-04-04 10:07:00 -0700
commit4489759b74ac1a2cd9d0fc45982147746145219b (patch)
treee3a3ae13674081801ec41b92938c4fefe00f80df
parent1775766e3495d6aa905aec90752ce2c44bf62a2f (diff)
downloadbrdo-4489759b74ac1a2cd9d0fc45982147746145219b.tar.gz
brdo-4489759b74ac1a2cd9d0fc45982147746145219b.tar.bz2
Issue #1280792 follow-up BTMash, irunflower, Zgear: Fixed Trigger upgrade path: Node triggers removed when upgrading to 7-dev from 6.25.
-rw-r--r--modules/simpletest/tests/upgrade/drupal-6.trigger.database.php6
-rw-r--r--modules/simpletest/tests/upgrade/upgrade.trigger.test7
-rw-r--r--modules/trigger/trigger.install16
3 files changed, 28 insertions, 1 deletions
diff --git a/modules/simpletest/tests/upgrade/drupal-6.trigger.database.php b/modules/simpletest/tests/upgrade/drupal-6.trigger.database.php
index 07160d9ec..0962f3582 100644
--- a/modules/simpletest/tests/upgrade/drupal-6.trigger.database.php
+++ b/modules/simpletest/tests/upgrade/drupal-6.trigger.database.php
@@ -62,6 +62,12 @@ db_insert('trigger_assignments')->fields(array(
))
->values(array(
'hook' => 'nodeapi',
+ 'op' => 'presave',
+ 'aid' => 'node_make_sticky_action',
+ 'weight' => '1',
+))
+->values(array(
+ 'hook' => 'nodeapi',
'op' => 'somehow_nodeapi_got_a_very_long',
'aid' => 'node_save_action',
'weight' => '1',
diff --git a/modules/simpletest/tests/upgrade/upgrade.trigger.test b/modules/simpletest/tests/upgrade/upgrade.trigger.test
index 028ea4f05..7413bed52 100644
--- a/modules/simpletest/tests/upgrade/upgrade.trigger.test
+++ b/modules/simpletest/tests/upgrade/upgrade.trigger.test
@@ -11,7 +11,7 @@ class UpgradePathTriggerTestCase extends UpgradePathTestCase {
public static function getInfo() {
return array(
'name' => 'Trigger upgrade path',
- 'description' => 'Trigger upgrade path tests.',
+ 'description' => 'Trigger upgrade path tests for Drupal 6.x.',
'group' => 'Upgrade path',
);
}
@@ -30,5 +30,10 @@ class UpgradePathTriggerTestCase extends UpgradePathTestCase {
*/
public function testTaxonomyUpgrade() {
$this->assertTrue($this->performUpgrade(), t('The upgrade was completed successfully.'));
+ $this->drupalGet('admin/structure/trigger/node');
+ $this->assertRaw('<td>'. t('Make post sticky') .'</td>');
+ $this->assertRaw('<td>'. t('Publish post') .'</td>');
+ $this->drupalGet('admin/structure/trigger/comment');
+ $this->assertRaw('<td>'. t('Publish comment') .'</td>');
}
}
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();
+ }
+}