Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
3d6c0f6cf8
@ -15,6 +15,7 @@ phpMyAdmin - ChangeLog
|
||||
+ Patch #3510656 Contest-1: Ignoring foreign keys while dropping tables
|
||||
- Bug #3509686 Reverting sort on joined column does not work
|
||||
+ New transformation: append string
|
||||
+ rfe #3507804 Session upload progress (PHP 5.4)
|
||||
|
||||
3.5.1.0 (not yet released)
|
||||
- bug #3510784 [edit] Limit clause ignored when sort order is remembered
|
||||
|
||||
@ -27,6 +27,7 @@ $upload_id = uniqid("");
|
||||
* list of available plugins
|
||||
*/
|
||||
$plugins = array(
|
||||
"session",
|
||||
"uploadprogress",
|
||||
"apc",
|
||||
"noplugin"
|
||||
@ -68,6 +69,20 @@ function PMA_import_uploadprogressCheck()
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if PHP 5.4 session upload-progress feature is available.
|
||||
*
|
||||
* @return true if PHP 5.4 session upload-progress is available, false if it is not
|
||||
*/
|
||||
function PMA_import_sessionCheck()
|
||||
{
|
||||
if (PMA_PHP_INT_VERSION < 50400 || ! ini_get('session.upload_progress.enabled')) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Default plugin for handling import. If no other plugin is available, noplugin is used.
|
||||
*
|
||||
|
||||
76
libraries/import/upload/session.php
Normal file
76
libraries/import/upload/session.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/* vim: set expandtab sw=4 ts=4 sts=4: */
|
||||
/**
|
||||
*
|
||||
* @package PhpMyAdmin
|
||||
*/
|
||||
if (! defined('PHPMYADMIN')) {
|
||||
exit;
|
||||
}
|
||||
|
||||
$ID_KEY = ini_get('session.upload_progress.name');
|
||||
|
||||
/**
|
||||
* Returns upload status.
|
||||
*
|
||||
* This is implementation for session.upload_progress in PHP 5.4+.
|
||||
*
|
||||
* @param string $id
|
||||
* @return array|null
|
||||
*/
|
||||
function PMA_getUploadStatus($id)
|
||||
{
|
||||
global $SESSION_KEY;
|
||||
global $ID_KEY;
|
||||
|
||||
if (trim($id) == '') {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (! array_key_exists($id, $_SESSION[$SESSION_KEY])) {
|
||||
$_SESSION[$SESSION_KEY][$id] = array(
|
||||
'id' => $id,
|
||||
'finished' => false,
|
||||
'percent' => 0,
|
||||
'total' => 0,
|
||||
'complete' => 0,
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
}
|
||||
$ret = $_SESSION[$SESSION_KEY][$id];
|
||||
|
||||
if (! PMA_import_sessionCheck() || $ret['finished']) {
|
||||
return $ret;
|
||||
}
|
||||
|
||||
$status = false;
|
||||
$sessionkey = ini_get('session.upload_progress.prefix') . $id;
|
||||
|
||||
if (isset($_SESSION[$sessionkey])) {
|
||||
$status = $_SESSION[$sessionkey];
|
||||
}
|
||||
|
||||
if ($status) {
|
||||
$ret['finished'] = $status['done'];
|
||||
$ret['total'] = $status['content_length'];
|
||||
$ret['complete'] = $status['bytes_processed'];
|
||||
|
||||
if ($ret['total'] > 0) {
|
||||
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
|
||||
}
|
||||
} else {
|
||||
$ret = array(
|
||||
'id' => $id,
|
||||
'finished' => true,
|
||||
'percent' => 100,
|
||||
'total' => $ret['total'],
|
||||
'complete' => $ret['total'],
|
||||
'plugin' => $ID_KEY
|
||||
);
|
||||
}
|
||||
|
||||
$_SESSION[$SESSION_KEY][$id] = $ret;
|
||||
|
||||
return $ret;
|
||||
}
|
||||
?>
|
||||
Loading…
Reference in New Issue
Block a user