Problem/Motivation

The Radix 6.0.8 Drush command radix:create fails on Drupal 11.4.x because it invokes the deprecated Drupal core script web/core/scripts/drupal

Drupal 11.4 deprecates calling core/scripts/drupal and requires using the new vendor/bin/dr script instead.

The failing code is in Commands/radix/SubThemeCommands.php around line 165:

$process = new Process([
  'php', $drupalRoot . '/core/scripts/drupal', 'generate-theme',
  '--starterkit', 'radix_starterkit',
  $themeName,
  '--path', 'themes/custom',
  '--description', $description,
]);

Steps to reproduce

Use a Drupal 11.4.x project based on drupal/recommended-project. Install Radix 6.0.8:

composer require drupal/radix

Verify that the command is discovered by Drush:

./vendor/bin/drush --include=/path/to/project/web/themes/contrib/radix list | grep radix

This correctly returns:

radix:create (radix)     Creates a Radix sub-theme.

Then run:

./vendor/bin/drush --include=/path/to/project/web/themes/contrib/radix radix:create new_theme

The command fails with:

PHP Deprecated: Calling drupal is deprecated in drupal:11.4.0 and is removed from drupal:13.0.0. Use the `dr` script instead.
PHP Fatal error: Uncaught Error: Failed opening required ‘…/web/vendor/autoload.php’

Proposed resolution

Do not invoke core/scripts/drupal directly. For Drupal 11.4+, the subtheme generator should invoke vendor/bin/dr instead. A local workaround that works in a standard drupal/recommended-project layout is:

$process = new Process([
  dirname($drupalRoot) . '/vendor/bin/dr', 'generate-theme',
  '--starterkit', 'radix_starterkit',
  $themeName,
  '--path', 'themes/custom',
  '--description', $description,
]);

This avoids the deprecated core/scripts/drupal entrypoint. Relevant Drupal change record https://www.drupal.org/node/3584928

Remaining tasks

Update Commands/radix/SubThemeCommands.php to use the supported Drupal CLI entrypoint. Ensure compatibility with Drupal 10.3, Drupal 11.x, and Drupal 12.x if needed.

User interface changes

None

API changes

None

Data model changes

None

Issue fork radix-3608254

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

braintec created an issue. See original summary.

braintec’s picture

Title: radix:create fails on Drupal 11.4 because it calls deprecated core/scripts/drupal instead of vendor/bin/dr » Create fails on Drupal 11.4 because it calls deprecated core/scripts/drupal instead of vendor/bin/dr
arx-e’s picture

I met the same error trying to create a subtheme in Drupal 11.4 and replacing this line
'php', $drupalRoot . '/core/scripts/drupal', 'generate-theme',
with this line
dirname($drupalRoot) . '/vendor/bin/dr', 'generate-theme',
as proposed in the issue description, fixed the error and made the creation of a subtheme run just fine.

Maybe a note should be added in the front page until the issue gets corrected.

darkdim made their first commit to this issue’s fork.

darkdim’s picture

Status: Active » Needs review

fixed

arx-e’s picture

Yeah it is ok for Drupal 11.4+ but what about previous versions?

arx-e’s picture

Status: Needs review » Needs work
darkdim’s picture

Status: Needs work » Needs review

changed

arx-e changed the visibility of the branch 3608254-radix-subtheme-creation-command to hidden.

arx-e’s picture

oops we did the same thing at the same time. I went on to hide my copy of MR.

ultimike’s picture

Tested with 11.4.4 and appears to be working fine.

-mike