summaryrefslogtreecommitdiff
path: root/modules/trigger/trigger.module
diff options
context:
space:
mode:
Diffstat (limited to 'modules/trigger/trigger.module')
-rw-r--r--modules/trigger/trigger.module11
1 files changed, 8 insertions, 3 deletions
diff --git a/modules/trigger/trigger.module b/modules/trigger/trigger.module
index 3fa25e800..82d117272 100644
--- a/modules/trigger/trigger.module
+++ b/modules/trigger/trigger.module
@@ -164,9 +164,13 @@ function trigger_trigger_info() {
* label.
*/
function trigger_get_assigned_actions($hook) {
- return db_query("SELECT ta.aid, a.type, a.label FROM {trigger_assignments} ta LEFT JOIN {actions} a ON ta.aid = a.aid WHERE ta.hook = :hook ORDER BY ta.weight", array(
- ':hook' => $hook,
- ))->fetchAllAssoc( 'aid', PDO::FETCH_ASSOC);
+ $actions = &drupal_static(__FUNCTION__, array());
+ if (!isset($actions[$hook])) {
+ $actions[$hook] = db_query("SELECT ta.aid, a.type, a.label FROM {trigger_assignments} ta LEFT JOIN {actions} a ON ta.aid = a.aid WHERE ta.hook = :hook ORDER BY ta.weight", array(
+ ':hook' => $hook,
+ ))->fetchAllAssoc('aid', PDO::FETCH_ASSOC);
+ }
+ return $actions[$hook];
}
/**
@@ -602,6 +606,7 @@ function trigger_actions_delete($aid) {
db_delete('trigger_assignments')
->condition('aid', $aid)
->execute();
+ drupal_static_reset('trigger_get_assigned_actions');
}
/**