forked from Mirrors/openclonk
fix update system - can now update from 3.0 to 3.1
parent
3f7e4aa1cd
commit
89e7d633b0
|
@ -140,6 +140,17 @@ if ($link && $db) {
|
|||
$version = $row['new_version'];
|
||||
if ($version) {
|
||||
$message .= 'Version=' . $version . PHP_EOL;
|
||||
// strip build version from client request
|
||||
$n = 0;
|
||||
for($i=0;$i<strlen($client_version);$i++){
|
||||
if($client_version[$i]=='.'){
|
||||
$n++;
|
||||
if($n>=3){
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
$client_version = substr($client_version,0,$i);
|
||||
if (version_compare($client_version, $version) < 0) { //We need to update
|
||||
$result = mysql_query('SELECT `file` FROM `' . $prefix . 'update` WHERE `old_version` = \'' . $client_version . '\' AND `platform` = \'' . $platform . '\'');
|
||||
$row = mysql_fetch_assoc($result);
|
||||
|
|
|
@ -317,7 +317,7 @@ bool C4UpdateDlg::CheckForUpdates(C4GUI::Screen *pScreen, bool fAutomatic)
|
|||
|
||||
C4Network2UpdateClient UpdateClient;
|
||||
bool fSuccess = false, fAborted = false;
|
||||
StdStrBuf strVersion; strVersion.Format("%d.%d.%d.%d", C4XVER1, C4XVER2, C4XVER3, C4XVER4);
|
||||
StdStrBuf strVersion; strVersion.Format("%d.%d.%d", C4XVER1, C4XVER2, C4XVER3);
|
||||
StdStrBuf strQuery; strQuery.Format("%s?version=%s&platform=%s&action=version", Config.Network.UpdateServerAddress, strVersion.getData(), C4_OS);
|
||||
if (UpdateClient.Init() && UpdateClient.SetServer(strQuery.getData()) && UpdateClient.QueryUpdateURL())
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue