Translated using Weblate (Portuguese)
[phpmyadmin.git] / import_status.php
blobf2e661ce24d51626fa76bc56fe3ab03b4ef656e6
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
5 * @package PhpMyAdmin
6 */
8 /* PHP 5.4 stores upload progress data only in the default session.
9 * After calling session_name(), we won't find the progress data anymore.
11 * https://bugs.php.net/bug.php?id=64075
13 * The bug should be somewhere in
14 * https://github.com/php/php-src/blob/master/ext/session/session.c#L2342
16 * Until this is fixed, we need to load the default session to load the data,
17 * export the upload progress information from there,
18 * and re-import after switching to our session.
21 if (version_compare(PHP_VERSION, '5.4.0', '>=')
22 && ini_get('session.upload_progress.enabled')
23 ) {
25 $sessionupload = array();
26 define('UPLOAD_PREFIX', ini_get('session.upload_progress.prefix'));
28 session_start();
29 foreach ($_SESSION as $key => $value) {
30 // only copy session-prefixed data
31 if (substr($key, 0, strlen(UPLOAD_PREFIX)) == UPLOAD_PREFIX) {
32 $sessionupload[$key] = $value;
35 // PMA will kill all variables, so let's use a constant
36 define('SESSIONUPLOAD', serialize($sessionupload));
37 session_write_close();
39 session_name('phpMyAdmin');
40 session_id($_COOKIE['phpMyAdmin']);
43 define('PMA_MINIMUM_COMMON', 1);
45 require_once 'libraries/common.inc.php';
46 require_once 'libraries/display_import_ajax.lib.php';
48 if (defined('SESSIONUPLOAD')) {
49 // write sessionupload back into the loaded PMA session
51 $sessionupload = unserialize(SESSIONUPLOAD);
52 foreach ($sessionupload as $key => $value) {
53 $_SESSION[$key] = $value;
56 // remove session upload data that are not set anymore
57 foreach ($_SESSION as $key => $value) {
58 if (substr($key, 0, strlen(UPLOAD_PREFIX)) == UPLOAD_PREFIX
59 && ! isset($sessionupload[$key])
60 ) {
61 unset($_SESSION[$key]);
66 // AJAX requests can't be cached!
67 PMA_noCacheHeader();
69 // $_GET["message"] is used for asking for an import message
70 if (isset($_GET["message"]) && $_GET["message"]) {
72 header('Content-type: text/html');
74 // wait 0.3 sec before we check for $_SESSION variable,
75 // which is set inside import.php
76 usleep(300000);
78 // wait until message is available
79 while ($_SESSION['Import_message']['message'] == null) {
80 usleep(250000); // 0.25 sec
83 echo $_SESSION['Import_message']['message'];
84 echo '<fieldset class="tblFooters">' . "\n";
85 echo ' [ <a href="' . $_SESSION['Import_message']['go_back_url']
86 . '">' . __('Back') . '</a> ]' . "\n";
87 echo '</fieldset>'."\n";
89 } else {
90 PMA_importAjaxStatus($_GET["id"]);