Index: modules/trigger/trigger.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.module,v
retrieving revision 1.58
diff -u -p -r1.58 trigger.module
--- modules/trigger/trigger.module	26 Dec 2009 16:50:09 -0000	1.58
+++ modules/trigger/trigger.module	2 Mar 2010 11:34:11 -0000
@@ -260,15 +260,17 @@ function _trigger_node($node, $hook, $a3
   static $objects;
   // Prevent recursion by tracking which operations have already been called.
   static $recursion;
-  if (isset($recursion[$hook])) {
-    return;
-  }
-  $recursion[$hook] = TRUE;
 
   $aids = trigger_get_assigned_actions($hook);
   if (!$aids) {
     return;
   }
+
+  if (isset($recursion[$hook])) {
+    return;
+  }
+  $recursion[$hook] = TRUE;
+
   $context = array(
     'group' => 'node',
     'hook' => $hook,
@@ -291,6 +293,8 @@ function _trigger_node($node, $hook, $a3
       actions_do($aid, $node, $context, $a3, $a4);
     }
   }
+
+  unset($recursion[$hook]);
 }
 
 /**
Index: modules/trigger/trigger.test
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.test,v
retrieving revision 1.26
diff -u -p -r1.26 trigger.test
--- modules/trigger/trigger.test	9 Feb 2010 12:29:39 -0000	1.26
+++ modules/trigger/trigger.test	2 Mar 2010 11:34:11 -0000
@@ -14,7 +14,7 @@ class TriggerContentTestCase extends Dru
   }
 
   function setUp() {
-    parent::setUp('trigger');
+    parent::setUp('trigger', 'trigger_test');
   }
 
   /**
@@ -67,6 +67,34 @@ class TriggerContentTestCase extends Dru
   }
 
   /**
+   * Test that node actions are fired for each node individually if acting on
+   * multiple nodes.
+   */
+  function testActionContentMultiple() {
+    // Assign an action to the node save/update trigger.
+    $test_user = $this->drupalCreateUser(array('administer actions', 'administer nodes', 'create page content', 'access administration pages', 'access content overview'));
+    $this->drupalLogin($test_user);
+
+    for ($index = 0; $index < 3; $index++) {
+      $edit = array('title' => $this->randomName());
+      $this->drupalPost('node/add/page', $edit, t('Save'));
+    }
+
+    $action_id = 'trigger_test_generic_any_action';
+    $hash = md5($action_id);
+    $edit = array('aid' => $hash);
+    $this->drupalPost('admin/structure/trigger/node', $edit, t('Assign'));
+
+    $edit = array(
+      'operation' => 'unpublish',
+      'nodes[1]' => TRUE,
+      'nodes[2]' => TRUE,
+    );
+    $this->drupalPost('admin/content', $edit, t('Update'));
+    $this->assertTrue(variable_get('trigger_test_generic_any_action', 0) == 2, 'Action was triggered 2 times.');
+  }
+
+  /**
    * Helper function for testActionsContent(): returns some info about each of the content actions.
    *
    * @param $action
Index: modules/trigger/tests/trigger_test.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/tests/trigger_test.module,v
retrieving revision 1.5
diff -u -p -r1.5 trigger_test.module
--- modules/trigger/tests/trigger_test.module	4 Dec 2009 16:49:47 -0000	1.5
+++ modules/trigger/tests/trigger_test.module	2 Mar 2010 11:34:11 -0000
@@ -63,12 +63,12 @@ function trigger_test_trigger_info() {
   return array(
     'node' => array(
       'node_triggertest' => array(
-        'runs when' => t('A test trigger is fired'),
+        'label' => t('A test trigger is fired'),
       ),
     ),
     'trigger_test' => array(
       'trigger_test_triggertest' => array(
-        'runs when' => t('Another test trigger is fired'),
+        'label' => t('Another test trigger is fired'),
       ),
     ),
   );
@@ -131,5 +131,5 @@ function trigger_test_generic_action($co
  */
 function trigger_test_generic_any_action($context) {
   // Indicate successful execution by setting a persistent variable.
-  variable_set('trigger_test_generic_any_action', TRUE);
+  variable_set('trigger_test_generic_any_action', variable_get('trigger_test_generic_any_action', 0) + 1);
 }
