Skip to content

Commit

Permalink
Remove the database export entry point file
Browse files Browse the repository at this point in the history
Directly calls the controller instead of including the file.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
  • Loading branch information
MauricioFauth committed Jan 7, 2020
1 parent bce0245 commit bb42779
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 22 deletions.
7 changes: 5 additions & 2 deletions libraries/classes/Controllers/ExportController.php
Expand Up @@ -6,6 +6,7 @@

namespace PhpMyAdmin\Controllers;

use PhpMyAdmin\Controllers\Database\ExportController as DatabaseExportController;
use PhpMyAdmin\Core;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Encoding;
Expand Down Expand Up @@ -54,7 +55,7 @@ public function __construct($response, $dbi, Template $template, Export $export,
*/
public function index(): void
{
global $db, $export_type, $filename_template, $sql_query, $err_url, $message;
global $containerBuilder, $db, $export_type, $filename_template, $sql_query, $err_url, $message;
global $compression, $crlf, $asfile, $buffer_needed, $save_on_server, $file_handle;
global $output_charset_conversion, $output_kanji_conversion, $table, $what, $export_plugin, $single_table;
global $compression_methods, $onserver, $back_button, $refreshButton, $save_filename, $filename, $separate_files;
Expand Down Expand Up @@ -436,7 +437,9 @@ public function index(): void
__('No tables found in database.')
);
$active_page = Url::getFromRoute('/database/export');
include ROOT_PATH . 'libraries/entry_points/database/export.php';
/** @var DatabaseExportController $controller */
$controller = $containerBuilder->get(DatabaseExportController::class);
$controller->index();
exit;
}
}
Expand Down
5 changes: 4 additions & 1 deletion libraries/classes/Export.php
Expand Up @@ -8,6 +8,7 @@

namespace PhpMyAdmin;

use PhpMyAdmin\Controllers\Database\ExportController as DatabaseExportController;
use PhpMyAdmin\Controllers\Server\ExportController as ServerExportController;
use PhpMyAdmin\Plugins\ExportPlugin;
use PhpMyAdmin\Plugins\SchemaPlugin;
Expand Down Expand Up @@ -1057,7 +1058,9 @@ public function showPage(string $db, string $table, string $export_type): void
$controller->index();
} elseif ($export_type == 'database') {
$active_page = Url::getFromRoute('/database/export');
include_once ROOT_PATH . 'libraries/entry_points/database/export.php';
/** @var DatabaseExportController $controller */
$controller = $containerBuilder->get(DatabaseExportController::class);
$controller->index();
} else {
$active_page = Url::getFromRoute('/table/export');
include_once ROOT_PATH . 'libraries/entry_points/table/export.php';
Expand Down
17 changes: 0 additions & 17 deletions libraries/entry_points/database/export.php

This file was deleted.

7 changes: 5 additions & 2 deletions libraries/mult_submits.inc.php
Expand Up @@ -7,6 +7,7 @@
declare(strict_types=1);

use PhpMyAdmin\CentralColumns;
use PhpMyAdmin\Controllers\Database\ExportController;
use PhpMyAdmin\Message;
use PhpMyAdmin\MultSubmits;
use PhpMyAdmin\Response;
Expand Down Expand Up @@ -44,7 +45,7 @@
}
$response = Response::getInstance();

global $db, $table, $clause_is_unique, $from_prefix, $goto, $message,
global $containerBuilder, $db, $table, $clause_is_unique, $from_prefix, $goto, $message,
$mult_btn, $original_sql_query, $query_type, $reload,
$selected, $selected_fld, $selected_recent_table, $sql_query,
$submit_mult, $table_type, $to_prefix, $url_query, $pmaThemeImage;
Expand Down Expand Up @@ -95,7 +96,9 @@
break;
case 'export':
unset($submit_mult);
include ROOT_PATH . 'libraries/entry_points/database/export.php';
/** @var ExportController $controller */
$controller = $containerBuilder->get(ExportController::class);
$controller->index();
exit;
case 'copy_tbl':
$views = $GLOBALS['dbi']->getVirtualTables($db);
Expand Down

0 comments on commit bb42779

Please sign in to comment.