1

In Craft 3, I setup a base build for my team which had a bash script. At one point in the script I was able to enable a Craft Pro trial license like so:

echo 'Craft::$app->setEdition(Craft::Pro)' | php craft shell/index

However, this doesn't work in a version I am doing for Craft 4, and I can't find any changelog or notes about this being removed in Craft 4.

Anyone know if this is intended to happen now? (As in, Craft 4 is supposed to prevent the interactive shell from making changes to a site)

If it is supposed to happen, what could be another solution to get this working?

2 Answers 2

2

After a bit of noodling around, I figured out it's as simple as:

php craft project-config/set system.edition pro

Other project-config subcommands may be handy as well, such as:

php craft project-config/diff

to show any pending changes made to the on-disk configuration, and

php craft project-config/apply

to apply them.

1

You'll need to have the yiisoft/yii2-shell package installed to run craft shell.

From the Craft docs:

This command requires the yiisoft/yii2-shell package, which you may need to add to your project:
composer require --dev yiisoft/yii2-shell

Then this command should work:

echo 'Craft::$app->setEdition(Craft::Pro)' | php craft shell

enter image description here

Perhaps test with the interactive shell to see if it works and go from there?

enter image description here

3
  • Thanks, the shell appears to work already, but the change isn't reflected when I open up the CMS in my browser. Commented Jul 26, 2022 at 8:53
  • Try it with the interactive shell? See my updated answer.
    – Ben Croker
    Commented Jul 26, 2022 at 9:28
  • Yep, have done all this and it's still not working. Commented Jul 26, 2022 at 10:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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