Add min_version
This commit is contained in:
parent
93686eab65
commit
d38c673e2a
|
@ -73,6 +73,21 @@ function bracket_escape($idf, $back = false) {
|
||||||
return strtr($idf, ($back ? array_flip($trans) : $trans));
|
return strtr($idf, ($back ? array_flip($trans) : $trans));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Check if connection has at least the given version
|
||||||
|
* @param string required version
|
||||||
|
* @param string required MariaDB version
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
function min_version($version, $maria_db = "") {
|
||||||
|
global $connection;
|
||||||
|
$server_info = $connection->server_info;
|
||||||
|
if ($maria_db && preg_match('~([\d.]+)-MariaDB~', $server_info, $match)) {
|
||||||
|
$server_info = $match[1];
|
||||||
|
$version = $maria_db;
|
||||||
|
}
|
||||||
|
return (version_compare($server_info, $version) >= 0);
|
||||||
|
}
|
||||||
|
|
||||||
/** Get connection charset
|
/** Get connection charset
|
||||||
* @param Min_DB
|
* @param Min_DB
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -2,18 +2,10 @@
|
||||||
$TABLE = $_GET["indexes"];
|
$TABLE = $_GET["indexes"];
|
||||||
$index_types = array("PRIMARY", "UNIQUE", "INDEX");
|
$index_types = array("PRIMARY", "UNIQUE", "INDEX");
|
||||||
$table_status = table_status($TABLE, true);
|
$table_status = table_status($TABLE, true);
|
||||||
$server_info = $connection->server_info;
|
if (preg_match('~MyISAM|M?aria' . (min_version(5.6, '10.0.5') ? '|InnoDB' : '') . '~i', $table_status["Engine"])) {
|
||||||
$fulltext = ($server_info >= 5.6);
|
|
||||||
$spatial = ($server_info >= 5.7);
|
|
||||||
if (preg_match('~([\d.]+)-MariaDB~', $server_info, $match)) {
|
|
||||||
$server_info = $match[1];
|
|
||||||
$fulltext = (version_compare($server_info, '10.0.5') >= 0);
|
|
||||||
$spatial = (version_compare($server_info, '10.2.2') >= 0);
|
|
||||||
}
|
|
||||||
if (preg_match('~MyISAM|M?aria' . ($fulltext ? '|InnoDB' : '') . '~i', $table_status["Engine"])) {
|
|
||||||
$index_types[] = "FULLTEXT";
|
$index_types[] = "FULLTEXT";
|
||||||
}
|
}
|
||||||
if (preg_match('~MyISAM|M?aria' . ($spatial ? '|InnoDB' : '') . '~i', $table_status["Engine"])) {
|
if (preg_match('~MyISAM|M?aria' . (min_version(5.7, '10.2.2') ? '|InnoDB' : '') . '~i', $table_status["Engine"])) {
|
||||||
$index_types[] = "SPATIAL";
|
$index_types[] = "SPATIAL";
|
||||||
}
|
}
|
||||||
$indexes = indexes($TABLE);
|
$indexes = indexes($TABLE);
|
||||||
|
|
Loading…
Reference in a new issue