acknowledgments update
[openemr.git] / phpmyadmin / import_status.php
blob9b79f3fff6581ac965585132b52ba9393456bab0
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 /**
67 * Sets globals from $_GET
69 $get_params = array(
70 'message',
71 'id'
73 foreach ($get_params as $one_get_param) {
74 if (isset($_GET[$one_get_param])) {
75 $GLOBALS[$one_get_param] = $_GET[$one_get_param];
79 // AJAX requests can't be cached!
80 PMA_noCacheHeader();
82 // $GLOBALS["message"] is used for asking for an import message
83 if (isset($GLOBALS["message"]) && $GLOBALS["message"]) {
85 header('Content-type: text/html');
87 // wait 0.3 sec before we check for $_SESSION variable,
88 // which is set inside import.php
89 usleep(300000);
91 // wait until message is available
92 while ($_SESSION['Import_message']['message'] == null) {
93 usleep(250000); // 0.25 sec
96 echo $_SESSION['Import_message']['message'];
97 echo '<fieldset class="tblFooters">' . "\n";
98 echo ' [ <a href="' . $_SESSION['Import_message']['go_back_url']
99 . '">' . __('Back') . '</a> ]' . "\n";
100 echo '</fieldset>'."\n";
102 } else {
103 PMA_importAjaxStatus($GLOBALS["id"]);