View Issue Details
|ID||Project||Category||View Status||Date Submitted||Last Update|
|0028918||mantisbt||upgrade||public||2021-07-15 09:31||2023-10-31 16:32|
|Priority||high||Severity||major||Reproducibility||have not tried|
|Target Version||2.26.0||Fixed in Version||2.26.0|
|Summary||0028918: Improve handling of unserialize->json conversion during upgrade|
MantisBT 2.16.0 introduced improved reporting of unserialize -> JSON conversion errors during upgrade from 1.2.x versions (see PR https://github.com/mantisbt/mantisbt/pull/1359)
As discussed below, this reporting is not optimal, as the installer stops after each error, forcing the admin to run the upgrade N+1 times (N being the number of conversion errors), which can be quite tedious when there is a large number of errors.
It would be more convenient to go through the entire process, and provide the admin with a list of errors at the end.
This is the original bug report:
upgrade mantis 1.2.4 to 2.25.2
'd tried to upgrade and got some errors. I have attached a picture of the error shown. Could you please tell me what is the issue?
After my research, I deleted some rows from mantis_config_table and mantis_filters_table
Please share what is the exact way to fix this issue.
|Tags||No tags attached.|
This removes all "complex" types from your config, which is like using a nuke to kill a mosquito... probably explains the workflow transition errors you're experiencing too. Don't do that.
The upgrade process is normally quite specific about the config which is causing a problem during upgrade; looking at the provided screenshot, the issue is with the private_bug_threshold record for all projects/all users, which apparently contains a json-encoded array of values, while the installer expects serialized data (
As you said, I deleted the 'private_bug_threshold' record for all projects/all users.
But, after that, it is shown the next error, and I deleted another record, and it continued for 15+ records. So I deleted all complex type values.
Now I imported the deleted rows into the mantis_config_table after the upgrade, it seems to work fine but still some of the complex values are showing NULL and in the database, these items have values.
Thus undoing the upgrade script's processing, which as you can imagine, is there for a reason - in this case converting complex values storage, from legacy PHP serialized data, to JSON.
You get NULLs, because Mantis is not able to interpret the serialized data as JSON.
So either keep going through the iterative process as you've been doing 15 times, until the installer continues, or devise your own conversion script based on install_check_config_serialization() function (in install_helper_functions_api.php).
I'll check if the upgrade process can be improved to process all data and report errors at the end, instead of aborting after the first error.
@thabsheer.pk it may be a bit late for you by now, but I have been working on an improved reporting mechanism, which allows you to download a CSV file with a list of all conversion errors found for a given upgrade steps. This should make the process less painful.
The updated code is available under PR https://github.com/mantisbt/mantisbt/pull/1771.
Feel free to review and test, your feedback would be appreciated.
MantisBT: master 581754b9
|Upgrading: improve unserialize->json conversion
Let the Admin download a CSV file with a list of errors when converting
unserialized data to JSON during upgrade, instead of forcing them to
fix issues one-by-one and run the upgrade N+1 times (N being the number
of conversion errors).
Also includes some code cleanup / improvements
- Conversion from legacy Database API to DbQuery
- PHPStorm static analysis warnings
- unused parameter in db_unixtimestamp()
Fixes 0028918, PR https://github.com/mantisbt/mantisbt/pull/1771
|mod - core/install_helper_functions_api.php||Diff File|