diff --git a/ChangeLog b/ChangeLog index faab6202e..f1a9a25e9 100755 --- a/ChangeLog +++ b/ChangeLog @@ -5,6 +5,9 @@ phpMyAdmin - Changelog $Id$ $Source$ +2005-12-12 Michal Čihař + * scripts/setup.php: Use same format of version file as in upgrade.pl. + 2005-12-12 Sebastian Mendel * libraries/common.inc.php, libraries/grab_globals.inc.php: preprare removal of grab_globals: diff --git a/scripts/setup.php b/scripts/setup.php index 7a2c532d4..680d027d2 100644 --- a/scripts/setup.php +++ b/scripts/setup.php @@ -1697,7 +1697,7 @@ switch ($action) { case 'versioncheck': // Check for latest available version PMA_dl('curl'); $url = 'http://phpmyadmin.net/home_page/version.php'; - $version = ''; + $data = ''; $f = @fopen($url, 'r'); if ($f === FALSE) { if (!function_exists('curl_init')) { @@ -1705,21 +1705,30 @@ switch ($action) { break; } } else { - $version = fread($f, 20); + $data = fread($f, 20); fclose($f); } - if (empty($version) && function_exists('curl_init')) { + if (empty($data) && function_exists('curl_init')) { $ch = curl_init($url); curl_setopt($ch, CURLOPT_HEADER, FALSE); curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE); - $version = curl_exec($ch); + $data = curl_exec($ch); curl_close($ch); } - if (empty($version)) { + if (empty($data)) { message('error', 'Reading of version failed. Maybe you\'re offline or server does not respond.'); break; } + /* Format: version\ndate\n(download\n)* */ + $data_list = split("\n", $data); + + if (count($data_list) > 0) { + $version = $data_list[0]; + } else { + $version = ''; + } + $version_upstream = version_to_int($version); if ($version_upstream === FALSE) { message('error', 'Got invalid version string from server.');