Would be awesome if there were a way to export configured events (trigger + actions) from the database. This would need to work for any category/module that integrates with triggers (eg Comment triggers, Content triggers, Cron triggers, Organic Groups triggers, Taxonomy triggers, Users triggers, Workflow triggers).

Was unable to find much on this topic via google and d.o searches. I also dont know much about the progression of triggers and actions module for d7 to address long term feasibility of implementing this. Thoughts?

Comments

q0rban’s picture

Version: 6.x-1.x-dev » 7.x-1.x-dev
Status: Active » Needs review
StatusFileSize
new5.86 KB

Here's a patch for this.

ericduran’s picture

Oh, this is nice.

q0rban’s picture

StatusFileSize
new6.07 KB

Updated patch adds a hook_features_rebuild() implementation. Rebuilding does not delete existing trigger_assignments but does create new ones.

alfthecat’s picture

Hey q0rban,

Would there be a patch for D6 for this?

q0rban’s picture

@AlfTheCat, nope, I don't have one. Care to try your hand at rolling one? It shouldn't be that hard, the database API stuff will be a little tricky, but that's it.

alfthecat’s picture

Thanks q0rban, since I haven't gotten into D7 at all yet (waiting on more functionality) I have little faith in my own abilities for such an attempt at this point :)

When I do I'll try.

Thanks again!

q0rban’s picture

The patch may work as is by simply rewriting all the DBTNG stuff as D6 db_query()'s. The trickiest one to solve will be the db_merge(), but you can do a db_query("UPDATE..."); if (!db_affected_rows()) { db_query("INSERT..."); } there. You can do it! Give it a shot. :)

drzraf’s picture

thanks q0rban, I just tested and it seems to export triggers quite well.
any hope on getting "actions" exportable too ?

kenorb’s picture

StatusFileSize
new5.64 KB

Against the latest dev.

kenorb’s picture

Status: Needs review » Needs work

My trigger assignment was exported as follow:

/**
 * Implements hook_trigger_default_trigger_assignments().
 */
function aat_campaigns_feature_trigger_default_trigger_assignments() {
  $assignments = array();

  // Exported trigger assignment: info_pack_insert-280
  $assignments['info_pack_insert-280'] = array(
    'hook' => 'info_pack_insert',
    'aid' => '280',
    'weight' => '1',
    'status' => '1',
    'name' => 'info_pack_insert-280',
  );

  return $assignments;
}

This is only the assignment, but the information about the action available at: admin/config/system/actions/configure/280 has been lost.

This include Label and some specified settings (for Email e.g. Recipient, Subject, Message).
Those settings are stored in {actions} table.

mile23’s picture

Really ancient core discussion here: #245331: Trigger module should offer exports of actions

kenorb’s picture

Trigger module has been removed from Drupal 8 core (#764558: Remove Trigger module from core).
Actions API will be changed as well (#1846172: Replace the actions API).
Alternative module: http://drupal.org/project/rules

See also:
#1211396: [META] Getting started with Rules 8.x

colinmcclure’s picture

Issue summary: View changes
StatusFileSize
new903 bytes

Re-rolled patch against latest dev branch as needed for a project. Thought would share as someone might need it.

kenorb’s picture

Status: Needs work » Needs review
jeffschuler’s picture

Status: Needs review » Needs work

Latest patch (in #14) no longer includes most of the necessary code from the one in #9.