Translated using Weblate (Interlingua)
[phpmyadmin.git] / import.php
blobd5433df99ea482d79ee6b3f1185403796514c54e
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 use PhpMyAdmin\Bookmark;
10 use PhpMyAdmin\Core;
11 use PhpMyAdmin\Encoding;
12 use PhpMyAdmin\File;
13 use PhpMyAdmin\Import;
14 use PhpMyAdmin\ParseAnalyze;
15 use PhpMyAdmin\Plugins;
16 use PhpMyAdmin\Plugins\ImportPlugin;
17 use PhpMyAdmin\Response;
18 use PhpMyAdmin\Sql;
19 use PhpMyAdmin\Url;
20 use PhpMyAdmin\Util;
22 /* Enable LOAD DATA LOCAL INFILE for LDI plugin */
23 if (isset($_POST['format']) && $_POST['format'] == 'ldi') {
24 define('PMA_ENABLE_LDI', 1);
27 /**
28 * Get the variables sent or posted to this script and a core script
30 require_once 'libraries/common.inc.php';
32 if (isset($_REQUEST['show_as_php'])) {
33 $GLOBALS['show_as_php'] = $_REQUEST['show_as_php'];
36 // If there is a request to 'Simulate DML'.
37 if (isset($_REQUEST['simulate_dml'])) {
38 Import::handleSimulateDmlRequest();
39 exit;
42 $response = Response::getInstance();
44 // If it's a refresh console bookmarks request
45 if (isset($_REQUEST['console_bookmark_refresh'])) {
46 $response->addJSON(
47 'console_message_bookmark', PhpMyAdmin\Console::getBookmarkContent()
49 exit;
51 // If it's a console bookmark add request
52 if (isset($_REQUEST['console_bookmark_add'])) {
53 if (isset($_REQUEST['label']) && isset($_REQUEST['db'])
54 && isset($_REQUEST['bookmark_query']) && isset($_REQUEST['shared'])
55 ) {
56 $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']);
57 $bookmarkFields = array(
58 'bkm_database' => $_REQUEST['db'],
59 'bkm_user' => $cfgBookmark['user'],
60 'bkm_sql_query' => $_REQUEST['bookmark_query'],
61 'bkm_label' => $_REQUEST['label']
63 $isShared = ($_REQUEST['shared'] == 'true' ? true : false);
64 $bookmark = Bookmark::createBookmark(
65 $GLOBALS['dbi'],
66 $GLOBALS['cfg']['Server']['user'],
67 $bookmarkFields,
68 $isShared
70 if ($bookmark !== false && $bookmark->save()) {
71 $response->addJSON('message', __('Succeeded'));
72 $response->addJSON('data', $bookmarkFields);
73 $response->addJSON('isShared', $isShared);
74 } else {
75 $response->addJSON('message', __('Failed'));
77 die();
78 } else {
79 $response->addJSON('message', __('Incomplete params'));
80 die();
84 $format = '';
86 /**
87 * Sets globals from $_POST
89 $post_params = array(
90 'charset_of_file',
91 'format',
92 'import_type',
93 'is_js_confirmed',
94 'MAX_FILE_SIZE',
95 'message_to_show',
96 'noplugin',
97 'skip_queries',
98 'local_import_file'
101 foreach ($post_params as $one_post_param) {
102 if (isset($_POST[$one_post_param])) {
103 $GLOBALS[$one_post_param] = $_POST[$one_post_param];
107 // reset import messages for ajax request
108 $_SESSION['Import_message']['message'] = null;
109 $_SESSION['Import_message']['go_back_url'] = null;
110 // default values
111 $GLOBALS['reload'] = false;
113 // Use to identify current cycle is executing
114 // a multiquery statement or stored routine
115 if (!isset($_SESSION['is_multi_query'])) {
116 $_SESSION['is_multi_query'] = false;
119 $ajax_reload = array();
120 // Are we just executing plain query or sql file?
121 // (eg. non import, but query box/window run)
122 if (! empty($sql_query)) {
124 // apply values for parameters
125 if (! empty($_REQUEST['parameterized'])
126 && ! empty($_REQUEST['parameters'])
127 && is_array($_REQUEST['parameters'])
129 $parameters = $_REQUEST['parameters'];
130 foreach ($parameters as $parameter => $replacement) {
131 $quoted = preg_quote($parameter, '/');
132 // making sure that :param does not apply values to :param1
133 $sql_query = preg_replace(
134 '/' . $quoted . '([^a-zA-Z0-9_])/',
135 $GLOBALS['dbi']->escapeString($replacement) . '${1}',
136 $sql_query
138 // for parameters the appear at the end of the string
139 $sql_query = preg_replace(
140 '/' . $quoted . '$/',
141 $GLOBALS['dbi']->escapeString($replacement),
142 $sql_query
147 // run SQL query
148 $import_text = $sql_query;
149 $import_type = 'query';
150 $format = 'sql';
151 $_SESSION['sql_from_query_box'] = true;
153 // If there is a request to ROLLBACK when finished.
154 if (isset($_REQUEST['rollback_query'])) {
155 Import::handleRollbackRequest($import_text);
158 // refresh navigation and main panels
159 if (preg_match('/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i', $sql_query)) {
160 $GLOBALS['reload'] = true;
161 $ajax_reload['reload'] = true;
164 // refresh navigation panel only
165 if (preg_match(
166 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
167 $sql_query
168 )) {
169 $ajax_reload['reload'] = true;
172 // do a dynamic reload if table is RENAMED
173 // (by sending the instruction to the AJAX response handler)
174 if (preg_match(
175 '/^RENAME\s+TABLE\s+(.*?)\s+TO\s+(.*?)($|;|\s)/i',
176 $sql_query,
177 $rename_table_names
178 )) {
179 $ajax_reload['reload'] = true;
180 $ajax_reload['table_name'] = PhpMyAdmin\Util::unQuote(
181 $rename_table_names[2]
185 $sql_query = '';
186 } elseif (! empty($sql_file)) {
187 // run uploaded SQL file
188 $import_file = $sql_file;
189 $import_type = 'queryfile';
190 $format = 'sql';
191 unset($sql_file);
192 } elseif (! empty($_REQUEST['id_bookmark'])) {
193 // run bookmark
194 $import_type = 'query';
195 $format = 'sql';
198 // If we didn't get any parameters, either user called this directly, or
199 // upload limit has been reached, let's assume the second possibility.
200 if ($_POST == array() && $_GET == array()) {
201 $message = PhpMyAdmin\Message::error(
203 'You probably tried to upload a file that is too large. Please refer ' .
204 'to %sdocumentation%s for a workaround for this limit.'
207 $message->addParam('[doc@faq1-16]');
208 $message->addParam('[/doc]');
210 // so we can obtain the message
211 $_SESSION['Import_message']['message'] = $message->getDisplay();
212 $_SESSION['Import_message']['go_back_url'] = $GLOBALS['goto'];
214 $response->setRequestStatus(false);
215 $response->addJSON('message', $message);
217 exit; // the footer is displayed automatically
220 // Add console message id to response output
221 if (isset($_POST['console_message_id'])) {
222 $response->addJSON('console_message_id', $_POST['console_message_id']);
226 * Sets globals from $_POST patterns, for import plugins
227 * We only need to load the selected plugin
230 if (! in_array(
231 $format,
232 array(
233 'csv',
234 'ldi',
235 'mediawiki',
236 'ods',
237 'shp',
238 'sql',
239 'xml'
243 // this should not happen for a normal user
244 // but only during an attack
245 Core::fatalError('Incorrect format parameter');
248 $post_patterns = array(
249 '/^force_file_/',
250 '/^' . $format . '_/'
253 Core::setPostAsGlobal($post_patterns);
255 // Check needed parameters
256 PhpMyAdmin\Util::checkParameters(array('import_type', 'format'));
258 // We don't want anything special in format
259 $format = Core::securePath($format);
261 if (strlen($table) > 0 && strlen($db) > 0) {
262 $urlparams = array('db' => $db, 'table' => $table);
263 } elseif (strlen($db) > 0) {
264 $urlparams = array('db' => $db);
265 } else {
266 $urlparams = array();
269 // Create error and goto url
270 if ($import_type == 'table') {
271 $goto = 'tbl_import.php';
272 } elseif ($import_type == 'database') {
273 $goto = 'db_import.php';
274 } elseif ($import_type == 'server') {
275 $goto = 'server_import.php';
276 } else {
277 if (empty($goto) || !preg_match('@^(server|db|tbl)(_[a-z]*)*\.php$@i', $goto)) {
278 if (strlen($table) > 0 && strlen($db) > 0) {
279 $goto = 'tbl_structure.php';
280 } elseif (strlen($db) > 0) {
281 $goto = 'db_structure.php';
282 } else {
283 $goto = 'server_sql.php';
287 $err_url = $goto . Url::getCommon($urlparams);
288 $_SESSION['Import_message']['go_back_url'] = $err_url;
289 // Avoid setting selflink to 'import.php'
290 // problem similar to bug 4276
291 if (basename($_SERVER['SCRIPT_NAME']) === 'import.php') {
292 $_SERVER['SCRIPT_NAME'] = $goto;
296 if (strlen($db) > 0) {
297 $GLOBALS['dbi']->selectDb($db);
300 Util::setTimeLimit();
301 if (! empty($cfg['MemoryLimit'])) {
302 @ini_set('memory_limit', $cfg['MemoryLimit']);
305 $timestamp = time();
306 if (isset($_REQUEST['allow_interrupt'])) {
307 $maximum_time = ini_get('max_execution_time');
308 } else {
309 $maximum_time = 0;
312 // set default values
313 $timeout_passed = false;
314 $error = false;
315 $read_multiply = 1;
316 $finished = false;
317 $offset = 0;
318 $max_sql_len = 0;
319 $file_to_unlink = '';
320 $sql_query = '';
321 $sql_query_disabled = false;
322 $go_sql = false;
323 $executed_queries = 0;
324 $run_query = true;
325 $charset_conversion = false;
326 $reset_charset = false;
327 $bookmark_created = false;
328 $result = false;
329 $msg = 'Sorry an unexpected error happened!';
331 // Bookmark Support: get a query back from bookmark if required
332 if (! empty($_REQUEST['id_bookmark'])) {
333 $id_bookmark = (int)$_REQUEST['id_bookmark'];
334 switch ($_REQUEST['action_bookmark']) {
335 case 0: // bookmarked query that have to be run
336 $bookmark = Bookmark::get(
337 $GLOBALS['dbi'],
338 $GLOBALS['cfg']['Server']['user'],
339 $db,
340 $id_bookmark,
341 'id',
342 isset($_REQUEST['action_bookmark_all'])
345 if (! empty($_REQUEST['bookmark_variable'])) {
346 $import_text = $bookmark->applyVariables(
347 $_REQUEST['bookmark_variable']
349 } else {
350 $import_text = $bookmark->getQuery();
353 // refresh navigation and main panels
354 if (preg_match(
355 '/^(DROP)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
356 $import_text
357 )) {
358 $GLOBALS['reload'] = true;
359 $ajax_reload['reload'] = true;
362 // refresh navigation panel only
363 if (preg_match(
364 '/^(CREATE|ALTER)\s+(VIEW|TABLE|DATABASE|SCHEMA)\s+/i',
365 $import_text
368 $ajax_reload['reload'] = true;
370 break;
371 case 1: // bookmarked query that have to be displayed
372 $bookmark = Bookmark::get(
373 $GLOBALS['dbi'],
374 $GLOBALS['cfg']['Server']['user'],
375 $db,
376 $id_bookmark
378 $import_text = $bookmark->getQuery();
379 if ($response->isAjax()) {
380 $message = PhpMyAdmin\Message::success(__('Showing bookmark'));
381 $response->setRequestStatus($message->isSuccess());
382 $response->addJSON('message', $message);
383 $response->addJSON('sql_query', $import_text);
384 $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']);
385 exit;
386 } else {
387 $run_query = false;
389 break;
390 case 2: // bookmarked query that have to be deleted
391 $bookmark = Bookmark::get(
392 $GLOBALS['dbi'],
393 $GLOBALS['cfg']['Server']['user'],
394 $db,
395 $id_bookmark
397 if (! empty($bookmark)) {
398 $bookmark->delete();
399 if ($response->isAjax()) {
400 $message = PhpMyAdmin\Message::success(
401 __('The bookmark has been deleted.')
403 $response->setRequestStatus($message->isSuccess());
404 $response->addJSON('message', $message);
405 $response->addJSON('action_bookmark', $_REQUEST['action_bookmark']);
406 $response->addJSON('id_bookmark', $id_bookmark);
407 exit;
408 } else {
409 $run_query = false;
410 $error = true; // this is kind of hack to skip processing the query
414 break;
416 } // end bookmarks reading
418 // Do no run query if we show PHP code
419 if (isset($GLOBALS['show_as_php'])) {
420 $run_query = false;
421 $go_sql = true;
424 // We can not read all at once, otherwise we can run out of memory
425 $memory_limit = trim(@ini_get('memory_limit'));
426 // 2 MB as default
427 if (empty($memory_limit)) {
428 $memory_limit = 2 * 1024 * 1024;
430 // In case no memory limit we work on 10MB chunks
431 if ($memory_limit == -1) {
432 $memory_limit = 10 * 1024 * 1024;
435 // Calculate value of the limit
436 $memoryUnit = mb_strtolower(substr($memory_limit, -1));
437 if ('m' == $memoryUnit) {
438 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024;
439 } elseif ('k' == $memoryUnit) {
440 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024;
441 } elseif ('g' == $memoryUnit) {
442 $memory_limit = (int)substr($memory_limit, 0, -1) * 1024 * 1024 * 1024;
443 } else {
444 $memory_limit = (int)$memory_limit;
447 // Just to be sure, there might be lot of memory needed for uncompression
448 $read_limit = $memory_limit / 8;
450 // handle filenames
451 if (isset($_FILES['import_file'])) {
452 $import_file = $_FILES['import_file']['tmp_name'];
454 if (! empty($local_import_file) && ! empty($cfg['UploadDir'])) {
456 // sanitize $local_import_file as it comes from a POST
457 $local_import_file = Core::securePath($local_import_file);
459 $import_file = PhpMyAdmin\Util::userDir($cfg['UploadDir'])
460 . $local_import_file;
463 * Do not allow symlinks to avoid security issues
464 * (user can create symlink to file he can not access,
465 * but phpMyAdmin can).
467 if (@is_link($import_file)) {
468 $import_file = 'none';
471 } elseif (empty($import_file) || ! is_uploaded_file($import_file)) {
472 $import_file = 'none';
475 // Do we have file to import?
477 if ($import_file != 'none' && ! $error) {
479 * Handle file compression
481 $import_handle = new File($import_file);
482 $import_handle->checkUploadedFile();
483 if ($import_handle->isError()) {
484 Import::stop($import_handle->getError());
486 $import_handle->setDecompressContent(true);
487 $import_handle->open();
488 if ($import_handle->isError()) {
489 Import::stop($import_handle->getError());
491 } elseif (! $error) {
492 if (! isset($import_text) || empty($import_text)) {
493 $message = PhpMyAdmin\Message::error(
495 'No data was received to import. Either no file name was ' .
496 'submitted, or the file size exceeded the maximum size permitted ' .
497 'by your PHP configuration. See [doc@faq1-16]FAQ 1.16[/doc].'
500 Import::stop($message);
504 // so we can obtain the message
505 //$_SESSION['Import_message'] = $message->getDisplay();
507 // Convert the file's charset if necessary
508 if (Encoding::isSupported() && isset($charset_of_file)) {
509 if ($charset_of_file != 'utf-8') {
510 $charset_conversion = true;
512 } elseif (isset($charset_of_file) && $charset_of_file != 'utf-8') {
513 $GLOBALS['dbi']->query('SET NAMES \'' . $charset_of_file . '\'');
514 // We can not show query in this case, it is in different charset
515 $sql_query_disabled = true;
516 $reset_charset = true;
519 // Something to skip? (because timeout has passed)
520 if (! $error && isset($_POST['skip'])) {
521 $original_skip = $skip = intval($_POST['skip']);
522 while ($skip > 0 && ! $finished) {
523 Import::getNextChunk($skip < $read_limit ? $skip : $read_limit);
524 // Disable read progressivity, otherwise we eat all memory!
525 $read_multiply = 1;
526 $skip -= $read_limit;
528 unset($skip);
531 // This array contain the data like numberof valid sql queries in the statement
532 // and complete valid sql statement (which affected for rows)
533 $sql_data = array('valid_sql' => array(), 'valid_queries' => 0);
535 if (! $error) {
536 /* @var $import_plugin ImportPlugin */
537 $import_plugin = Plugins::getPlugin(
538 "import",
539 $format,
540 'libraries/classes/Plugins/Import/',
541 $import_type
543 if ($import_plugin == null) {
544 $message = PhpMyAdmin\Message::error(
545 __('Could not load import plugins, please check your installation!')
547 Import::stop($message);
548 } else {
549 // Do the real import
550 try {
551 $default_fk_check = PhpMyAdmin\Util::handleDisableFKCheckInit();
552 $import_plugin->doImport($sql_data);
553 PhpMyAdmin\Util::handleDisableFKCheckCleanup($default_fk_check);
554 } catch (Exception $e) {
555 PhpMyAdmin\Util::handleDisableFKCheckCleanup($default_fk_check);
556 throw $e;
561 if (isset($import_handle)) {
562 $import_handle->close();
565 // Cleanup temporary file
566 if ($file_to_unlink != '') {
567 unlink($file_to_unlink);
570 // Reset charset back, if we did some changes
571 if ($reset_charset) {
572 $GLOBALS['dbi']->query('SET CHARACTER SET utf8');
573 $GLOBALS['dbi']->query(
574 'SET SESSION collation_connection =\'' . $collation_connection . '\''
578 // Show correct message
579 if (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 2) {
580 $message = PhpMyAdmin\Message::success(__('The bookmark has been deleted.'));
581 $display_query = $import_text;
582 $error = false; // unset error marker, it was used just to skip processing
583 } elseif (! empty($id_bookmark) && $_REQUEST['action_bookmark'] == 1) {
584 $message = PhpMyAdmin\Message::notice(__('Showing bookmark'));
585 } elseif ($bookmark_created) {
586 $special_message = '[br]' . sprintf(
587 __('Bookmark %s has been created.'),
588 htmlspecialchars($_POST['bkm_label'])
590 } elseif ($finished && ! $error) {
591 // Do not display the query with message, we do it separately
592 $display_query = ';';
593 if ($import_type != 'query') {
594 $message = PhpMyAdmin\Message::success(
595 '<em>'
596 . _ngettext(
597 'Import has been successfully finished, %d query executed.',
598 'Import has been successfully finished, %d queries executed.',
599 $executed_queries
601 . '</em>'
603 $message->addParam($executed_queries);
605 if (! empty($import_notice)) {
606 $message->addHtml($import_notice);
608 if (! empty($local_import_file)) {
609 $message->addText('(' . $local_import_file . ')');
610 } else {
611 $message->addText('(' . $_FILES['import_file']['name'] . ')');
616 // Did we hit timeout? Tell it user.
617 if ($timeout_passed) {
618 $urlparams['timeout_passed'] = '1';
619 $urlparams['offset'] = $GLOBALS['offset'];
620 if (isset($local_import_file)) {
621 $urlparams['local_import_file'] = $local_import_file;
624 $importUrl = $err_url = $goto . Url::getCommon($urlparams);
626 $message = PhpMyAdmin\Message::error(
628 'Script timeout passed, if you want to finish import,'
629 . ' please %sresubmit the same file%s and import will resume.'
632 $message->addParamHtml('<a href="' . $importUrl . '">');
633 $message->addParamHtml('</a>');
635 if ($offset == 0 || (isset($original_skip) && $original_skip == $offset)) {
636 $message->addText(
638 'However on last run no data has been parsed,'
639 . ' this usually means phpMyAdmin won\'t be able to'
640 . ' finish this import unless you increase php time limits.'
646 // if there is any message, copy it into $_SESSION as well,
647 // so we can obtain it by AJAX call
648 if (isset($message)) {
649 $_SESSION['Import_message']['message'] = $message->getDisplay();
651 // Parse and analyze the query, for correct db and table name
652 // in case of a query typed in the query window
653 // (but if the query is too large, in case of an imported file, the parser
654 // can choke on it so avoid parsing)
655 $sqlLength = mb_strlen($sql_query);
656 if ($sqlLength <= $GLOBALS['cfg']['MaxCharactersInDisplayedSQL']) {
657 list(
658 $analyzed_sql_results,
659 $db,
660 $table_from_sql
661 ) = ParseAnalyze::sqlQuery($sql_query, $db);
662 // @todo: possibly refactor
663 extract($analyzed_sql_results);
665 if ($table != $table_from_sql && !empty($table_from_sql)) {
666 $table = $table_from_sql;
670 // There was an error?
671 if (isset($my_die)) {
672 foreach ($my_die as $key => $die) {
673 PhpMyAdmin\Util::mysqlDie(
674 $die['error'], $die['sql'], false, $err_url, $error
679 if ($go_sql) {
681 if (! empty($sql_data) && ($sql_data['valid_queries'] > 1)) {
682 $_SESSION['is_multi_query'] = true;
683 $sql_queries = $sql_data['valid_sql'];
684 } else {
685 $sql_queries = array($sql_query);
688 $html_output = '';
690 foreach ($sql_queries as $sql_query) {
692 // parse sql query
693 list(
694 $analyzed_sql_results,
695 $db,
696 $table_from_sql
697 ) = ParseAnalyze::sqlQuery($sql_query, $db);
698 // @todo: possibly refactor
699 extract($analyzed_sql_results);
701 // Check if User is allowed to issue a 'DROP DATABASE' Statement
702 if (Sql::hasNoRightsToDropDatabase(
703 $analyzed_sql_results, $cfg['AllowUserDropDatabase'], $GLOBALS['dbi']->isSuperuser()
704 )) {
705 PhpMyAdmin\Util::mysqlDie(
706 __('"DROP DATABASE" statements are disabled.'),
708 false,
709 $_SESSION['Import_message']['go_back_url']
711 return;
712 } // end if
714 if ($table != $table_from_sql && !empty($table_from_sql)) {
715 $table = $table_from_sql;
718 $html_output .= Sql::executeQueryAndGetQueryResponse(
719 $analyzed_sql_results, // analyzed_sql_results
720 false, // is_gotofile
721 $db, // db
722 $table, // table
723 null, // find_real_end
724 null, // sql_query_for_bookmark - see below
725 null, // extra_data
726 null, // message_to_show
727 null, // message
728 null, // sql_data
729 $goto, // goto
730 $pmaThemeImage, // pmaThemeImage
731 null, // disp_query
732 null, // disp_message
733 null, // query_type
734 $sql_query, // sql_query
735 null, // selectedTables
736 null // complete_query
740 // sql_query_for_bookmark is not included in Sql::executeQueryAndGetQueryResponse
741 // since only one bookmark has to be added for all the queries submitted through
742 // the SQL tab
743 if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
744 $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']);
745 Sql::storeTheQueryAsBookmark(
746 $db, $cfgBookmark['user'],
747 $_REQUEST['sql_query'], $_POST['bkm_label'],
748 isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
752 $response->addJSON('ajax_reload', $ajax_reload);
753 $response->addHTML($html_output);
754 exit();
756 } else if ($result) {
757 // Save a Bookmark with more than one queries (if Bookmark label given).
758 if (! empty($_POST['bkm_label']) && ! empty($import_text)) {
759 $cfgBookmark = Bookmark::getParams($GLOBALS['cfg']['Server']['user']);
760 Sql::storeTheQueryAsBookmark(
761 $db, $cfgBookmark['user'],
762 $_REQUEST['sql_query'], $_POST['bkm_label'],
763 isset($_POST['bkm_replace']) ? $_POST['bkm_replace'] : null
767 $response->setRequestStatus(true);
768 $response->addJSON('message', PhpMyAdmin\Message::success($msg));
769 $response->addJSON(
770 'sql_query',
771 PhpMyAdmin\Util::getMessage($msg, $sql_query, 'success')
773 } else if ($result == false) {
774 $response->setRequestStatus(false);
775 $response->addJSON('message', PhpMyAdmin\Message::error($msg));
776 } else {
777 $active_page = $goto;
778 include '' . $goto;
781 // If there is request for ROLLBACK in the end.
782 if (isset($_REQUEST['rollback_query'])) {
783 $GLOBALS['dbi']->query('ROLLBACK');