0

This question already has an answer here:

I need to do a few things which could be easily made with Drush commands, but I need to achieve them through PHP code inside my module, on an hook_update_N().

It seems to me that I need to use drush_invoke() but it doesn't currently exists when I tested in a devel block. I searched here and there how to include (safely) this function, but I had no luck on that.

I guess it is simple and my question could sound silly.

How can I use drush_invoke() in my code called from hook_update_N()?

marked as duplicate by leymannx, DRUPWAY, mradcliffe, Елин Й., kiamlaluno 7 Jul 23 '18 at 9:53

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • The drush_invoke() API docs has a "calls to" section that you can reference in the Drush codebase to demonstrate how the function is used. – Shawn Conn Jul 6 '18 at 20:45
  • 2
    My code? What code? Please update your question to include an MCVE. – leymannx Jul 6 '18 at 23:37
  • My tags says it is for Drupal 7. I will update my question to be more explicit on this. – Beto Aveiga Jul 8 '18 at 13:55
  • Notice that What code? is not asking which Drupal version you are using, but which code you are using. – kiamlaluno Jul 23 '18 at 9:52

Browse other questions tagged or ask your own question.