diff --git a/import_status.php b/import_status.php index db30584a75..7a21913a4a 100644 --- a/import_status.php +++ b/import_status.php @@ -52,6 +52,11 @@ define('PMA_MINIMUM_COMMON', 1); require_once 'libraries/common.inc.php'; require_once 'libraries/display_import_ajax.lib.php'; +list( + $SESSION_KEY, + $upload_id, + $plugins +) = PMA_uploadProgressSetup(); /* if (defined('SESSIONUPLOAD')) { diff --git a/libraries/display_import.lib.php b/libraries/display_import.lib.php index 862484ff97..317568965f 100644 --- a/libraries/display_import.lib.php +++ b/libraries/display_import.lib.php @@ -642,8 +642,13 @@ function PMA_getImportDisplay($import_type, $db, $table, $max_upload_size) global $SESSION_KEY; include_once './libraries/file_listing.lib.php'; include_once './libraries/plugin_interface.lib.php'; - // this one generates also some globals + include_once './libraries/display_import_ajax.lib.php'; + list( + $SESSION_KEY, + $upload_id, + $plugins + ) = PMA_uploadProgressSetup(); /* Scan for plugins */ /* @var $import_list ImportPlugin[] */ diff --git a/libraries/display_import_ajax.lib.php b/libraries/display_import_ajax.lib.php index ac1deb4108..760fcc4c99 100644 --- a/libraries/display_import_ajax.lib.php +++ b/libraries/display_import_ajax.lib.php @@ -10,45 +10,55 @@ if (! defined('PHPMYADMIN')) { } /** - * constant for differentiating array in $_SESSION variable - */ -$SESSION_KEY = '__upload_status'; + * Sets up some variables for upload progress + * + * @return array() + * + */ +function PMA_uploadProgressSetup() +{ + /** + * constant for differentiating array in $_SESSION variable + */ + $SESSION_KEY = '__upload_status'; -/** - * sets default plugin for handling the import process - */ -$_SESSION[$SESSION_KEY]["handler"] = ""; + /** + * sets default plugin for handling the import process + */ + $_SESSION[$SESSION_KEY]["handler"] = ""; -/** - * unique ID for each upload - */ -$upload_id = uniqid(""); + /** + * unique ID for each upload + */ + $upload_id = uniqid(""); -/** - * list of available plugins - * - * Each plugin has own checkfunction in display_import_ajax.lib.php - * and own file with functions in upload_#KEY#.php - */ -$plugins = array( - // PHP 5.4 session-based upload progress is problematic, see bug 3964 - //"session", - "progress", - "apc", - "noplugin" -); + /** + * list of available plugins + * + * Each plugin has own checkfunction in display_import_ajax.lib.php + * and own file with functions in upload_#KEY#.php + */ + $plugins = array( + // PHP 5.4 session-based upload progress is problematic, see bug 3964 + //"session", + "progress", + "apc", + "noplugin" + ); -// select available plugin -foreach ($plugins as $plugin) { - $check = "PMA_Import_" . $plugin . "Check"; + // select available plugin + foreach ($plugins as $plugin) { + $check = "PMA_Import_" . $plugin . "Check"; - if ($check()) { - $upload_class = 'PMA\libraries\plugins\import\upload\Upload' . ucwords( - $plugin - ); - $_SESSION[$SESSION_KEY]["handler"] = $upload_class; - break; + if ($check()) { + $upload_class = 'PMA\libraries\plugins\import\upload\Upload' . ucwords( + $plugin + ); + $_SESSION[$SESSION_KEY]["handler"] = $upload_class; + break; + } } + return array($SESSION_KEY, $upload_id, $plugins); } /**