Upgrade from 4.1 to 4.2

Silverstripe Version: 4.1

So this is probably a stupid question but how do I upgrade from SS 4.1 to 4.2?

The only tutorials I can find on it are upgrading from 3.x to 4.x.

I guess it’s through composer but am not entirely sure how.

Thanks

Hi Franken Bunt,

Please follow below steps:

  1. Change below lines in composer.json

Before
“silverstripe/recipe-plugin”: “^1”,
“silverstripe/recipe-cms”: “1.1.1@stable”,
“silverstripe-themes/simple”: “~3.2.0”

After
“silverstripe/recipe-plugin”: “^1.2”,
“silverstripe/recipe-cms”: “4.2.0@stable”,
“silverstripe-themes/simple”: “~3.2.0”

  1. Open terminal and move to the path where your composer.json file located & run composer update command.

Hope this will helps you

Thanks!

1 Like

Thanks for your help.

I did this and now the site is only showing a blank page. I tried running /dev/build?flush=all but am still getting a blank page.

I have also put SS_ENVIRONMENT_TYPE=“dev” in the .env file but am not receiving any errors.

Any ideas on how to fix this?

Thanks

OK, I checked the PHP log and had the following error;

PHP Fatal error: Uncaught Exception: More than one YAML document exists named ‘myproject’ in ‘…/app/_config/mysite.yml’ and ‘…/app/_config/app.yml’ in …/vendor/silverstripe/config/src/Transformer/YamlTransformer.php:216

It looks like the upgrade added a file called ‘mysite.yml’, as soon as I removed that it started working again.

Am I supposed to replace app.yml with mysite.yml?
Is this something new for SS4.2?

Sorry, i’m new to SilverStripe and still trying to get my head around how it works.

Thanks

You can have as many yaml config files as you like, but each one needs to have a unique ‘Name’ property. That’s the part at the top of the yml file that looks like this:

Name: mysite

You have two files with the same property so you either need to change the name on one (the Name can be whatever you like) or you can combine the contents in to one file.

I think the convention has changed from naming the user code directory and accompanying references from ‘mysite’ to ‘app’ in SS4.2, which is more inline with other frameworks. You can name your code folder whatever you like though. I still name the code directory for the project (e.g. using the client/company name) as per old school SilverStripe recommendations :smile:

Thanks for your reply JonoM. It looks like SS is adding mysite.yml because that is the project name so I will do what you suggested and combine the two files under the same name.

I’m guessing if I wanted to upgrade to 4.2.1 I would put

“silverstripe/recipe-plugin”: “^1.2.1”,
“silverstripe/recipe-cms”: “4.2.1@stable”,
“silverstripe-themes/simple”: “~3.2.0”

in the composer.json?

Thanks

That looks about right :slight_smile: