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
* @param Min_DB
* @return string
$TABLE = $_GET["indexes"];
$index_types = array("PRIMARY", "UNIQUE", "INDEX");
$table_status = table_status($TABLE, true);
-$server_info = $connection->server_info;
-$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"])) {
+if (preg_match('~MyISAM|M?aria' . (min_version(5.6, '10.0.5') ? '|InnoDB' : '') . '~i', $table_status["Engine"])) {
$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";
}
$indexes = indexes($TABLE);