Execute actions within drush.

#11 rules-1077700-11-drush_rules_integration.patch3.99 KBarithmetric
PASSED: [[SimpleTest]]: [MySQL] 329 pass(es).
[ View ]


mikewink’s picture

I would like this feature too. This could become very handy for maintenance tasks. I'm willing to help with this feature if a module maintainer would support me with answering questions. ;)

fago’s picture

Sounds great! I'd love to help with answering questions.

I think what we need for that is a way to textually input all data types. For most of them, this should be easy but stuff like 'text_formatted' might need some extra treatment.

mitchell’s picture

Title:Drush integration» Rules (actions API) integration
Project:Rules» Drush
Component:Provided Rules integration» Core Commands
greg.1.anderson’s picture

Seems to me this would be better off in the Rules queue. You could make a rules.drush.inc file, and put your Drush commands there. Then your rules-based commands would be available on any Drupal site with Rules enabled.

See drush topic docs-commands for info on writing your own Drush commands.

moshe weitzman’s picture

Title:Rules (actions API) integration» Drush integration
Project:Drush» Rules
Version:» 7.x-2.x-dev
Component:Core Commands» Miscellaneous
fago’s picture

Agreed. Let's add a drush integration that exposes rules actions as drush commands.

moshe weitzman’s picture

In the meantime, Views Bulk Operations (VBO) module has great drush+actions integration. Might solve a few needs

mitchell’s picture

Title:Drush integration» Drush and Rules integration


mitchell’s picture

Component:Miscellaneous» Provided Module Integrations

Updated component.

bailey86’s picture

Component:Provided Module Integrations» Module Integrations

Also, would it be possible to enable/disable rules using a Drush command?

arithmetric’s picture

Status:Active» Needs review
new3.99 KB
PASSED: [[SimpleTest]]: [MySQL] 329 pass(es).
[ View ]

Attached is a patch that implements drush integration for Rules to provide a list, enable, and disable command.

I modeled the patch after the Features module's drush integration. Following that model, one could implement additional commands for operations like exporting and reverting rules.

seanr’s picture

Cursory review looks good, but haven't tested. Next step, assuming this tests out well, would be to add execute to it for specific components.

ohthehugemanatee’s picture

Looks good, and tested working.

dixon_’s picture

kenorb’s picture

Issue summary:View changes
Status:Needs review» Reviewed & tested by the community

I've tested it and it seems to work correctly.
I've managed to successfully disable all the rules by the following command line:

drush rules-list | grep rules_ | grep Enabled | awk '{print $1}' | xargs -L1 -P4 drush rules-disable

  • Commit ff71d5f on 7.x-2.x authored by arithmetric, committed by fago:
    Issue #1077700 by arithmetric: Add Drush integration for en/disabling...
fago’s picture

Title:Drush and Rules integration» Adding drush integration for en/disabling rules
Status:Reviewed & tested by the community» Fixed

Thanks, looks good and seems to work -> Committed.

Status:Fixed» Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.