How to do a Composer update from Mautic 4.4.9 to Mautic 4.4.10

Your software
My PHP version is : PHP 7.4.3-4ubuntu2.19
My Composer version is : .5.8 2023-06-09 17:13:21

Updating/Installing Errors
I am Updating
Upgrading/installing via Command Line

Your problem
My problem is
I have a working composer based install of Mautic 4.4.9 that was created as an update following the instructions here, How to switch to Composer | Mautic

How do I now upgrade to Mautic 4.4.10 ?

Steps I have tried to fix the problem

composer outdated indicates that there are 4.4.10 ā€˜direct dependenciesā€™ available, e.g.

Direct dependencies required in composer.json:
composer/installers                  v1.12.0   v2.2.0    A multi-framework Composer library installer
mautic/core-lib                      4.4.9     4.4.10    Mautic Open Source Distribution
mautic/grapes-js-builder-bundle      4.4.9     4.4.10    GrapesJS Builder with MJML support for Mautic
...
...
...

However, running composer update results in the following output:

Loading composer repositories with package information
Updating dependencies                                 
Killed

And nothing seems to have happened.

Any help much appreciated.

1 Like

Surely there must be someone out there who knows how to do a composer updateā€¦?

Itā€™s for these reasons I am nervous to switch to Composer, although ultimately it will be the right thing to do.

If you do find a solution, please post back here.

Hi Rob,

Yes, I agree. Iā€™m now starting to wish that I never bothered and probably should downgrade. Though not sure of the best way to do that. So a little stuck at present. Whilst I am quite an experienced developer, Iā€™m not a PHP person, so this technology stack is out of my comfort zoneā€¦ :frowning:

I have the same problem to update from 4.4.9 to 4.4.10

I used the documentation and ran:

user@mautic:~$ sudo php /srv/mautic/bin/console mautic:update:find
Version 4.4.10 of Mautic is available for download. Please visit https://github.com/mautic/mautic/releases/tag/4.4.10 for more information.
To update, you can run 'php bin/console mautic:update:apply' from the command line.
user@mautic:~$ 
user@mautic:~$ sudo php /srv/mautic/bin/console mautic:update:apply
You have Composer updates enabled. This means that you can only update Mautic through the 'composer update' command. Read more in the documentation: https://mau.tc/switch-to-composer
user@mautic:~$

So I use the composer option that was also on the documentation:

user@mautic:/srv/mautic$ composer update mautic/core-lib --with-dependencies
Loading composer repositories with package information
Info from https://repo.packagist.org: #StandWithUkraine
Dependency phpoffice/phpspreadsheet is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.
Dependency php-http/message-factory is also a root requirement. Package has not been listed as an update argument, so keeping locked at old version. Use --with-all-dependencies (-W) to include root dependencies.
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package lightsaml/lightsaml is abandoned, you should avoid using it. Use litesaml/lightsaml instead.
Package misd/phone-number-bundle is abandoned, you should avoid using it. Use odolbeau/phone-number-bundle instead.
Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead.
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package symfony/inflector is abandoned, you should avoid using it. Use EnglishInflector from the String component instead.
Package symfony/security is abandoned, you should avoid using it. No replacement was suggested.
Package symfony/swiftmailer-bundle is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating autoload files
110 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony recipes are disabled: "symfony/flex" not found in the root composer.json

No security vulnerability advisories found
user@mautic:/srv/mautic$

Followed the first note and ran:

user@mautic:/srv/mautic$ composer update mautic/core-lib --with-all-dependencies
Loading composer repositories with package information
Updating dependencies                                 
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
Package lightsaml/lightsaml is abandoned, you should avoid using it. Use litesaml/lightsaml instead.
Package misd/phone-number-bundle is abandoned, you should avoid using it. Use odolbeau/phone-number-bundle instead.
Package php-http/message-factory is abandoned, you should avoid using it. Use psr/http-factory instead.
Package sensio/framework-extra-bundle is abandoned, you should avoid using it. Use Symfony instead.
Package swiftmailer/swiftmailer is abandoned, you should avoid using it. Use symfony/mailer instead.
Package symfony/debug is abandoned, you should avoid using it. Use symfony/error-handler instead.
Package symfony/inflector is abandoned, you should avoid using it. Use EnglishInflector from the String component instead.
Package symfony/security is abandoned, you should avoid using it. No replacement was suggested.
Package symfony/swiftmailer-bundle is abandoned, you should avoid using it. Use symfony/mailer instead.
Generating autoload files
110 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
Symfony recipes are disabled: "symfony/flex" not found in the root composer.json

No security vulnerability advisories found
user@mautic:/srv/mautic$

Running composer update gave me the same output as before.
After all this, Iā€™m still at version 4.4.9.

One last thing I tried was to manually change the version inside the composer.json file to be 4.4.10

...
require": {
"acquia/mc-cs-plugin-custom-objects": "^1.0",
"composer/installers": "^1.11",
"mautic/core-composer-scaffold": "4.x-dev",
"mautic/core-lib": "4.4.10",
...

and then I ran the composer update command. That actually worked!
BUTTTTTā€¦ when I tried to login again, the whole site got removed and it was showing the first configuration menu window, meaning that the whole site was GONE!!.
I had to restore the mautic folder and the database to ā€œrollbackā€ this change.

At the end Iā€™m not sure if is even possible to update Mautic via composer.
If this is not possible, the documentation should mention that.

Update:
After I manually changed the mautic/core-lib version to be 4.4.10 inside the composer.json file and run composer update I got the following

user@mautic:/srv/mautic$ sudo php bin/console mautic:update:find
Great! You are running the current version of Mautic.

BUTTTTTTā€¦ the config/local.php file was gone, thatā€™s why my site was gone.
So I just copy the file back from the backup and the site is up and running.
The path location in my case was the following:
/srv/mautic/docroot/app/config/local.php
Just make sure you have this copy this file over after the update and you should be good to go!.

1 Like

Thanks for sharing in such detail

1 Like

Rob, A big thank you - Iā€™m now on 4.4.10

To summarise:

  1. Take a complete copy of existing mautic directory, e.g.

/var/www/html$ cp -r mautic mautic-4.4.9

  1. Run composer update:

/var/www/html/mautic$ composer update mautic/core-lib --with-all-dependencies

(not sure if ā€”with-dependencies will suffice)

  1. Manually update composer.json with new mautic version, e.g.

/var/www/html/mautic$ vi composer.json

And edit all occurrense of ā€˜4.4.9ā€™ to ā€˜4.4.10ā€™

  1. Run:

/var/www/html/mautic$ composer update

  1. Copy old config file to new app directory:

/var/www/html/mautic$ cp ../mautic-4.4.9/docroot/app/config/local.php docroot/app/config

  1. Enjoy :slight_smile:
5 Likes