diff options
author | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2017-09-05 04:35:55 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2017-09-05 04:35:55 +0300 |
commit | 19e0199a364aedb1957e98e273c963d49f1a5c7c (patch) | |
tree | 8649a3c14df944625263c6917aba8ecd549d81bd /import.php | |
parent | 53f77c7a49ab857fe3a578926002cfd051ec2b17 (diff) |
Refactor import functions to static methods
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'import.php')
-rw-r--r-- | import.php | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/import.php b/import.php index 76ed062add..65780c1d34 100644 --- a/import.php +++ b/import.php @@ -10,6 +10,7 @@ use PhpMyAdmin\Bookmark; use PhpMyAdmin\Core; use PhpMyAdmin\Encoding; use PhpMyAdmin\File; +use PhpMyAdmin\Import; use PhpMyAdmin\Plugins\ImportPlugin; use PhpMyAdmin\Response; use PhpMyAdmin\Sql; @@ -30,12 +31,9 @@ if (isset($_REQUEST['show_as_php'])) { $GLOBALS['show_as_php'] = $_REQUEST['show_as_php']; } -// Import functions. -require_once 'libraries/import.lib.php'; - // If there is a request to 'Simulate DML'. if (isset($_REQUEST['simulate_dml'])) { - PMA_handleSimulateDMLRequest(); + Import::handleSimulateDmlRequest(); exit; } @@ -147,7 +145,7 @@ if (! empty($sql_query)) { // If there is a request to ROLLBACK when finished. if (isset($_REQUEST['rollback_query'])) { - PMA_handleRollbackRequest($import_text); + Import::handleRollbackRequest($import_text); } // refresh navigation and main panels @@ -464,12 +462,12 @@ if ($import_file != 'none' && ! $error) { $import_handle = new File($import_file); $import_handle->checkUploadedFile(); if ($import_handle->isError()) { - PMA_stopImport($import_handle->getError()); + Import::stop($import_handle->getError()); } $import_handle->setDecompressContent(true); $import_handle->open(); if ($import_handle->isError()) { - PMA_stopImport($import_handle->getError()); + Import::stop($import_handle->getError()); } } elseif (! $error) { if (! isset($import_text) || empty($import_text)) { @@ -480,7 +478,7 @@ if ($import_file != 'none' && ! $error) { 'by your PHP configuration. See [doc@faq1-16]FAQ 1.16[/doc].' ) ); - PMA_stopImport($message); + Import::stop($message); } } @@ -503,7 +501,7 @@ if (Encoding::isSupported() && isset($charset_of_file)) { if (! $error && isset($_POST['skip'])) { $original_skip = $skip = intval($_POST['skip']); while ($skip > 0 && ! $finished) { - PMA_importGetNextChunk($skip < $read_limit ? $skip : $read_limit); + Import::getNextChunk($skip < $read_limit ? $skip : $read_limit); // Disable read progressivity, otherwise we eat all memory! $read_multiply = 1; $skip -= $read_limit; @@ -529,7 +527,7 @@ if (! $error) { $message = PhpMyAdmin\Message::error( __('Could not load import plugins, please check your installation!') ); - PMA_stopImport($message); + Import::stop($message); } else { // Do the real import try { |