1

We recently moved to Drupal 9.3.0 with a composer file layout and Drush 11.0. We make use of Drush Scripts to execute website functions from Crontab. One specific case is sending a newsletter email early each morning.

I receiving the subject error from a Drush Script that has been running for years. The script is executed by moving into the webroot directory of the website and running drush scr email_script.php arg1 arg2. The first thing the Drush Script does is pull the arguments from the command line using drush_shift() but this function is not defined. I'm not sure how to proceed in debugging this.

1
  • You probably don't need to debug anything, the function was deprecated and removed which is why your script can't use it. It's used to get command line arguments so you can refactor your scripts to use \Drush::input() or $_SERVER['argv'] instead
    – Clive
    Jan 13 at 15:43
2

drush_shift() has been deprecated and removed per @Clive -- Thanks!

In my case I changed:

$arg1 = drush_shift();
$arg2 = drush_shift();

to

$arg1 = $_SERVER['argv'][3];
$arg2 = $_SERVER['argv'][4];

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.