/** * Test version checking * * @return void * * @group large */ public function testGetLatestVersion() { $GLOBALS['cfg']['ProxyUrl'] = ''; $GLOBALS['cfg']['VersionCheckProxyUrl'] = ''; $version = PMA_Util::getLatestVersion(); $this->assertNotEmpty($version->version); $this->assertNotEmpty($version->date); }
/** * Test version checking * * @return void * * @group large */ public function testGetLatestVersion() { $GLOBALS['cfg']['ProxyUrl'] = PROXY_URL; $GLOBALS['cfg']['ProxyUser'] = PROXY_USER; $GLOBALS['cfg']['ProxyPass'] = PROXY_PASS; $GLOBALS['cfg']['VersionCheck'] = true; $version = PMA_Util::getLatestVersion(); $this->assertNotEmpty($version->version); $this->assertNotEmpty($version->date); }
/** * Checks for newest phpMyAdmin version and sets result as a new notice * * @return void */ function PMA_versionCheck() { // version check messages should always be visible so let's make // a unique message id each time we run it $message_id = uniqid('version_check'); // Fetch data $version_data = PMA_Util::getLatestVersion(); if (empty($version_data)) { PMA_messagesSet('error', $message_id, __('Version check'), __('Reading of version failed. Maybe you\'re offline or the upgrade server does not respond.')); return; } $version = $version_data->version; $date = $version_data->date; $version_upstream = PMA_Util::versionToInt($version); if ($version_upstream === false) { PMA_messagesSet('error', $message_id, __('Version check'), __('Got invalid version string from server')); return; } $version_local = PMA_Util::versionToInt($GLOBALS['PMA_Config']->get('PMA_VERSION')); if ($version_local === false) { PMA_messagesSet('error', $message_id, __('Version check'), __('Unparsable version string')); return; } if ($version_upstream > $version_local) { $version = htmlspecialchars($version); $date = htmlspecialchars($date); PMA_messagesSet('notice', $message_id, __('Version check'), sprintf(__('A newer version of phpMyAdmin is available and you should consider upgrading. The newest version is %s, released on %s.'), $version, $date)); } else { if ($version_local % 100 == 0) { PMA_messagesSet('notice', $message_id, __('Version check'), PMA_sanitize(sprintf(__('You are using Git version, run [kbd]git pull[/kbd] :-)[br]The latest stable version is %s, released on %s.'), $version, $date))); } else { PMA_messagesSet('notice', $message_id, __('Version check'), __('No newer stable version is available')); } } }
<?php /* vim: set expandtab sw=4 ts=4 sts=4: */ /** * A caching proxy for retrieving version information from phpmyadmin.net * * @package PhpMyAdmin */ // Sets up the session define('PMA_MINIMUM_COMMON', true); require_once 'libraries/common.inc.php'; require_once 'libraries/Util.class.php'; // Always send the correct headers header('Content-type: application/json; charset=UTF-8'); $version = PMA_Util::getLatestVersion(); echo json_encode(array('version' => !empty($version->version) ? $version->version : '', 'date' => !empty($version->date) ? $version->date : ''));