Translated using Weblate (Slovenian)
[phpmyadmin.git] / import.php
blob035e076dc07d10de6664f79cd1e76758e2c68a64
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Core script for import, this is just the glue around all other stuff
6 * @package PhpMyAdmin
7 */
9 /**
10 * Get the variables sent or posted to this script and a core script
12 require_once 'libraries/common.inc.php';
13 require_once 'libraries/sql.lib.php';
14 require_once 'libraries/bookmark.lib.php';
15 require_once 'libraries/Console.class.php';
16 //require_once 'libraries/display_import_functions.lib.php';
18 if (isset($_REQUEST['show_as_php'])) {
19 $GLOBALS['show_as_php'] = $_REQUEST['show_as_php'];
22 // Import functions.
23 require_once 'libraries/import.lib.php';
25 // If there is a request to 'Simulate DML'.
26 if (isset($_REQUEST['simulate_dml'])) {
27 PMA_handleSimulateDMLRequest();
28 exit;
31 // If it's a refresh console bookmarks request
32 if (isset($_REQUEST['console_bookmark_refresh'])) {
33 $response = PMA_Response::getInstance();
34 $response->addJSON(
35 'console_message_bookmark', PMA_Console::getBookmarkContent()
37 exit;
39 // If it's a console bookmark add request
40 if (isset($_REQUEST['console_bookmark_add'])) {
41 $response = PMA_Response::getInstance();
42 if (isset($_REQUEST['label']) && isset($_REQUEST['db'])
43 && isset($_REQUEST['bookmark_query']) && isset($_REQUEST['shared'])
44 ) {
45 $cfgBookmark = PMA_Bookmark_getParams();
46 $bookmarkFields = array(
47 'bkm_database' => $_REQUEST['db'],
48 'bkm_user' => $cfgBookmark['user'],
49 'bkm_sql_query' => urlencode($_REQUEST['bookmark_query']),
50 'bkm_label' => $_REQUEST['label']
52 $isShared = ($_REQUEST['shared'] == 'true' ? true : false);
53 if (PMA_Bookmark_save($bookmarkFields, $isShared)) {
54 $response->addJSON('message', __('Succeeded'));
55 $response->addJSON('data', $bookmarkFields);
56 $response->addJSON('isShared', $isShared);
57 } else {
58 $response->addJSON('message', __('Failed'));
60 die();
61 } else {
62 $response->addJSON('message', __('Incomplete params'));
63 die();
67 /**
68 * Sets globals from $_POST
70 $post_params = array(
71 'bkm_label',
72 'charset_of_file',
73 'format',
74 'import_type',
75 'is_js_confirmed',
76 'MAX_FILE_SIZE',
77 'message_to_show',
78 'noplugin',
79 'skip_queries',
80 'local_import_file'
83 // TODO: adapt full list of allowed parameters, as in export.php
84 foreach ($post_params as $one_post_param) {
85 if (isset($_POST[$one_post_param])) {
86 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
90 // reset import messages for ajax request
91 $_SESSION['Import_message']['message'] = null;
92 $_SESSION['Import_message']['go_back_url'] = null;
93 // default values
94 $GLOBALS['reload'] = false;
96 // Use to identify current cycle is executing
97 // a multiquery statement or stored routine
98 if (!isset($_SESSION['is_multi_query'])) {
99 $_SESSION['is_multi_query'] = false;
102 // Are we just executing plain query or sql file?
103 // (eg. non import, but query box/window run)
104 if (! empty($sql_query)) {
105 // run SQL query
106 $import_text = $sql_query;
107 $import_type = 'query';
108 $format = 'sql';
109 $_SESSION['sql_from_query_box'] = true;
111 // If there is a request to ROLLBACK when finished.
112 if (isset($_REQUEST['rollback_query'])) {
113 PMA_handleRollbackRequest($import_text);
116 // refresh navigation and main panels
117 if (preg_match('/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $sql_query)) {
118 $GLOBALS['reload'] = true;
121 // refresh navigation panel only
122 if (preg_match(
123 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
124 $sql_query
125 )) {
126 $ajax_reload = array('reload' => true);
129 // do a dynamic reload if table is RENAMED
130 // (by sending the instruction to the AJAX response handler)
131 if (preg_match(
132 '/^RENAME\s+TABLE\s+(.*?)\s+TO\s+(.*?)($|;|\s)/i',
133 $sql_query,
134 $rename_table_names
135 )) {
136 $ajax_reload = array('reload' => true);
137 $ajax_reload['table_name'] = PMA_Util::unQuote($rename_table_names[2]);
140 $sql_query = '';
141 } elseif (! empty($sql_localfile)) {
142 // run SQL file on server
143 $local_import_file = $sql_localfile;
144 $import_type = 'queryfile';
145 $format = 'sql';
146 unset($sql_localfile);
147 } elseif (! empty($sql_file)) {
148 // run uploaded SQL file
149 $import_file = $sql_file;
150 $import_type = 'queryfile';
151 $format = 'sql';
152 unset($sql_file);
153 } elseif (! empty($_REQUEST['id_bookmark'])) {
154 // run bookmark
155 $import_type = 'query';
156 $format = 'sql';
159 // If we didn't get any parameters, either user called this directly, or
160 // upload limit has been reached, let's assume the second possibility.
161 if ($_POST == array() && $_GET == array()) {
162 $message = PMA_Message::error(
163 __('You probably tried to upload a file that is too large. Please refer to %sdocumentation%s for a workaround for this limit.')
165 $message->addParam('[doc@faq1-16]');
166 $message->addParam('[/doc]');
168 // so we can obtain the message
169 $_SESSION['Import_message']['message'] = $message->getDisplay();
170 $_SESSION['Import_message']['go_back_url'] = $GLOBALS['goto'];
172 $message->display();
173 exit; // the footer is displayed automatically
176 // Add console message id to response output
177 if (isset($_POST['console_message_id'])) {
178 $response = PMA_Response::getInstance();
179 $response->addJSON('console_message_id', $_POST['console_message_id']);
183 * Sets globals from $_POST patterns, for import plugins
184 * We only need to load the selected plugin
187 if (! in_array(
188 $format,
189 array(
190 'csv',
191 'ldi',
192 'mediawiki',
193 'ods',
194 'shp',
195 'sql',
196 'xml'
200 // this should not happen for a normal user
201 // but only during an attack
202 PMA_fatalError('Incorrect format parameter');
205 $post_patterns = array(
206 '/^force_file_/',
207 '/^' . $format . '_/'
210 PMA_setPostAsGlobal($post_patterns);
212 // Check needed parameters
213 PMA_Util::checkParameters(array('import_type', 'format'));
215 // We don't want anything special in format
216 $format = PMA_securePath($format);
217 /** @var PMA_String $pmaString */
218 $pmaString = $GLOBALS['PMA_String'];
220 // Create error and goto url
221 if ($import_type == 'table') {
222 $err_url = 'tbl_import.php' . PMA_URL_getCommon(
223 array(
224 'db' => $db, 'table' => $table
227 $_SESSION['Import_message']['go_back_url'] = $err_url;
228 $goto = 'tbl_import.php';
229 } elseif ($import_type == 'database') {
230 $err_url = 'db_import.php' . PMA_URL_getCommon(array('db' => $db));
231 $_SESSION['Import_message']['go_back_url'] = $err_url;
232 $goto = 'db_import.php';
233 } elseif ($import_type == 'server') {
234 $err_url = 'server_import.php' . PMA_URL_getCommon();
235 $_SESSION['Import_message']['go_back_url'] = $err_url;
236 $goto = 'server_import.php';
237 } else {
238 if (empty($goto) || !preg_match('@^(server|db|tbl)(_[a-z]*)*\.php$@i', $goto)) {
239 if (/*overload*/mb_strlen($table) && /*overload*/mb_strlen($db)) {
240 $goto = 'tbl_structure.php';
241 } elseif (/*overload*/mb_strlen($db)) {
242 $goto = 'db_structure.php';
243 } else {
244 $goto = 'server_sql.php';
247 if (/*overload*/mb_strlen($table) && /*overload*/mb_strlen($db)) {
248 $common = PMA_URL_getCommon(array('db' => $db, 'table' => $table));
249 } elseif (/*overload*/mb_strlen($db)) {
250 $common = PMA_URL_getCommon(array('db' => $db));
251 } else {
252 $common = PMA_URL_getCommon();
254 $err_url = $goto . $common
255 . (preg_match('@^tbl_[a-z]*\.php$@', $goto)
256 ? '&amp;table=' . htmlspecialchars($table)
257 : '');
258 $_SESSION['Import_message']['go_back_url'] = $err_url;
260 // Avoid setting selflink to 'import.php'
261 // problem similar to bug 4276
262 if (basename($_SERVER['SCRIPT_NAME']) === 'import.php') {
263 $_SERVER['SCRIPT_NAME'] = $goto;
267 if (/*overload*/mb_strlen($db)) {
268 $GLOBALS['dbi']->selectDb($db);
271 @set_time_limit($cfg['ExecTimeLimit']);
272 if (! empty($cfg['MemoryLimit'])) {
273 @ini_set('memory_limit', $cfg['MemoryLimit']);
276 $timestamp = time();
277 if (isset($_REQUEST['allow_interrupt'])) {
278 $maximum_time = ini_get('max_execution_time');
279 } else {
280 $maximum_time = 0;
283 // set default values
284 $timeout_passed = false;
285 $error = false;
286 $read_multiply = 1;
287 $finished = false;
288 $offset = 0;
289 $max_sql_len = 0;
290 $file_to_unlink = '';
291 $sql_query = '';
292 $sql_query_disabled = false;
293 $go_sql = false;
294 $executed_queries = 0;
295 $run_query = true;
296 $charset_conversion = false;
297 $reset_charset = false;
298 $bookmark_created = false;
300 // Bookmark Support: get a query back from bookmark if required
301 if (! empty($_REQUEST['id_bookmark'])) {
302 $id_bookmark = (int)$_REQUEST['id_bookmark'];
303 include_once 'libraries/bookmark.lib.php';
304 switch ($_REQUEST['action_bookmark']) {
305 case 0: // bookmarked query that have to be run
306 $import_text = PMA_Bookmark_get(
307 $db,
308 $id_bookmark,
309 'id',
310 isset($_REQUEST['action_bookmark_all'])
312 if (! empty($_REQUEST['bookmark_variable'])) {
313 $import_text = preg_replace(
314 '|/\*(.*)\[VARIABLE\](.*)\*/|imsU',
315 '${1}' . PMA_Util::sqlAddSlashes($_REQUEST['bookmark_variable']) . '${2}',
316 $import_text
320 // refresh navigation and main panels
321 if (preg_match(
322 '/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
323 $import_text
324 )) {
325 $GLOBALS['reload'] = true;
328 // refresh navigation panel only
329 if (preg_match(
330 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
331 $import_text
334 if (! isset($ajax_reload)) {
335 $ajax_reload = array();
337 $ajax_reload['reload'] = true;
339 break;
340 case 1: // bookmarked query that have to be displayed
341 $import_text = PMA_Bookmark_get($db, $id_bookmark);
342 if ($GLOBALS['is_ajax_request'] == true) {
343 $message = PMA_Message::success(__('Showing bookmark'));
344 $response = PMA_Response::getInstance();
345 $response->isSuccess($message->isSuccess());
346 $response->addJSON('message', $message);
347 $response->addJSON('sql_query', $import_text);
348 $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']);
349 exit;
350 } else {
351 $run_query = false;
353 break;
354 case 2: // bookmarked query that have to be deleted
355 $import_text = PMA_Bookmark_get($db, $id_bookmark);
356 PMA_Bookmark_delete($id_bookmark);
357 if ($GLOBALS['is_ajax_request'] == true) {
358 $message = PMA_Message::success(__('The bookmark has been deleted.'));
359 $response = PMA_Response::getInstance();
360 $response->isSuccess($message->isSuccess());
361 $response->addJSON('message', $message);
362 $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']);
363 $response->addJSON('id_bookmark', $id_bookmark);
364 exit;
365 } else {
366 $run_query = false;
367 $error = true; // this is kind of hack to skip processing the query
369 break;
371 } // end bookmarks reading
373 // Do no run query if we show PHP code
374 if (isset($GLOBALS['show_as_php'])) {
375 $run_query = false;
376 $go_sql = true;
379 // We can not read all at once, otherwise we can run out of memory
380 $memory_limit = trim(@ini_get('memory_limit'));
381 // 2 MB as default
382 if (empty($memory_limit)) {
383 $memory_limit = 2 * 1024 * 1024;
385 // In case no memory limit we work on 10MB chunks
386 if ($memory_limit == -1) {
387 $memory_limit = 10 * 1024 * 1024;
390 // Calculate value of the limit
391 $memoryUnit = /*overload*/mb_strtolower(substr($memory_limit, -1));
392 if ('m' == $memoryUnit) {
393 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
394 } elseif ('k' == $memoryUnit) {
395 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
396 } elseif ('g' == $memoryUnit) {
397 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
398 } else {
399 $memory_limit = (int)$memory_limit;
402 // Just to be sure, there might be lot of memory needed for uncompression
403 $read_limit = $memory_limit / 8;
405 // handle filenames
406 if (isset($_FILES['import_file'])) {
407 $import_file = $_FILES['import_file']['tmp_name'];
409 if (! empty($local_import_file) && ! empty($cfg['UploadDir'])) {
411 // sanitize $local_import_file as it comes from a POST
412 $local_import_file = PMA_securePath($local_import_file);
414 $import_file = PMA_Util::userDir($cfg['UploadDir'])
415 . $local_import_file;
417 } elseif (empty($import_file) || ! is_uploaded_file($import_file)) {
418 $import_file = 'none';
421 // Do we have file to import?
423 if ($import_file != 'none' && ! $error) {
424 // work around open_basedir and other limitations
425 $open_basedir = @ini_get('open_basedir');
427 // If we are on a server with open_basedir, we must move the file
428 // before opening it.
430 if (! empty($open_basedir)) {
431 $tmp_subdir = ini_get('upload_tmp_dir');
432 if (empty($tmp_subdir)) {
433 $tmp_subdir = sys_get_temp_dir();
435 $tmp_subdir = rtrim($tmp_subdir, DIRECTORY_SEPARATOR);
436 if (is_writable($tmp_subdir)) {
437 $import_file_new = $tmp_subdir . DIRECTORY_SEPARATOR
438 . basename($import_file) . uniqid();
439 if (move_uploaded_file($import_file, $import_file_new)) {
440 $import_file = $import_file_new;
441 $file_to_unlink = $import_file_new;
444 $size = filesize($import_file);
445 } else {
447 // If the php.ini is misconfigured (eg. there is no /tmp access defined
448 // with open_basedir), $tmp_subdir won't be writable and the user gets
449 // a 'File could not be read!' error (at PMA_detectCompression), which
450 // is not too meaningful. Show a meaningful error message to the user
451 // instead.
453 $message = PMA_Message::error(
454 __('Uploaded file cannot be moved, because the server has open_basedir enabled without access to the %s directory (for temporary files).')
456 $message->addParam($tmp_subdir);
457 PMA_stopImport($message);
462 * Handle file compression
463 * @todo duplicate code exists in File.class.php
465 $compression = PMA_detectCompression($import_file);
466 if ($compression === false) {
467 $message = PMA_Message::error(__('File could not be read!'));
468 PMA_stopImport($message); //Contains an 'exit'
471 switch ($compression) {
472 case 'application/bzip2':
473 if ($cfg['BZipDump'] && @function_exists('bzopen')) {
474 $import_handle = @bzopen($import_file, 'r');
475 } else {
476 $message = PMA_Message::error(
477 __('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.')
479 $message->addParam($compression);
480 PMA_stopImport($message);
482 break;
483 case 'application/gzip':
484 if ($cfg['GZipDump'] && @function_exists('gzopen')) {
485 $import_handle = @gzopen($import_file, 'r');
486 } else {
487 $message = PMA_Message::error(
488 __('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.')
490 $message->addParam($compression);
491 PMA_stopImport($message);
493 break;
494 case 'application/zip':
495 if ($cfg['ZipDump'] && @function_exists('zip_open')) {
497 * Load interface for zip extension.
499 include_once 'libraries/zip_extension.lib.php';
500 $zipResult = PMA_getZipContents($import_file);
501 if (! empty($zipResult['error'])) {
502 $message = PMA_Message::rawError($zipResult['error']);
503 PMA_stopImport($message);
504 } else {
505 $import_text = $zipResult['data'];
507 } else {
508 $message = PMA_Message::error(
509 __('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.')
511 $message->addParam($compression);
512 PMA_stopImport($message);
514 break;
515 case 'none':
516 $import_handle = @fopen($import_file, 'r');
517 break;
518 default:
519 $message = PMA_Message::error(
520 __('You attempted to load file with unsupported compression (%s). Either support for it is not implemented or disabled by your configuration.')
522 $message->addParam($compression);
523 PMA_stopImport($message);
524 break;
526 // use isset() because zip compression type does not use a handle
527 if (! $error && isset($import_handle) && $import_handle === false) {
528 $message = PMA_Message::error(__('File could not be read!'));
529 PMA_stopImport($message);
531 } elseif (! $error) {
532 if (! isset($import_text) || empty($import_text)) {
533 $message = PMA_Message::error(
534 __('No data was received to import. Either no file name was submitted, or the file size exceeded the maximum size permitted by your PHP configuration. See [doc@faq1-16]FAQ 1.16[/doc].')
536 PMA_stopImport($message);
540 // so we can obtain the message
541 //$_SESSION['Import_message'] = $message->getDisplay();
543 // Convert the file's charset if necessary
544 if ($GLOBALS['PMA_recoding_engine'] != PMA_CHARSET_NONE && isset($charset_of_file)) {
545 if ($charset_of_file != 'utf-8') {
546 $charset_conversion = true;
548 } elseif (isset($charset_of_file) && $charset_of_file != 'utf-8') {
549 if (PMA_DRIZZLE) {
550 // Drizzle doesn't support other character sets,
551 // so we can't fallback to SET NAMES - throw an error
552 $message = PMA_Message::error(
554 'Cannot convert file\'s character'
555 . ' set without character set conversion library!'
558 PMA_stopImport($message);
559 } else {
560 $GLOBALS['dbi']->query('SET NAMES \'' . $charset_of_file . '\'');
561 // We can not show query in this case, it is in different charset
562 $sql_query_disabled = true;
563 $reset_charset = true;
567 // Something to skip?
568 if (! $error && isset($skip)) {
569 $original_skip = $skip;
570 while ($skip > 0) {
571 PMA_importGetNextChunk($skip < $read_limit ? $skip : $read_limit);
572 // Disable read progressivity, otherwise we eat all memory!
573 $read_multiply = 1;
574 $skip -= $read_limit;
576 unset($skip);
579 // This array contain the data like numberof valid sql queries in the statement
580 // and complete valid sql statement (which affected for rows)
581 $sql_data = array('valid_sql' => array(), 'valid_queries' => 0);
583 if (! $error) {
584 // Check for file existence
585 include_once "libraries/plugin_interface.lib.php";
586 $import_plugin = PMA_getPlugin(
587 "import",
588 $format,
589 'libraries/plugins/import/',
590 $import_type
592 if ($import_plugin == null) {
593 $message = PMA_Message::error(
594 __('Could not load import plugins, please check your installation!')
596 PMA_stopImport($message);
597 } else {
598 // Do the real import
599 $import_plugin->doImport($sql_data);
603 if (! empty($import_handle)) {
604 fclose($import_handle);
607 // Cleanup temporary file
608 if ($file_to_unlink != '') {
609 unlink($file_to_unlink);
612 // Reset charset back, if we did some changes
613 if ($reset_charset) {
614 $GLOBALS['dbi']->query('SET CHARACTER SET utf8');
615 $GLOBALS['dbi']->query(
616 'SET SESSION collation_connection =\'' . $collation_connection . '\''
620 // Show correct message
621 if (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 2) {
622 $message = PMA_Message::success(__('The bookmark has been deleted.'));
623 $display_query = $import_text;
624 $error = false; // unset error marker, it was used just to skip processing
625 } elseif (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 1) {
626 $message = PMA_Message::notice(__('Showing bookmark'));
627 } elseif ($bookmark_created) {
628 $special_message = '[br]' . sprintf(
629 __('Bookmark %s has been created.'),
630 htmlspecialchars($bkm_label)
632 } elseif ($finished && ! $error) {
633 if ($import_type == 'query') {
634 $message = PMA_Message::success();
635 } else {
636 $message = PMA_Message::success(
637 '<em>'
638 . __('Import has been successfully finished, %d queries executed.')
639 . '</em>'
641 $message->addParam($executed_queries);
643 if ($import_notice) {
644 $message->addString($import_notice);
646 if (isset($local_import_file)) {
647 $message->addString('(' . htmlspecialchars($local_import_file) . ')');
648 } else {
649 $message->addString(
650 '(' . htmlspecialchars($_FILES['import_file']['name']) . ')'
656 // Did we hit timeout? Tell it user.
657 if ($timeout_passed) {
658 $message = PMA_Message::error(
660 'Script timeout passed, if you want to finish import,'
661 . ' please resubmit same file and import will resume.'
664 if ($offset == 0 || (isset($original_skip) && $original_skip == $offset)) {
665 $message->addString(
667 'However on last run no data has been parsed,'
668 . ' this usually means phpMyAdmin won\'t be able to'
669 . ' finish this import unless you increase php time limits.'
675 // if there is any message, copy it into $_SESSION as well,
676 // so we can obtain it by AJAX call
677 if (isset($message)) {
678 $_SESSION['Import_message']['message'] = $message->getDisplay();
680 // Parse and analyze the query, for correct db and table name
681 // in case of a query typed in the query window
682 // (but if the query is too large, in case of an imported file, the parser
683 // can choke on it so avoid parsing)
684 $sqlLength = /*overload*/mb_strlen($sql_query);
685 if ($sqlLength <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
686 include_once 'libraries/parse_analyze.inc.php';
689 // There was an error?
690 if (isset($my_die)) {
691 foreach ($my_die as $key => $die) {
692 PMA_Util::mysqlDie(
693 $die['error'], $die['sql'], false, $err_url, $error
698 if ($go_sql) {
700 if (! empty($sql_data) && ($sql_data['valid_queries'] > 1)) {
701 $_SESSION['is_multi_query'] = true;
702 $sql_queries = $sql_data['valid_sql'];
703 } else {
704 $sql_queries = array($sql_query);
707 $html_output = '';
708 foreach ($sql_queries as $sql_query) {
709 // parse sql query
710 include 'libraries/parse_analyze.inc.php';
712 $html_output .= PMA_executeQueryAndGetQueryResponse(
713 $analyzed_sql_results, false, $db, $table, null,
714 $sql_query, null, $analyzed_sql_results['is_affected'],
715 null, null, null, $goto, $pmaThemeImage,
716 null, null, null, $sql_query, null, null
720 if (!isset($ajax_reload)) {
721 $ajax_reload = array();
723 if (isset($table)) {
724 $ajax_reload['table_name'] = $table;
726 $response = PMA_Response::getInstance();
727 $response->addJSON('ajax_reload', $ajax_reload);
728 $response->addHTML($html_output);
729 exit();
731 } else if ($result) {
732 // Save a Bookmark with more than one queries (if Bookmark label given).
733 if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
734 $cfgBookmark = PMA_Bookmark_getParams();
735 PMA_storeTheQueryAsBookmark(
736 $db, $cfgBookmark['user'],
737 $import_text, $_POST['bkm_label'],
738 isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
742 $response = PMA_Response::getInstance();
743 $response->isSuccess(true);
744 $response->addJSON('message', PMA_Message::success($msg));
745 $response->addJSON(
746 'sql_query',
747 PMA_Util::getMessage($msg, $sql_query, 'success')
749 } else if ($result == false) {
750 $response = PMA_Response::getInstance();
751 $response->isSuccess(false);
752 $response->addJSON('message', PMA_Message::error($msg));
753 } else {
754 $active_page = $goto;
755 include '' . $goto;
758 // If there is request for ROLLBACK in the end.
759 if (isset($_REQUEST['rollback_query'])) {
760 $GLOBALS['dbi']->query('ROLLBACK');