Fix #16130 - Local documentation links

Signed-off-by: Petr Duda <petrduda@seznam.cz>
This commit is contained in:
Petr Duda 2020-05-23 17:33:52 +02:00
parent a6ae728735
commit ad00dfc24c
3 changed files with 16 additions and 3 deletions

View File

@ -3162,11 +3162,10 @@ class DatabaseInterface
}
if (! self::checkDbExtension('mysqli')) {
$docUrl = Util::getDocuLink('faq', 'faqmysql');
$docLink = sprintf(
__('See %sour documentation%s for more information.'),
'[a@' . $docUrl . '@documentation]',
'[/a]'
'[doc@faqmysql]',
'[/doc]'
);
Core::warnMissingExtension(
'mysqli',

View File

@ -141,9 +141,11 @@ class Sanitize
public static function replaceDocLink(array $found)
{
if (count($found) >= 4) {
/* doc@page@anchor pattern */
$page = $found[1];
$anchor = $found[3];
} else {
/* doc@anchor pattern */
$anchor = $found[1];
if (strncmp('faq', $anchor, 3) == 0) {
$page = 'faq';

View File

@ -428,6 +428,18 @@ class MessageTest extends PmaTestCase
. 'latest%2Fsetup.html%23foo" '
. 'target="documentation">link</a>',
],
[
'[doc@page@anchor]link[/doc]',
'<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
. 'latest%2Fpage.html%23anchor" '
. 'target="documentation">link</a>',
],
[
'[doc@faqmysql]link[/doc]',
'<a href="./url.php?url=https%3A%2F%2Fdocs.phpmyadmin.net%2Fen%2F'
. 'latest%2Ffaq.html%23faqmysql" '
. 'target="documentation">link</a>',
],
];
}