#472 (ok 3.3) Import - upload progress bar feature

closed-accepted
Interface (183)
1
2010-03-07
2009-05-29
Tomas Srnka
No

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"

Discussion

  • Tomas Srnka

    Tomas Srnka - 2009-05-29

    Upload progress bar patch, supports APC and testprogress extensions

     
  • Marc Delisle

    Marc Delisle - 2009-05-30
    • assigned_to: nobody --> lem9
     
  • Marc Delisle

    Marc Delisle - 2009-05-31

    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

     
  • Tomas Srnka

    Tomas Srnka - 2009-06-29

    ajax clock - location: ./themes/original/img/

     
  • Tomas Srnka

    Tomas Srnka - 2009-06-29

    revised patch, added doc. inside code

     
  • Tomas Srnka

    Tomas Srnka - 2009-06-29

    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.

     
  • Marc Delisle

    Marc Delisle - 2009-06-30

    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?

     
  • Tomas Srnka

    Tomas Srnka - 2009-06-30

    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.

     
  • Marc Delisle

    Marc Delisle - 2009-06-30

    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.

     
  • Tomas Srnka

    Tomas Srnka - 2009-06-30

    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.

     
  • Marc Delisle

    Marc Delisle - 2009-06-30

    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.

     
  • Tomas Srnka

    Tomas Srnka - 2009-06-30

    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;

     
  • Marc Delisle

    Marc Delisle - 2009-06-30

    I confirm that this fix does the job, thanks.

     
  • Tomas Srnka

    Tomas Srnka - 2009-07-01

    v3 +apc3.1.3-dev fix, +uploadprogress fix

     
  • Marc Delisle

    Marc Delisle - 2009-07-02
    • summary: Import - upload progress bar feature --> (ok 3.3) Import - upload progress bar feature
    • status: open --> open-accepted
     
  • Marc Delisle

    Marc Delisle - 2009-07-02

    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).

     
  • Marc Delisle

    Marc Delisle - 2009-07-02
    • priority: 5 --> 1
     
  • Marc Delisle

    Marc Delisle - 2009-07-02

    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.

     
  • Marc Delisle

    Marc Delisle - 2010-03-07
    • status: open-accepted --> closed-accepted