Translated using Weblate (Belarusian)
[phpmyadmin.git] / import.php
blob7b6a415483f5b6f351cc9860e77963311669e704
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 */
8 use PMA\libraries\Response;
9 use PMA\libraries\Encoding;
10 use PMA\libraries\plugins\ImportPlugin;
11 use PMA\libraries\File;
12 use PMA\libraries\URL;
13 use PMA\libraries\Bookmark;
15 /* Enable LOAD DATA LOCAL INFILE for LDI plugin */
16 if (isset($_POST['format']) && $_POST['format'] == 'ldi') {
17 define('PMA_ENABLE_LDI', 1);
20 /**
21 * Get the variables sent or posted to this script and a core script
23 require_once 'libraries/common.inc.php';
24 require_once 'libraries/sql.lib.php';
25 //require_once 'libraries/display_import_functions.lib.php';
27 if (isset($_REQUEST['show_as_php'])) {
28 $GLOBALS['show_as_php'] = $_REQUEST['show_as_php'];
31 // Import functions.
32 require_once 'libraries/import.lib.php';
34 // If there is a request to 'Simulate DML'.
35 if (isset($_REQUEST['simulate_dml'])) {
36 PMA_handleSimulateDMLRequest();
37 exit;
40 $response = Response::getInstance();
42 // If it's a refresh console bookmarks request
43 if (isset($_REQUEST['console_bookmark_refresh'])) {
44 $response->addJSON(
45 'console_message_bookmark', PMA\libraries\Console::getBookmarkContent()
47 exit;
49 // If it's a console bookmark add request
50 if (isset($_REQUEST['console_bookmark_add'])) {
51 if (isset($_REQUEST['label']) && isset($_REQUEST['db'])
52 && isset($_REQUEST['bookmark_query']) && isset($_REQUEST['shared'])
53 ) {
54 $cfgBookmark = Bookmark::getParams();
55 $bookmarkFields = array(
56 'bkm_database' => $_REQUEST['db'],
57 'bkm_user' => $cfgBookmark['user'],
58 'bkm_sql_query' => $_REQUEST['bookmark_query'],
59 'bkm_label' => $_REQUEST['label']
61 $isShared = ($_REQUEST['shared'] == 'true' ? true : false);
62 $bookmark = Bookmark::createBookmark($bookmarkFields, $isShared);
63 if ($bookmark !== false && $bookmark->save()) {
64 $response->addJSON('message', __('Succeeded'));
65 $response->addJSON('data', $bookmarkFields);
66 $response->addJSON('isShared', $isShared);
67 } else {
68 $response->addJSON('message', __('Failed'));
70 die();
71 } else {
72 $response->addJSON('message', __('Incomplete params'));
73 die();
77 $format = '';
79 /**
80 * Sets globals from $_POST
82 $post_params = array(
83 'charset_of_file',
84 'format',
85 'import_type',
86 'is_js_confirmed',
87 'MAX_FILE_SIZE',
88 'message_to_show',
89 'noplugin',
90 'skip_queries',
91 'local_import_file'
94 foreach ($post_params as $one_post_param) {
95 if (isset($_POST[$one_post_param])) {
96 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
100 // reset import messages for ajax request
101 $_SESSION['Import_message']['message'] = null;
102 $_SESSION['Import_message']['go_back_url'] = null;
103 // default values
104 $GLOBALS['reload'] = false;
106 // Use to identify current cycle is executing
107 // a multiquery statement or stored routine
108 if (!isset($_SESSION['is_multi_query'])) {
109 $_SESSION['is_multi_query'] = false;
112 $ajax_reload = array();
113 // Are we just executing plain query or sql file?
114 // (eg. non import, but query box/window run)
115 if (! empty($sql_query)) {
117 // apply values for parameters
118 if (! empty($_REQUEST['parameterized'])
119 && ! empty($_REQUEST['parameters'])
120 && is_array($_REQUEST['parameters'])
122 $parameters = $_REQUEST['parameters'];
123 foreach ($parameters as $parameter => $replacement) {
124 $quoted = preg_quote($parameter, '/');
125 // making sure that :param does not apply values to :param1
126 $sql_query = preg_replace(
127 '/' . $quoted . '([^a-zA-Z0-9_])/',
128 $GLOBALS['dbi']->escapeString($replacement) . '${1}',
129 $sql_query
131 // for parameters the appear at the end of the string
132 $sql_query = preg_replace(
133 '/' . $quoted . '$/',
134 $GLOBALS['dbi']->escapeString($replacement),
135 $sql_query
140 // run SQL query
141 $import_text = $sql_query;
142 $import_type = 'query';
143 $format = 'sql';
144 $_SESSION['sql_from_query_box'] = true;
146 // If there is a request to ROLLBACK when finished.
147 if (isset($_REQUEST['rollback_query'])) {
148 PMA_handleRollbackRequest($import_text);
151 // refresh navigation and main panels
152 if (preg_match('/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $sql_query)) {
153 $GLOBALS['reload'] = true;
154 $ajax_reload['reload'] = true;
157 // refresh navigation panel only
158 if (preg_match(
159 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
160 $sql_query
161 )) {
162 $ajax_reload['reload'] = true;
165 // do a dynamic reload if table is RENAMED
166 // (by sending the instruction to the AJAX response handler)
167 if (preg_match(
168 '/^RENAME\s+TABLE\s+(.*?)\s+TO\s+(.*?)($|;|\s)/i',
169 $sql_query,
170 $rename_table_names
171 )) {
172 $ajax_reload['reload'] = true;
173 $ajax_reload['table_name'] = PMA\libraries\Util::unQuote(
174 $rename_table_names[2]
178 $sql_query = '';
179 } elseif (! empty($sql_file)) {
180 // run uploaded SQL file
181 $import_file = $sql_file;
182 $import_type = 'queryfile';
183 $format = 'sql';
184 unset($sql_file);
185 } elseif (! empty($_REQUEST['id_bookmark'])) {
186 // run bookmark
187 $import_type = 'query';
188 $format = 'sql';
191 // If we didn't get any parameters, either user called this directly, or
192 // upload limit has been reached, let's assume the second possibility.
193 if ($_POST == array() && $_GET == array()) {
194 $message = PMA\libraries\Message::error(
196 'You probably tried to upload a file that is too large. Please refer ' .
197 'to %sdocumentation%s for a workaround for this limit.'
200 $message->addParam('[doc@faq1-16]');
201 $message->addParam('[/doc]');
203 // so we can obtain the message
204 $_SESSION['Import_message']['message'] = $message->getDisplay();
205 $_SESSION['Import_message']['go_back_url'] = $GLOBALS['goto'];
207 $response->setRequestStatus(false);
208 $response->addJSON('message', $message);
210 exit; // the footer is displayed automatically
213 // Add console message id to response output
214 if (isset($_POST['console_message_id'])) {
215 $response->addJSON('console_message_id', $_POST['console_message_id']);
219 * Sets globals from $_POST patterns, for import plugins
220 * We only need to load the selected plugin
223 if (! in_array(
224 $format,
225 array(
226 'csv',
227 'ldi',
228 'mediawiki',
229 'ods',
230 'shp',
231 'sql',
232 'xml'
236 // this should not happen for a normal user
237 // but only during an attack
238 PMA_fatalError('Incorrect format parameter');
241 $post_patterns = array(
242 '/^force_file_/',
243 '/^' . $format . '_/'
246 PMA_setPostAsGlobal($post_patterns);
248 // Check needed parameters
249 PMA\libraries\Util::checkParameters(array('import_type', 'format'));
251 // We don't want anything special in format
252 $format = PMA_securePath($format);
254 // Create error and goto url
255 if ($import_type == 'table') {
256 $err_url = 'tbl_import.php' . URL::getCommon(
257 array(
258 'db' => $db, 'table' => $table
261 $_SESSION['Import_message']['go_back_url'] = $err_url;
262 $goto = 'tbl_import.php';
263 } elseif ($import_type == 'database') {
264 $err_url = 'db_import.php' . URL::getCommon(array('db' => $db));
265 $_SESSION['Import_message']['go_back_url'] = $err_url;
266 $goto = 'db_import.php';
267 } elseif ($import_type == 'server') {
268 $err_url = 'server_import.php' . URL::getCommon();
269 $_SESSION['Import_message']['go_back_url'] = $err_url;
270 $goto = 'server_import.php';
271 } else {
272 if (empty($goto) || !preg_match('@^(server|db|tbl)(_[a-z]*)*\.php$@i', $goto)) {
273 if (strlen($table) > 0 && strlen($db) > 0) {
274 $goto = 'tbl_structure.php';
275 } elseif (strlen($db) > 0) {
276 $goto = 'db_structure.php';
277 } else {
278 $goto = 'server_sql.php';
281 if (strlen($table) > 0 && strlen($db) > 0) {
282 $common = URL::getCommon(array('db' => $db, 'table' => $table));
283 } elseif (strlen($db) > 0) {
284 $common = URL::getCommon(array('db' => $db));
285 } else {
286 $common = URL::getCommon();
288 $err_url = $goto . $common
289 . (preg_match('@^tbl_[a-z]*\.php$@', $goto)
290 ? '&amp;table=' . htmlspecialchars($table)
291 : '');
292 $_SESSION['Import_message']['go_back_url'] = $err_url;
294 // Avoid setting selflink to 'import.php'
295 // problem similar to bug 4276
296 if (basename($_SERVER['SCRIPT_NAME']) === 'import.php') {
297 $_SERVER['SCRIPT_NAME'] = $goto;
301 if (strlen($db) > 0) {
302 $GLOBALS['dbi']->selectDb($db);
305 @set_time_limit($cfg['ExecTimeLimit']);
306 if (! empty($cfg['MemoryLimit'])) {
307 @ini_set('memory_limit', $cfg['MemoryLimit']);
310 $timestamp = time();
311 if (isset($_REQUEST['allow_interrupt'])) {
312 $maximum_time = ini_get('max_execution_time');
313 } else {
314 $maximum_time = 0;
317 // set default values
318 $timeout_passed = false;
319 $error = false;
320 $read_multiply = 1;
321 $finished = false;
322 $offset = 0;
323 $max_sql_len = 0;
324 $file_to_unlink = '';
325 $sql_query = '';
326 $sql_query_disabled = false;
327 $go_sql = false;
328 $executed_queries = 0;
329 $run_query = true;
330 $charset_conversion = false;
331 $reset_charset = false;
332 $bookmark_created = false;
333 $result = false;
334 $msg = 'Sorry an unexpected error happened!';
336 // Bookmark Support: get a query back from bookmark if required
337 if (! empty($_REQUEST['id_bookmark'])) {
338 $id_bookmark = (int)$_REQUEST['id_bookmark'];
339 switch ($_REQUEST['action_bookmark']) {
340 case 0: // bookmarked query that have to be run
341 $bookmark = Bookmark::get(
342 $db,
343 $id_bookmark,
344 'id',
345 isset($_REQUEST['action_bookmark_all'])
348 if (! empty($_REQUEST['bookmark_variable'])) {
349 $import_text = $bookmark->applyVariables(
350 $_REQUEST['bookmark_variable']
352 } else {
353 $import_text = $bookmark->getQuery();
356 // refresh navigation and main panels
357 if (preg_match(
358 '/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
359 $import_text
360 )) {
361 $GLOBALS['reload'] = true;
362 $ajax_reload['reload'] = true;
365 // refresh navigation panel only
366 if (preg_match(
367 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
368 $import_text
371 $ajax_reload['reload'] = true;
373 break;
374 case 1: // bookmarked query that have to be displayed
375 $bookmark = Bookmark::get($db, $id_bookmark);
376 $import_text = $bookmark->getQuery();
377 if ($response->isAjax()) {
378 $message = PMA\libraries\Message::success(__('Showing bookmark'));
379 $response->setRequestStatus($message->isSuccess());
380 $response->addJSON('message', $message);
381 $response->addJSON('sql_query', $import_text);
382 $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']);
383 exit;
384 } else {
385 $run_query = false;
387 break;
388 case 2: // bookmarked query that have to be deleted
389 $bookmark = Bookmark::get($db, $id_bookmark);
390 if (! empty($bookmark)) {
391 $bookmark->delete();
392 if ($response->isAjax()) {
393 $message = PMA\libraries\Message::success(
394 __('The bookmark has been deleted.')
396 $response->setRequestStatus($message->isSuccess());
397 $response->addJSON('message', $message);
398 $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']);
399 $response->addJSON('id_bookmark', $id_bookmark);
400 exit;
401 } else {
402 $run_query = false;
403 $error = true; // this is kind of hack to skip processing the query
407 break;
409 } // end bookmarks reading
411 // Do no run query if we show PHP code
412 if (isset($GLOBALS['show_as_php'])) {
413 $run_query = false;
414 $go_sql = true;
417 // We can not read all at once, otherwise we can run out of memory
418 $memory_limit = trim(@ini_get('memory_limit'));
419 // 2 MB as default
420 if (empty($memory_limit)) {
421 $memory_limit = 2 * 1024 * 1024;
423 // In case no memory limit we work on 10MB chunks
424 if ($memory_limit == -1) {
425 $memory_limit = 10 * 1024 * 1024;
428 // Calculate value of the limit
429 $memoryUnit = mb_strtolower(substr($memory_limit, -1));
430 if ('m' == $memoryUnit) {
431 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
432 } elseif ('k' == $memoryUnit) {
433 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
434 } elseif ('g' == $memoryUnit) {
435 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
436 } else {
437 $memory_limit = (int)$memory_limit;
440 // Just to be sure, there might be lot of memory needed for uncompression
441 $read_limit = $memory_limit / 8;
443 // handle filenames
444 if (isset($_FILES['import_file'])) {
445 $import_file = $_FILES['import_file']['tmp_name'];
447 if (! empty($local_import_file) && ! empty($cfg['UploadDir'])) {
449 // sanitize $local_import_file as it comes from a POST
450 $local_import_file = PMA_securePath($local_import_file);
452 $import_file = PMA\libraries\Util::userDir($cfg['UploadDir'])
453 . $local_import_file;
456 * Do not allow symlinks to avoid security issues
457 * (user can create symlink to file he can not access,
458 * but phpMyAdmin can).
460 if (@is_link($import_file)) {
461 $import_file = 'none';
464 } elseif (empty($import_file) || ! is_uploaded_file($import_file)) {
465 $import_file = 'none';
468 // Do we have file to import?
470 if ($import_file != 'none' && ! $error) {
472 * Handle file compression
474 $import_handle = new File($import_file);
475 $import_handle->checkUploadedFile();
476 if ($import_handle->isError()) {
477 PMA_stopImport($import_handle->getError());
479 $import_handle->setDecompressContent(true);
480 $import_handle->open();
481 if ($import_handle->isError()) {
482 PMA_stopImport($import_handle->getError());
484 } elseif (! $error) {
485 if (! isset($import_text) || empty($import_text)) {
486 $message = PMA\libraries\Message::error(
488 'No data was received to import. Either no file name was ' .
489 'submitted, or the file size exceeded the maximum size permitted ' .
490 'by your PHP configuration. See [doc@faq1-16]FAQ 1.16[/doc].'
493 PMA_stopImport($message);
497 // so we can obtain the message
498 //$_SESSION['Import_message'] = $message->getDisplay();
500 // Convert the file's charset if necessary
501 if (Encoding::isSupported() && isset($charset_of_file)) {
502 if ($charset_of_file != 'utf-8') {
503 $charset_conversion = true;
505 } elseif (isset($charset_of_file) && $charset_of_file != 'utf-8') {
506 $GLOBALS['dbi']->query('SET NAMES \'' . $charset_of_file . '\'');
507 // We can not show query in this case, it is in different charset
508 $sql_query_disabled = true;
509 $reset_charset = true;
512 // Something to skip? (because timeout has passed)
513 if (! $error && isset($_POST['skip'])) {
514 $original_skip = $skip = intval($_POST['skip']);
515 while ($skip > 0 && ! $finished) {
516 PMA_importGetNextChunk($skip < $read_limit ? $skip : $read_limit);
517 // Disable read progressivity, otherwise we eat all memory!
518 $read_multiply = 1;
519 $skip -= $read_limit;
521 unset($skip);
524 // This array contain the data like numberof valid sql queries in the statement
525 // and complete valid sql statement (which affected for rows)
526 $sql_data = array('valid_sql' => array(), 'valid_queries' => 0);
528 if (! $error) {
529 // Check for file existence
530 include_once "libraries/plugin_interface.lib.php";
531 /* @var $import_plugin ImportPlugin */
532 $import_plugin = PMA_getPlugin(
533 "import",
534 $format,
535 'libraries/plugins/import/',
536 $import_type
538 if ($import_plugin == null) {
539 $message = PMA\libraries\Message::error(
540 __('Could not load import plugins, please check your installation!')
542 PMA_stopImport($message);
543 } else {
544 // Do the real import
545 try {
546 $default_fk_check = PMA\libraries\Util::handleDisableFKCheckInit();
547 $import_plugin->doImport($sql_data);
548 PMA\libraries\Util::handleDisableFKCheckCleanup($default_fk_check);
549 } catch (Exception $e) {
550 PMA\libraries\Util::handleDisableFKCheckCleanup($default_fk_check);
551 throw $e;
556 if (isset($import_handle)) {
557 $import_handle->close();
560 // Cleanup temporary file
561 if ($file_to_unlink != '') {
562 unlink($file_to_unlink);
565 // Reset charset back, if we did some changes
566 if ($reset_charset) {
567 $GLOBALS['dbi']->query('SET CHARACTER SET utf8');
568 $GLOBALS['dbi']->query(
569 'SET SESSION collation_connection =\'' . $collation_connection . '\''
573 // Show correct message
574 if (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 2) {
575 $message = PMA\libraries\Message::success(__('The bookmark has been deleted.'));
576 $display_query = $import_text;
577 $error = false; // unset error marker, it was used just to skip processing
578 } elseif (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 1) {
579 $message = PMA\libraries\Message::notice(__('Showing bookmark'));
580 } elseif ($bookmark_created) {
581 $special_message = '[br]' . sprintf(
582 __('Bookmark %s has been created.'),
583 htmlspecialchars($_POST['bkm_label'])
585 } elseif ($finished && ! $error) {
586 // Do not display the query with message, we do it separately
587 $display_query = ';';
588 if ($import_type != 'query') {
589 $message = PMA\libraries\Message::success(
590 '<em>'
591 . _ngettext(
592 'Import has been successfully finished, %d query executed.',
593 'Import has been successfully finished, %d queries executed.',
594 $executed_queries
596 . '</em>'
598 $message->addParam($executed_queries);
600 if ($import_notice) {
601 $message->addHtml($import_notice);
603 if (! empty($local_import_file)) {
604 $message->addText('(' . $local_import_file . ')');
605 } else {
606 $message->addText('(' . $_FILES['import_file']['name'] . ')');
611 // Did we hit timeout? Tell it user.
612 if ($timeout_passed) {
613 $importUrl = $err_url .= '&timeout_passed=1&offset=' . urlencode(
614 $GLOBALS['offset']
616 if (isset($local_import_file)) {
617 $importUrl .= '&local_import_file=' . urlencode($local_import_file);
619 $message = PMA\libraries\Message::error(
621 'Script timeout passed, if you want to finish import,'
622 . ' please %sresubmit the same file%s and import will resume.'
625 $message->addParamHtml('<a href="' . $importUrl . '">');
626 $message->addParamHtml('</a>');
628 if ($offset == 0 || (isset($original_skip) && $original_skip == $offset)) {
629 $message->addText(
631 'However on last run no data has been parsed,'
632 . ' this usually means phpMyAdmin won\'t be able to'
633 . ' finish this import unless you increase php time limits.'
639 // if there is any message, copy it into $_SESSION as well,
640 // so we can obtain it by AJAX call
641 if (isset($message)) {
642 $_SESSION['Import_message']['message'] = $message->getDisplay();
644 // Parse and analyze the query, for correct db and table name
645 // in case of a query typed in the query window
646 // (but if the query is too large, in case of an imported file, the parser
647 // can choke on it so avoid parsing)
648 $sqlLength = mb_strlen($sql_query);
649 if ($sqlLength <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
650 include_once 'libraries/parse_analyze.lib.php';
652 list(
653 $analyzed_sql_results,
654 $db,
655 $table_from_sql
656 ) = PMA_parseAnalyze($sql_query, $db);
657 // @todo: possibly refactor
658 extract($analyzed_sql_results);
660 if ($table != $table_from_sql && !empty($table_from_sql)) {
661 $table = $table_from_sql;
665 // There was an error?
666 if (isset($my_die)) {
667 foreach ($my_die as $key => $die) {
668 PMA\libraries\Util::mysqlDie(
669 $die['error'], $die['sql'], false, $err_url, $error
674 if ($go_sql) {
676 if (! empty($sql_data) && ($sql_data['valid_queries'] > 1)) {
677 $_SESSION['is_multi_query'] = true;
678 $sql_queries = $sql_data['valid_sql'];
679 } else {
680 $sql_queries = array($sql_query);
683 $html_output = '';
685 foreach ($sql_queries as $sql_query) {
687 // parse sql query
688 include_once 'libraries/parse_analyze.lib.php';
689 list(
690 $analyzed_sql_results,
691 $db,
692 $table_from_sql
693 ) = PMA_parseAnalyze($sql_query, $db);
694 // @todo: possibly refactor
695 extract($analyzed_sql_results);
697 // Check if User is allowed to issue a 'DROP DATABASE' Statement
698 if (PMA_hasNoRightsToDropDatabase(
699 $analyzed_sql_results, $cfg['AllowUserDropDatabase'], $GLOBALS['is_superuser']
700 )) {
701 PMA\libraries\Util::mysqlDie(
702 __('"DROP DATABASE" statements are disabled.'),
704 false,
705 $_SESSION['Import_message']['go_back_url']
707 return;
708 } // end if
710 if ($table != $table_from_sql && !empty($table_from_sql)) {
711 $table = $table_from_sql;
714 $html_output .= PMA_executeQueryAndGetQueryResponse(
715 $analyzed_sql_results, // analyzed_sql_results
716 false, // is_gotofile
717 $db, // db
718 $table, // table
719 null, // find_real_end
720 null, // sql_query_for_bookmark - see below
721 null, // extra_data
722 null, // message_to_show
723 null, // message
724 null, // sql_data
725 $goto, // goto
726 $pmaThemeImage, // pmaThemeImage
727 null, // disp_query
728 null, // disp_message
729 null, // query_type
730 $sql_query, // sql_query
731 null, // selectedTables
732 null // complete_query
736 // sql_query_for_bookmark is not included in PMA_executeQueryAndGetQueryResponse
737 // since only one bookmark has to be added for all the queries submitted through
738 // the SQL tab
739 if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
740 $cfgBookmark = Bookmark::getParams();
741 PMA_storeTheQueryAsBookmark(
742 $db, $cfgBookmark['user'],
743 $_REQUEST['sql_query'], $_POST['bkm_label'],
744 isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
748 $response->addJSON('ajax_reload', $ajax_reload);
749 $response->addHTML($html_output);
750 exit();
752 } else if ($result) {
753 // Save a Bookmark with more than one queries (if Bookmark label given).
754 if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
755 $cfgBookmark = Bookmark::getParams();
756 PMA_storeTheQueryAsBookmark(
757 $db, $cfgBookmark['user'],
758 $_REQUEST['sql_query'], $_POST['bkm_label'],
759 isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
763 $response->setRequestStatus(true);
764 $response->addJSON('message', PMA\libraries\Message::success($msg));
765 $response->addJSON(
766 'sql_query',
767 PMA\libraries\Util::getMessage($msg, $sql_query, 'success')
769 } else if ($result == false) {
770 $response->setRequestStatus(false);
771 $response->addJSON('message', PMA\libraries\Message::error($msg));
772 } else {
773 $active_page = $goto;
774 include '' . $goto;
777 // If there is request for ROLLBACK in the end.
778 if (isset($_REQUEST['rollback_query'])) {
779 $GLOBALS['dbi']->query('ROLLBACK');