Tracker: Patches

1 (ok 3.3) Import - upload progress bar feature - ID: 2798592
Last Update: Comment added ( lem9 )

The patch brings progress bar into import section (feature request
#1330907), if APC or uploadprogress are available on unix machines running
Apache+mod_php. If JavaScript is not available on client's side, the upload
is still working, however no extra information are displayed.

The patch was tested on:
Apache2 + mod_php + APC (works fine), server:
http://alf.intrak.sk/~t0ms/pma/
Apache2 + mod_php + uploadprogress (works fine, but more tests should be
done)
Apache2 + FastCGI + APC + ISAPI PHP (upload information can not be
obtained), server: http://dev.srnka.info/TEMP/html/phpMyAdmin-dev/
IIS7 + ISAPI PHP (upload information can not be obtained)

Username for testing servers is: "test" ; password is "testprogress"


Tomas Srnka ( tomassrnka ) - 2009-05-29 20:47

1

Open

Accepted

Marc Delisle

Interface

Finished, needs serious tests

Public


Comments ( 12 )

Date: 2009-07-02 22:21
Sender: lem9Project Admin & DonorAccepting Donations

I tried again with FF 3.5 and this time it worked; must have been an old
version of some js in my browser cache.


Date: 2009-07-02 12:15
Sender: lem9Project Admin & DonorAccepting Donations

I merged patch #4 to trunk, thanks. I did some changes:
- port themes/original changes to themes/darkblue_orange
- add messages to all languages
- remove unused $strImportUploadInfo

New problem : no progress bar appears in FF 3.5 (I just installed 3.5).


Date: 2009-06-30 17:32
Sender: lem9Project Admin & DonorAccepting Donations

I confirm that this fix does the job, thanks.


Date: 2009-06-30 16:12
Sender: tomassrnka

Ok, it seems that there is a bug in apc 3.1.3-dev. It does not return true,
if the upload is finished.

Please add following lines to ./libraries/import/upload/apc.php to line
44:

if ($ret['total'] > 0)
$ret['percent'] = $ret['complete'] / $ret['total'] * 100;
// LINE 44
// FIX FOR APC 3.1.3-dev
if ($ret['percent']==100)
$ret['finished']=(bool)true;
// END OF FIX
$_SESSION[$SESSION_KEY][$id] = $ret;




Date: 2009-06-30 15:58
Sender: lem9Project Admin & DonorAccepting Donations

I used the development version of APC, I had problems with 3.1.2. Here is
what I did:

cvs -d:pserver:cvsread@cvs.php.net:/repository login
cvs -d:pserver:cvsread@cvs.php.net:/repository checkout pecl/apc
cd pecl/apc
phpize
./configure
make
make install

It works fine on your server, indeed. Mine is a 64-bit server, maybe this
can explain the difference? Please reply to my email about my offer.


Date: 2009-06-30 15:33
Sender: tomassrnka

It works fine for me under PHP 5.2.10 + APC 3.1.2-beta (from PECL
repositary, I can't find 3.1.3-dev package).

PHPinfo - http://77.93.197.250/testphp.php
phpMyAdmin - http://77.93.197.250/phpMyAdmin-dev (test/testprogress)


Date: 2009-06-30 14:30
Sender: tomassrnka

Could you please give me access to that server? I would like to debug ajax
tools with firebug.

I'm testing it on php 5.2.6-gentoo + APC 3.0.19 and php 5.2.9-arch +
uploadprogress 1.0.0. On both servers, it works fine.


Date: 2009-06-30 11:39
Sender: lem9Project Admin & DonorAccepting Donations

Tomas,
any idea why I would not see this message in Firefox 3 nor in IE 8? I'm
running PHP 5.2.10 + APC 3.1.3-dev. Do you see the final message (error or
success)?

For me, the last message is the100% one.


Date: 2009-06-30 10:13
Sender: tomassrnka

No, user should see a message (either error message or success message).
The ajax part of the script works in 3 stages:
1. check for import info (the progress bar+percentage) or displays message
that the information is not available (checks every 1000ms)
2. once it gets 100%, the progress is hidden and instead of progress bar,
there is a message about processing uploaded file (which is done inside
invisible iframe)
3. by that time, there is another ajax call waiting for
$_SESSION['Import_message']['message'] to be set. Once
$_SESSION['Import_message']['message'] is available, it is displayed to the
user together with calling left frame refresh (PMA_reloadNavigation).

I've just found out, that if there is no plugin installed,
$_SESSION["__upload_progress"] will never get to 100%, so the
display_ajax.lib.php will never asks for
$_SESSION['Import_message']['message']. So basically, import script will be
stucked in #1. This is probably why you did not see the message. I'm
working on a fix patch.


Date: 2009-06-30 00:16
Sender: lem9Project Admin & DonorAccepting Donations

With patch 3 I did a quick test. After the import, I did not get the
"Import has been successfully finished, x queries executed", and the navi
(left) frame did not refresh with the new table name, is this intended?


Date: 2009-06-29 07:53
Sender: tomassrnka

The 3rd patch does not work properly under Safari/Chrome. The weird
behavior is caused by mootools bug, which should be fixed in next release
of mootools.


Date: 2009-05-31 13:13
Sender: lem9Project Admin & DonorAccepting Donations

Excellent, we're almost there! I tested under mod_php (apc and
uploadprogress). A few improvements are needed:

- With Firefox 3,display is OK; however with IE 7 and IE8, if I try with a
file big enough, the display stalls at 26% (importing is continuing as
confirmed with another screen) then I get the 100% message; can you
replicate this?

- $strImportUploadInfo is not used, should be removed or used

- for the other message, replace "are not available" with "is not
available"

- in Documentation.html, add the requirements for this feature

- style changes should also go to the darkblue_orange theme

- please use brackets for all the ifs, like this
if (condition) {
statements...
}

- for security, we block direct calling of the scripts that don't need it,
even on servers that do not support the .htaccess mechanism (we have a
.htaccess in libraries); this is why we use

if (! defined('PHPMYADMIN')) {
exit;
}

everywhere it's possible. So, our standard beginning of scripts is:

<?php
/* vim: set expandtab sw=4 ts=4 sts=4: */
/**
*
* @version $Id: $
* @package phpMyAdmin
*/
if (! defined('PHPMYADMIN')) {
exit;
}

thanks,
Marc


Attached Files ( 5 )

Filename Description Download
import-patch-v4.patch v3 +apc3.1.3-dev fix, +uploadprogress fix Download
import-patch-v3.patch revised patch, added doc. inside code Download
ajax_clock_small.gif ajax clock - location: ./themes/original/img/ Download
import-upload-progress-bar.patch Upload progress bar patch, supports APC and testprogress extensions Download
import-upload-progress-bar-v2.patch import_status.php added into the patch Download

Changes ( 9 )

Field Old Value Date By
priority 5 2009-07-02 22:21 lem9
summary Import - upload progress bar feature 2009-07-02 12:15 lem9
resolution_id None 2009-07-02 12:15 lem9
File Added 333075: import-patch-v4.patch 2009-07-01 12:15 tomassrnka
File Added 332752: import-patch-v3.patch 2009-06-29 07:45 tomassrnka
File Added 332750: ajax_clock_small.gif 2009-06-29 07:32 tomassrnka
assigned_to nobody 2009-05-30 11:26 lem9
File Added 328923: import-upload-progress-bar-v2.patch 2009-05-29 20:55 tomassrnka
File Added 328919: import-upload-progress-bar.patch 2009-05-29 20:47 tomassrnka