本文整理汇总了PHP中PMA_Util::getLatestVersion方法的典型用法代码示例。如果您正苦于以下问题:PHP PMA_Util::getLatestVersion方法的具体用法?PHP PMA_Util::getLatestVersion怎么用?PHP PMA_Util::getLatestVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PMA_Util
的用法示例。
在下文中一共展示了PMA_Util::getLatestVersion方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetLatestVersion
/**
* 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);
}
示例2: testGetLatestVersion
/**
* 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);
}
示例3: PMA_versionCheck
/**
* 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'));
}
}
}
示例4: define
<?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 : ''));