How to upgrade to Mautic 3.1?

The ‘Upgrade to 3.1’ button is no longer showing up in my notifications. I can’t find a page with general upgrade instructions anywhere, only a long blog post about features and who did what, but zero word on how to install the thing. The ‘Mautic 3.1’ link in the first line leads to a 404 page.

When I go to the original blog post here, the ‘Mautic 3.1’ link does work. The github page gives a lot of info about Features, Enhancements, Bugs. Again nothing about how to install it, only links to two files: 3.1.0-update.zip and 3.1.0.zip. What’s the difference? Where should I put these? What was the install/upgrade command again? Run as root or user?

I can probably figure it out based on my previous experiences installing Mautic, with trial and error, but why does this have to always be so nerve-wrecking?

BTW, I am on Mautic 3, latest PHP + MySQL, Apache on CentOS, etc.

Hi there

The best way to update is at the command line.

Take a look at this page which explains how to do a manual update: https://docs.mautic.org/en/troubleshooting/update-failed

Thanks @rcheesley

I will try this again next weekend. I just tried the upgrade button in admin, that suddenly reappeared, but got the following result:

The Mautic update could not complete successfully because of the following error: The ZIP archive could not be found.

Downloading Package Success
Extracting Package Failed

:cry:

Have you got the Zip package enabled in your PHP configuration?

@rcheesley, yes. I don’t see a zip file in the mautic folder; where is it supposed to end up?

Hi there, what happens if you try to do the update at the command line?

Before trying some kind of manual/command line upgrade, I tried the upgrade button in the admin area notification again, now for version 3.1.1. Same result as before:

Update Available
Current Version 3.0.2
Upgrade Version 3.1.1
Announcement Release Mautic 3.1.1 · mautic/mautic · GitHub
It is HIGHLY RECOMMENDED that files and database are backed up prior to applying the update.

Updating Mautic
The Mautic update could not complete successfully because of the following error: The ZIP archive could not be found.
Step Status
Downloading Package Success
Extracting Package Failed

Where are manual/command line upgrade instructions?

The instructions on ‘update-failed’ want me to essentially reinstall the whole thing.

It really doesn’t. It explains how to troubleshoot a failed upgrade and then gives emergency instructions to reinstall everything manually. There is nothing in there about just downloading and applying the upgrade package, which is apparently ‘the best way to update’.

Manual upgrade attempt #1:

I have downloaded an upgrade package into the mautic folder as a user (not root) with the following command:

wget https://github.com/mautic/mautic/releases/download/3.1.1/3.1.1-update.zip

It shows up in the folder as ‘3.1.1-update.zip’. Based on notes from previous install and upgrade attempts, the next step is probably something like this:

php bin/console mautic:update:apply --update-package=3.1.1-update.zip

That works, but produces the following error in SSH:

The stream or file “/serverpath/public_html/mautic/var/logs/prod-2020-10
-03.php” could not be opened: failed to open stream: Permission denied

Permission issue? Did I use root SSH where I should have used user SSH? Or the other way around?

Anyway, my Mautic installation is completely fucked again:

The site is currently offline due to encountering an error. If the problem persists, please contact the system administrator.

System administrators, check server logs for errors.

Edit:

Eventually fixed after resetting ownership for all folders to the Apache user and randomly running commands from the ‘update-failed’ page as user in SSH (not root). Several errors in ‘Updating database schema…’:

In AbstractMySQLDriver.php line 106:

An exception occurred while executing ‘ALTER TABLE mtc_oauth2_accesstokens CHANGE cl
ient_id client_id INT UNSIGNED NOT NULL, CHANGE user_id user_id INT UNSIGNED NOT NUL
L, CHANGE token token VARCHAR(191) NOT NULL, CHANGE expires_at expires_at BIGINT DEF
AULT NULL, CHANGE scope scope VARCHAR(191) DEFAULT NULL’:

SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a for
eign key constraint ‘FK_818C32519EB6921’

In PDOConnection.php line 80:

SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a for
eign key constraint ‘FK_818C32519EB6921’

In PDOConnection.php line 75:

SQLSTATE[HY000]: General error: 1832 Cannot change column ‘client_id’: used in a for
eign key constraint ‘FK_818C32519EB6921’

But Mautic works again, seems to be on version 3.1.1 now and all my data is still there, hopefully.

Did you solved this? I’m facing the same issue…

This is an old issue and there is already an open 3d for it:

I developed a tool using artificial intelligence to address these issues. Ultimately, I successfully resolved the problem, although it required running numerous SQL queries.

1 Like

This looks cool.

1 Like