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.