fix update system - can now update from 3.0 to 3.1

Tobias Zwick 2012-10-18 23:30:12 +02:00
parent 3f7e4aa1cd
commit 89e7d633b0
2 changed files with 12 additions and 1 deletions

View File

@ -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);

View File

@ -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())
{