I have been trying to run a drush command from Rules Action PHP Execute.
Settings are:
Event: Cron tasks
Action: PHP Execute (php filter is enabled)

Value:
drush_invoke('my_custom_command'); //doesn't work - although this 'drush my_custom_command' runs fine through the command line, doesn't work here. It gives the WSOD and upon inspection i got undefined function in the log. So i tried,
drush_invoke('cache-clear','all'); //doesn't work either

How do I accomplish this?
Ideally what I am trying to do is to run a function in an include file of my custom module. My custom module.info has -->files[] = my_custom_module.drush.inc; and module is enabled.

How can i attach this function to run using rules action-php exec? I must be doing something wrong. Options, ideas? I'd really appreciate your help.
:)

Comments

mitchell’s picture

Component: Rules Engine » Rules Core
Assigned: Unassigned » mitchell
Status: Active » Postponed (maintainer needs more info)

Please update this issue from our irc conversation.

Assigning to me to remind me close if nothing gets updated.

jumoke’s picture

I had function in a module:

function mymodule_run_export_trigger($node) {
 //do export things
}

Needed to call it from Rules.
In Rules Actions, I have:
Execute PHP Code
Value: mymodule_run_export_trigger($node)

Works perfectly.

Thanks mitchell.

jumoke’s picture

Status: Postponed (maintainer needs more info) » Closed (fixed)

Fixed.

mitchell’s picture

Status: Closed (fixed) » Postponed (maintainer needs more info)

Good job, Jumoke.

mitchell’s picture

Assigned: mitchell » Unassigned
Status: Postponed (maintainer needs more info) » Closed (fixed)