WP_CLI\Utils
get_mysql_version()
Get the version of the MySQL or MariaDB database.
Хуков нет.
Возвращает
Строку
. Version of the MySQL/MariaDB database, or an empty string if not found.
Использование
get_mysql_version();
Список изменений
С версии 2.12.0 | Введена. |
С версии 2.12.0 | Now also checks for MariaDB. |
Код get_mysql_version() get mysql version WP-CLI 2.13.0-alpha
function get_mysql_version() { static $version = null; if ( null !== $version ) { return $version; } $db_type = get_db_type(); if ( 'sqlite' !== $db_type ) { $result = Process::create( "/usr/bin/env $db_type --version", null, null )->run(); if ( 0 !== $result->return_code ) { $version = ''; } else { $version = trim( $result->stdout ); } } return $version; }