Avatar

Message for upgradeable version in the admin panel (Technics)

by Auge ⌂, Friday, April 20, 2018, 09:46 (2197 days ago) @ Micha

Hello

I will stay off during the next days because of a medicinal issue. Thatswhy my approvements and further thoughts only in short.

I analysed the function and I believe, I found the reason of the problem. The critical line is:

if ($lastVersion != $currentVersion && $updateDateOfActualVersion > $updateDateOfInstalledVersion) {

$currentVersion contains the current installed version of the software and $lastVersion contains the last available version on github. If the forum is updated before the daily schedule was run, the if-condition fails (because of '2.4.9' != '2.4.9' --> false).

If I understand your words, this is the comparision to decide if the new values (version number and date) should be stored in the temp-settings-table? It seems wrong to me if the value get's compared with (only?) the installed version instead with the old value in the temp-settings-table (with the exception of no run of this check and therefore no value in the temp-settings-table).

The same problems exists on the condition of $updateDateOfActualVersion and $updateDateOfInstalledVersion. Whereas $updateDateOfActualVersion contains the date of the last available version on github, $updateDateOfActualVersion contains the date of installed version - taken from the feed, too.

What, if the installed version is not part of the feed? In the actual situation all versions, that are to old to be part of the feed can't check the version, so now it's not a problem. But in the future one could operate a forum with a 2.4.x-version (version-check-capable) and the feed could be continued to far because of the many meanwhile released versions. It might be an idea to store the date of the last succeeded run of a software update and take this into accout of the comparision.

We should remove the condition or using a further function argument, that contains the last version of the 'temp_infos' table (in addition to the installed version number).

approved

If we remove the condition, a sql update runs every day, i.e. the following code is executed

With an additional check against the last version from temp_infos we have not to do this by default …

if ($latestRelease !== false) {
@mysqli_query($connid, "INSERT INTO ".$db_settings['temp_infos_table']." (`name`, `value`, `time`) VALUES ('last_version_check', '" . mysqli_real_escape_string($connid, $latestRelease->version) . "', NOW()) ON DUPLICATE KEY UPDATE `value` = '" . mysqli_real_escape_string($connid, $latestRelease->version) . "', `time` = NOW();");
@mysqli_query($connid, "INSERT INTO ".$db_settings['temp_infos_table']." (`name`, `value`) VALUES ('last_version_uri', '" . mysqli_real_escape_string($connid, $latestRelease->uri) . "') ON DUPLICATE KEY UPDATE `value` = '" . mysqli_real_escape_string($connid, $latestRelease->uri) . "';");
}

In my opinion, it is a reasonable change.

… but the idea to use INSERT ON DUPLICATE KEY UPDATE is in general worth a second and third view.

Tschö, Auge

PS: I ran for the second time during the last weeks into the trap of getting the message "No Authorization" (only this one sentence) when I wanted to use the preview-button. The message was not formatted in the forums template so I think, it's a message from the server itself and not from the forum software.

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


Complete thread:

 RSS Feed of thread