Use the router for the server_engines.php page

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
Maurício Meneghini Fauth 2019-07-09 20:23:18 -03:00
parent 25430be5dc
commit cda99ea57f
11 changed files with 29 additions and 37 deletions

View File

@ -31,6 +31,9 @@ if (isset($_GET['route']) || isset($_POST['route'])) {
$routes->addRoute(['GET', 'POST'], '/databases', function () {
require_once ROOT_PATH . 'libraries/entry_points/server_databases.php';
});
$routes->addRoute('GET', '/engines', function () {
require_once ROOT_PATH . 'libraries/entry_points/server_engines.php';
});
$routes->addRoute('GET', '/plugins', function () {
require_once ROOT_PATH . 'libraries/entry_points/server_plugins.php';
});

View File

@ -44,7 +44,6 @@ class Core
'pdf_pages.php',
'pdf_schema.php',
'server_binlog.php',
'server_engines.php',
'server_export.php',
'server_import.php',
'server_privileges.php',

View File

@ -2269,18 +2269,18 @@ class DatabaseInterface
'Please check privileges of directory containing database.'
);
} else {
/* InnoDB constraints, see
/**
* InnoDB constraints, see
* https://dev.mysql.com/doc/refman/5.0/en/
* innodb-foreign-key-constraints.html
* innodb-foreign-key-constraints.html
*/
$error .= ' - ' . $error_message .
' (<a href="server_engines.php' .
Url::getCommon(
[
'engine' => 'InnoDB',
'page' => 'Status',
]
) . '">' . __('Details…') . '</a>)';
' (<a href="' .
Url::getFromRoute('/server/engines', [
'engine' => 'InnoDB',
'page' => 'Status',
]) .
'">' . __('Details…') . '</a>)';
}
} else {
$error .= ' - ' . $error_message;

View File

@ -655,7 +655,7 @@ class Menu
$tabs['charset']['text'] = __('Charsets');
$tabs['engine']['icon'] = 'b_engine';
$tabs['engine']['link'] = 'server_engines.php';
$tabs['engine']['link'] = Url::getFromRoute('/server/engines');
$tabs['engine']['text'] = __('Engines');
$tabs['plugins']['icon'] = 'b_plugin';

View File

@ -194,15 +194,15 @@ class Data
$links['Slow_queries']['doc'] = 'slow_query_log';
$links['innodb'][__('Variables')] = [
'url' => 'server_engines.php',
'params' => Url::getCommon(['engine' => 'InnoDB'], ''),
'url' => Url::getFromRoute('/server/engines', ['engine' => 'InnoDB']),
'params' => '',
];
$links['innodb'][__('InnoDB Status')] = [
'url' => 'server_engines.php',
'params' => Url::getCommon([
'url' => Url::getFromRoute('/server/engines', [
'engine' => 'InnoDB',
'page' => 'Status',
], ''),
]),
'params' => '',
];
$links['innodb']['doc'] = 'innodb';

View File

@ -10,11 +10,11 @@ declare(strict_types=1);
use PhpMyAdmin\Controllers\Server\EnginesController;
use PhpMyAdmin\Response;
if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
if (! defined('PHPMYADMIN')) {
exit;
}
require_once ROOT_PATH . 'libraries/common.inc.php';
global $containerBuilder;
/** @var EnginesController $controller */
$controller = $containerBuilder->get(EnginesController::class);

View File

@ -16,7 +16,7 @@
{{- details['Support'] == 'NO' or details['Support'] == 'DISABLED' ? ' disabled' }}
{{ details['Support'] == 'DEFAULT' ? ' marked' }}">
<td>
<a rel="newpage" href="server_engines.php{{ get_common({'engine': engine}) }}">
<a rel="newpage" href="{{ get_url_from_route('/server/engines', {'engine': engine}) }}">
{{ details['Engine'] }}
</a>
</td>

View File

@ -17,8 +17,7 @@
{% if page is empty %}
<strong>{% trans 'Variables' %}</strong>
{% else %}
<a href="server_engines.php
{{- get_common({'engine': engine.engine}) }}">
<a href="{{ get_url_from_route('/server/engines', {'engine': engine.engine}) }}">
{% trans 'Variables' %}
</a>
{% endif %}
@ -27,8 +26,7 @@
{% if page is defined and page == current %}
<strong>{{ label }}</strong>
{% else %}
<a href="server_engines.php
{{- get_common({'engine': engine.engine, 'page': current}) }}">
<a href="{{ get_url_from_route('/server/engines', {'engine': engine.engine, 'page': current}) }}">
{{ label }}
</a>
{% endif %}

View File

@ -49,7 +49,7 @@
{% if link_name == 'doc' %}
{{ show_mysql_docu(link_url) }}
{% else %}
<a href="{{ link_url.url }}" data-post="{{ link_url.params }}">{{ link_name }}</a>
<a href="{{ link_url.url }}"{% if link_url.params is not empty %} data-post="{{ link_url.params }}"{% endif %}>{{ link_name }}</a>
{% endif %}
|
{% endfor %}

View File

@ -74,7 +74,7 @@ class EnginesControllerTest extends TestCase
$actual
);
$this->assertStringContainsString(
'server_engines.php?engine=FEDERATED',
'index.php?route=/server/engines&amp;engine=FEDERATED',
$actual
);
@ -87,7 +87,7 @@ class EnginesControllerTest extends TestCase
$actual
);
$this->assertStringContainsString(
'server_engines.php?engine=dummy',
'index.php?route=/server/engines&amp;engine=dummy',
$actual
);
}
@ -135,15 +135,7 @@ class EnginesControllerTest extends TestCase
$actual
);
$this->assertStringContainsString(
Url::getCommon([
'engine' => 'Pbxt',
'page' => 'Documentation',
]),
$actual
);
$this->assertStringContainsString(
Url::getCommon(['engine' => 'Pbxt']),
'index.php?route=/server/engines&amp;engine=Pbxt&amp;page=Documentation',
$actual
);
$this->assertStringContainsString(

View File

@ -439,7 +439,7 @@ class DatabaseInterfaceTest extends PmaTestCase
[
1005,
'msg',
'server_engines.php',
'index.php?route=/server/engines',
],
[
1005,