Remove last uses of PMA_MYSQL_INT_VERSION define

It is only kept as name in Advisor for now.

Signed-off-by: Michal Čihař <michal@cihar.com>
This commit is contained in:
Michal Čihař 2017-07-17 15:26:27 +02:00
parent e471d6b5eb
commit 8b00b90372
16 changed files with 30 additions and 33 deletions

View File

@ -106,7 +106,7 @@ if (strlen($GLOBALS['db']) > 0
}
unset($sqlConstratints);
if (PMA_MYSQL_INT_VERSION >= 50100) {
if ($GLOBALS['dbi']->getVersion() >= 50100) {
// here DELIMITER is not used because it's not part of the
// language; each statement is sent one by one

View File

@ -99,7 +99,7 @@ class Advisor
);
/* Some global variables for advisor */
$this->globals = array(
'PMA_MYSQL_INT_VERSION' => PMA_MYSQL_INT_VERSION,
'PMA_MYSQL_INT_VERSION' => $GLOBALS['dbi']->getVersion(),
);
}

View File

@ -1409,10 +1409,6 @@ class DatabaseInterface
}
}
if (! defined('PMA_MYSQL_INT_VERSION')) {
define('PMA_MYSQL_INT_VERSION', $this->_version_int);
}
if ($this->_version_int > 50503) {
$default_charset = 'utf8mb4';
$default_collation = 'utf8mb4_general_ci';

View File

@ -243,7 +243,7 @@ class Partition extends SubPartition
static $already_checked = false;
if (! $already_checked) {
if (PMA_MYSQL_INT_VERSION < 50600) {
if ($GLOBALS['dbi']->getVersion() < 50600) {
if ($GLOBALS['dbi']->fetchValue(
"SELECT @@have_partitioning;"
)) {

View File

@ -108,7 +108,7 @@ class StorageEngine
if (null == $storage_engines) {
$storage_engines
= $GLOBALS['dbi']->fetchResult('SHOW STORAGE ENGINES', 'Engine');
if (PMA_MYSQL_INT_VERSION >= 50708) {
if ($GLOBALS['dbi']->getVersion() >= 50708) {
$disabled = Util::cacheGet(
'disabled_storage_engines',
function () {

View File

@ -2512,7 +2512,7 @@ class Table
{
$serverType = Util::getServerType();
if ($serverType == 'MySQL'
&& PMA_MYSQL_INT_VERSION > 50705
&& $GLOBALS['dbi']->getVersion() > 50705
&& ! $GLOBALS['cfg']['Server']['DisableIS']
) {
$sql

View File

@ -362,12 +362,13 @@ class Util
}
$mysql = '5.5';
$lang = 'en';
if (defined('PMA_MYSQL_INT_VERSION')) {
if (PMA_MYSQL_INT_VERSION >= 50700) {
if (isset($GLOBALS['dbi'])) {
$serverVersion = $GLOBALS['dbi']->getVersion();
if ($serverVersion >= 50700) {
$mysql = '5.7';
} elseif (PMA_MYSQL_INT_VERSION >= 50600) {
} elseif ($serverVersion >= 50600) {
$mysql = '5.6';
} elseif (PMA_MYSQL_INT_VERSION >= 50500) {
} elseif ($serverVersion >= 50500) {
$mysql = '5.5';
}
}
@ -1273,8 +1274,7 @@ class Util
// 5.0.37 has profiling but for example, 5.1.20 does not
// (avoid a trip to the server for MySQL before 5.0.37)
// and do not set a constant as we might be switching servers
if (defined('PMA_MYSQL_INT_VERSION')
&& $GLOBALS['dbi']->fetchValue("SELECT @@have_profiling")
if ($GLOBALS['dbi']->fetchValue("SELECT @@have_profiling")
) {
self::cacheSet('profiling_supported', true);
} else {
@ -2550,7 +2550,7 @@ class Util
$functionality, $component, $minimum_version, $bugref
) {
$ext_but_html = '';
if (($component == 'mysql') && (PMA_MYSQL_INT_VERSION < $minimum_version)) {
if (($component == 'mysql') && ($GLOBALS['dbi']->getVersion() < $minimum_version)) {
$ext_but_html .= self::showHint(
sprintf(
__('The %s functionality is affected by a known bug, see %s'),
@ -3666,7 +3666,7 @@ class Util
$funcs[] = array('display' => '--------');
}
if (PMA_MYSQL_INT_VERSION < 50601) {
if ($GLOBALS['dbi']->getVersion() < 50601) {
$funcs['Crosses'] = array('params' => 2, 'type' => 'int');
$funcs['Contains'] = array('params' => 2, 'type' => 'int');
$funcs['Disjoint'] = array('params' => 2, 'type' => 'int');
@ -4346,8 +4346,9 @@ class Util
public static function isVirtualColumnsSupported()
{
$serverType = self::getServerType();
return $serverType == 'MySQL' && PMA_MYSQL_INT_VERSION >= 50705
|| ($serverType == 'MariaDB' && PMA_MYSQL_INT_VERSION >= 50200);
$serverVersion = $GLOBALS['dbi']->getVersion();
return $serverType == 'MySQL' && $serverVersion >= 50705
|| ($serverType == 'MariaDB' && $serverVersion >= 50200);
}
/**

View File

@ -785,7 +785,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
/* Log success */
Logging::logUser($cfg['Server']['user']);
if (PMA_MYSQL_INT_VERSION < $cfg['MysqlMinVersion']['internal']) {
if ($GLOBALS['dbi']->getVersion() < $cfg['MysqlMinVersion']['internal']) {
Core::fatalError(
__('You should upgrade to %s %s or later.'),
array('MySQL', $cfg['MysqlMinVersion']['human'])
@ -798,7 +798,7 @@ if (! defined('PMA_MINIMUM_COMMON')) {
$GLOBALS['PMA_Types'] = new TypesMySQL();
// Loads closest context to this version.
PhpMyAdmin\SqlParser\Context::loadClosest('MySql' . PMA_MYSQL_INT_VERSION);
PhpMyAdmin\SqlParser\Context::loadClosest('MySql' . $GLOBALS['dbi']->getVersion());
// Sets the default delimiter (if specified).
if (!empty($_REQUEST['sql_delimiter'])) {

View File

@ -80,6 +80,7 @@ function PMA_getHtmlForChangePassword($mode, $username, $hostname)
. '</tr>';
$serverType = PhpMyAdmin\Util::getServerType();
$serverVersion = $GLOBALS['dbi']->getVersion();
$orig_auth_plugin = PMA_getCurrentAuthenticationPlugin(
'change',
$username,
@ -88,14 +89,14 @@ function PMA_getHtmlForChangePassword($mode, $username, $hostname)
$is_superuser = $GLOBALS['dbi']->isSuperuser();
if (($serverType == 'MySQL'
&& PMA_MYSQL_INT_VERSION >= 50507)
&& $serverVersion >= 50507)
|| ($serverType == 'MariaDB'
&& PMA_MYSQL_INT_VERSION >= 50200)
&& $serverVersion >= 50200)
) {
// Provide this option only for 5.7.6+
// OR for privileged users in 5.5.7+
if (($serverType == 'MySQL'
&& PMA_MYSQL_INT_VERSION >= 50706)
&& $serverVersion >= 50706)
|| ($is_superuser && $mode == 'edit_other')
) {
$auth_plugin_dropdown = PMA_getHtmlForAuthPluginsDropdown(

View File

@ -960,7 +960,7 @@ function PMA_getHtmlForRenameTable()
*/
function PMA_getHtmlForTableComments($current_value)
{
$commentLength = PMA_MYSQL_INT_VERSION >= 50503 ? 2048 : 60;
$commentLength = $GLOBALS['dbi']->getVersion() >= 50503 ? 2048 : 60;
$html_output = '<tr><td class="vmiddle">' . __('Table comments') . '</td>'
. '<td><input type="text" name="comment" '
. 'maxlength="' . $commentLength . '"'

View File

@ -757,7 +757,7 @@ class ExportSql extends ExportPlugin
// by default we use the connection charset
$set_names = Charsets::$mysql_charset_map['utf-8'];
}
if ($set_names == 'utf8' && PMA_MYSQL_INT_VERSION > 50503) {
if ($set_names == 'utf8' && $GLOBALS['dbi']->getVersion() > 50503) {
$set_names = 'utf8mb4';
}
$head .= $crlf

View File

@ -122,7 +122,7 @@ $foreigners = PMA_getForeigners($db, $table, '', 'foreign');
$child_references = null;
// From MySQL 5.6.6 onwards columns with foreign keys can be renamed.
// Hence, no need to get child references
if (PMA_MYSQL_INT_VERSION < 50606) {
if ($GLOBALS['dbi']->getVersion() < 50606) {
$child_references = PMA_getChildReferences($db, $table);
}
@ -284,7 +284,7 @@ for ($columnNumber = 0; $columnNumber < $num_fields; $columnNumber++) {
// MySQL version from 5.6.6 allow renaming columns with foreign keys
if (isset($columnMeta['Field'])
&& isset($form_params['table'])
&& PMA_MYSQL_INT_VERSION < 50606
&& $GLOBALS['dbi']->getVersion() < 50606
) {
$columnMeta['column_status'] = PMA_checkChildForeignReferences(
$form_params['db'],

View File

@ -2,9 +2,9 @@
type="text"
name="field_comments[<?= $columnNumber; ?>]"
size="12"
maxlength="<?= PMA_MYSQL_INT_VERSION >= 50503 ? 1024 : 255; ?>"
maxlength="<?= $GLOBALS['dbi']->getVersion() >= 50503 ? 1024 : 255; ?>"
value="<?= (isset($columnMeta['Field']) && is_array($comments_map) && isset($comments_map[$columnMeta['Field']])) ?
htmlspecialchars($comments_map[$columnMeta['Field']])
: ''
?>"
class="textfield" />
class="textfield" />

View File

@ -115,7 +115,7 @@ $rownum = 0; ?>
'is_in_central_columns' => in_array($row['Field'], $central_list) ? true : false,
'central_columns_work' => $GLOBALS['cfgRelation']['centralcolumnswork'],
'table' => $GLOBALS['table'],
'mysql_int_version' => PMA_MYSQL_INT_VERSION
'mysql_int_version' => $GLOBALS['dbi']->getVersion()
)
); ?>
<?php endif; ?>

View File

@ -27,7 +27,6 @@ set_include_path(
// Setting constants for testing
define('PHPMYADMIN', 1);
define('TESTSUITE', 1);
define('PMA_MYSQL_INT_VERSION', 55000);
// Selenium tests setup
$test_defaults = array(

View File

@ -115,7 +115,7 @@ class AuthenticationConfigTest extends PMATestCase
$this->assertContains(
'<strong>MySQL said: </strong><a href="./url.php?url=https%3A%2F%2F' .
'dev.mysql.com%2Fdoc%2Frefman%2F5.7%2Fen%2Ferror-messages-server.html"' .
'dev.mysql.com%2Fdoc%2Frefman%2F5.5%2Fen%2Ferror-messages-server.html"' .
' target="mysql_doc">' .
'<img src="themes/dot.gif" title="Documentation" alt="Documentation" ' .
'class="icon ic_b_help" /></a>',