diff options
author | William Desportes <williamdes@wdes.fr> | 2020-11-10 10:42:36 +0300 |
---|---|---|
committer | William Desportes <williamdes@wdes.fr> | 2020-11-10 14:12:56 +0300 |
commit | d860597375406a99fd5d0fd83103815e231284f9 (patch) | |
tree | 72a92ca4b22b2bc2ad722aaef39177898829ee9d /libraries/classes/Html | |
parent | 6961d176595111cd01dffb523c4da452d82249c4 (diff) |
#16418 - Make MariaDBMySQLKBS optional
Signed-off-by: William Desportes <williamdes@wdes.fr>
Diffstat (limited to 'libraries/classes/Html')
-rw-r--r-- | libraries/classes/Html/Generator.php | 31 |
1 files changed, 11 insertions, 20 deletions
diff --git a/libraries/classes/Html/Generator.php b/libraries/classes/Html/Generator.php index 8d7e964d1d..30c0369bc2 100644 --- a/libraries/classes/Html/Generator.php +++ b/libraries/classes/Html/Generator.php @@ -10,6 +10,7 @@ namespace PhpMyAdmin\Html; use PhpMyAdmin\Core; use PhpMyAdmin\Message; use PhpMyAdmin\Profiling; +use PhpMyAdmin\Providers\ServerVariables\ServerVariablesProvider; use PhpMyAdmin\Response; use PhpMyAdmin\Sanitize; use PhpMyAdmin\SqlParser\Lexer; @@ -22,8 +23,6 @@ use Throwable; use Twig\Error\LoaderError; use Twig\Error\RuntimeError; use Twig\Error\SyntaxError; -use Williamdes\MariaDBMySQLKBS\KBException; -use Williamdes\MariaDBMySQLKBS\Search as KBSearch; use const ENT_COMPAT; use function addslashes; use function array_key_exists; @@ -87,24 +86,16 @@ class Generator bool $useMariaDB = false, ?string $text = null ): string { - $html = ''; - try { - $type = KBSearch::MYSQL; - if ($useMariaDB) { - $type = KBSearch::MARIADB; - } - $docLink = KBSearch::getByName($name, $type); - $html = MySQLDocumentation::show( - $name, - false, - $docLink, - $text - ); - } catch (KBException $e) { - unset($e);// phpstan workaround - } - - return $html; + $kbs = ServerVariablesProvider::getImplementation(); + $link = $useMariaDB ? $kbs->getDocLinkByNameMariaDb($name) : + $kbs->getDocLinkByNameMysql($name); + + return MySQLDocumentation::show( + $name, + false, + $link, + $text + ); } /** |