Avatar

Error during update from 2.3.3 over 2.3.7 to 2.4.11 (General)

by Auge ⌂, Saturday, June 30, 2018, 17:25 (2124 days ago) @ WorldofBB

Hello

My explanations goes not directly to only you (WorldofBB) but also to further interested people, who are able to compare my explanation with the real code. Maybe someone can find a bug that way.

Thank you for all of your hard work on this great software! One more thing that I noticed is that while the older versions always pulled the current version correctly, it seems that the most recent versions are now using the VERSION file as well as the version meta_key under mlf2_settings.

I'm only mentioning it because the update.sql script seems to stop updating the version at 2.4.0, and doesn't add the smaller incremental version numbers above that. The version in my VERSION file is correct, so I did need to manually update the key in the SQL database in order for the software to recognize the correct version.

The scheme to use the VERSION-file worked since it's introduction with 2.3.99.1. But I had to add an additional function to the update script that compares the version string from the settings with the string from the file VERSION with 2.4.10. Problem was, that the simple comparision ($oldVersion < $newVersion) which string represents the greater (and newer) version number did not work with 2.4.10.

I tested the update to 2.4.10 with an initial installation of version 2.4.8. When the comparement of version numbers took action, the script told me, that the installend version is newer than the one I wanted to install. The script interpreted the version number "2.4.10" as a number and therefore as "2.4.1" (x.10 as x.1) which is a smaller number than 2.4.8.

To compare the numbers in a correct manner with the new function the string gets separated at the points (".") and, as one can see in update.php from line 34 on the array of the separated parts of a version number gets amended with additional elements with "0" as its value. A version string like "2.4" would get separated and amended with an additional "0" to a three elements array with "2", "4" and "0" when compared with a version number with three elements like "2.4.11" that get separated to "2", "4, and "11". Then the first, second and third elements from both arrays gets compared. When an element from the version array of the version one wants to update to is greater than its counterpart from the version string of the installed version the new Version is newer than the installed one. The update would get not stopped at that point and should perform.

The actualisation of the version number in the settings table is the almost last step of the update script (beginning with line 602 in the currently actual version 2.4.12). The value from $newVersion, taken from VERSION at the beginning of the update process gets stored in the table long after the comparision in dispute.

So your scenario should not be possible. It might has something to do with your previous failed update attempt or with the fact, that you updated your forum from a version without the file VERSION to a version, that defines it as mandatory. But the last guess is more a speculation.

Tschö, Auge

--
Trenne niemals Müll, denn er hat nur eine Silbe!


Complete thread:

 RSS Feed of thread