Index: includes/actions.inc
===================================================================
RCS file: /cvs/drupal/drupal/includes/actions.inc,v
retrieving revision 1.16
diff -u -p -r1.16 actions.inc
--- includes/actions.inc	5 Sep 2008 09:29:06 -0000	1.16
+++ includes/actions.inc	15 Sep 2008 06:41:10 -0000
@@ -78,12 +78,16 @@ function actions_do($action_ids, $object
     foreach ($actions as $action_id => $params) {
       if (is_numeric($action_id)) { // Configurable actions need parameters.
         $function = $params['callback'];
-        $context = array_merge($context, $params);
-        $result[$action_id] = $function($object, $context, $a1, $a2);
+        if (drupal_function_exists($function)) {
+          $context = array_merge($context, $params);
+          $result[$action_id] = $function($object, $context, $a1, $a2);
+        }
       }
       // Singleton action; $action_id is the function name.
       else {
-        $result[$action_id] = $action_id($object, $context, $a1, $a2);
+        if (drupal_function_exists($action_id)) {
+          $result[$action_id] = $action_id($object, $context, $a1, $a2);
+        }
       }
     }
   }
@@ -93,12 +97,16 @@ function actions_do($action_ids, $object
     if (is_numeric($action_ids)) {
       $action = db_fetch_object(db_query("SELECT * FROM {actions} WHERE aid = '%s'", $action_ids));
       $function = $action->callback;
-      $context = array_merge($context, unserialize($action->parameters));
-      $result[$action_ids] = $function($object, $context, $a1, $a2);
+      if (drupal_function_exists($function)) {
+        $context = array_merge($context, unserialize($action->parameters));
+        $result[$action_ids] = $function($object, $context, $a1, $a2);
+      }
     }
     // Singleton action; $action_ids is the function name.
     else {
-      $result[$action_ids] = $action_ids($object, $context, $a1, $a2);
+      if (drupal_function_exists($action_ids)) {
+        $result[$action_ids] = $action_ids($object, $context, $a1, $a2);
+      }
     }
   }
   return $result;
@@ -236,7 +244,7 @@ function actions_function_lookup($hash) 
   }
 
   // Must be an instance; must check database.
-  $aid = db_result(db_query("SELECT aid FROM {actions} WHERE MD5(aid) = '%s' AND parameters <> ''", $hash));
+  $aid = db_result(db_query("SELECT aid FROM {actions} WHERE MD5(aid) = '%s'", $hash));
   return $aid;
 }
 
@@ -248,10 +256,8 @@ function actions_function_lookup($hash) 
  * receive action IDs. This is not necessarily the best approach,
  * but it is the most straightforward.
  */
-function actions_synchronize($actions_in_code = array(), $delete_orphans = FALSE) {
-  if (!$actions_in_code) {
-    $actions_in_code = actions_list();
-  }
+function actions_synchronize($delete_orphans = FALSE) {
+  $actions_in_code = actions_list(TRUE);
   $actions_in_db = array();
   $result = db_query("SELECT * FROM {actions} WHERE parameters = ''");
   while ($action = db_fetch_object($result)) {
@@ -296,9 +302,12 @@ function actions_synchronize($actions_in
       }
     }
     else {
-      $link = l(t('Remove orphaned actions'), 'admin/build/actions/orphan');
+      $link = l(t('Remove orphaned actions'), 'admin/settings/actions/orphan');
       $count = count($actions_in_db);
       watchdog('actions', format_plural($count, 'One orphaned action (%orphans) exists in the actions table. !link', '@count orphaned actions (%orphans) exist in the actions table. !link'), array('@count' => $count, '%orphans' => $orphans, '!link' => $link), WATCHDOG_WARNING);
+      if (user_access('administer actions')) {
+        drupal_set_message(t(format_plural($count, 'One orphaned action (%orphans) exists in the actions table. !link', '@count orphaned actions (%orphans) exist in the actions table. !link'), array('@count' => $count, '%orphans' => $orphans, '!link' => $link)), 'error', FALSE);
+      }
     }
   }
 }
Index: modules/system/system.module
===================================================================
RCS file: /cvs/drupal/drupal/modules/system/system.module,v
retrieving revision 1.618
diff -u -p -r1.618 system.module
--- modules/system/system.module	14 Sep 2008 20:37:28 -0000	1.618
+++ modules/system/system.module	15 Sep 2008 06:41:14 -0000
@@ -1481,8 +1481,8 @@ function system_action_info() {
  */
 function system_actions_manage() {
   $output = '';
+  actions_synchronize();
   $actions = actions_list();
-  actions_synchronize($actions);
   $actions_map = actions_actions_map($actions);
   $options = array(t('Choose an advanced action'));
   $unconfigurable = array();
@@ -1736,7 +1736,7 @@ function system_action_delete_orphans_po
  * Remove actions that are in the database but not supported by any enabled module.
  */
 function system_actions_remove_orphans() {
-  actions_synchronize(actions_list(), TRUE);
+  actions_synchronize(TRUE);
   drupal_goto('admin/settings/actions/manage');
 }
 
Index: modules/trigger/trigger.admin.inc
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.admin.inc,v
retrieving revision 1.7
diff -u -p -r1.7 trigger.admin.inc
--- modules/trigger/trigger.admin.inc	16 Jul 2008 21:59:28 -0000	1.7
+++ modules/trigger/trigger.admin.inc	15 Sep 2008 06:41:15 -0000
@@ -24,6 +24,9 @@ function trigger_assign($type = NULL) {
     $type = 'nodeapi';
   }
 
+  // Refresh to find new actions if available
+  actions_synchronize();
+
   $output = '';
   $hooks = module_invoke_all('hook_info');
   foreach ($hooks as $module => $hook) {
Index: modules/trigger/trigger.install
===================================================================
RCS file: /cvs/drupal/drupal/modules/trigger/trigger.install,v
retrieving revision 1.5
diff -u -p -r1.5 trigger.install
--- modules/trigger/trigger.install	28 Dec 2007 12:02:52 -0000	1.5
+++ modules/trigger/trigger.install	15 Sep 2008 06:41:15 -0000
@@ -9,7 +9,7 @@ function trigger_install() {
   drupal_install_schema('trigger');
 
   // Do initial synchronization of actions in code and the database.
-  actions_synchronize(actions_list());
+  actions_synchronize();
 }
 
 /**
@@ -59,5 +59,3 @@ function trigger_schema() {
   );
   return $schema;
 }
-
-
