This week I have spent my time working on following issue:

Import/Export Progress bar

First I made changes in the phpmyadmin configuration sql table and added one extra table to track the progress status.

CREATE TABLE IF NOT EXISTS `pma__progress` (
`uuid` varchar(36) NOT NULL,
`type` varchar(64) NOT NULL,
`data` text NOT NULL,
`value` int(50) unsigned NOT NULL,
`total` int(50) unsigned NOT NULL,
UNIQUE KEY `uuid` (`uuid`)
COMMENT='Saved import/export progress data'
utf8 COLLATE utf8_bin;

Then I learnt how to insert data in phpmyadmin configuration database. Then from the mailing list I got this link to get started So finally I was able to update data in the progress table as the new table is exported.

$cfgRelation = PMA_getRelationsParam();
$sql_query = " SELECT * FROM " .
PhpMyAdmin\Util::backquote($cfgRelation['db']) . "." .
PhpMyAdmin\Util::backquote($cfgRelation['tracking']) .
" WHERE db_name = '" .
$GLOBALS['dbi']->escapeString($_REQUEST['db']) . "' " .
" AND table_name = '" .
$GLOBALS['dbi']->escapeString($_REQUEST['table']) . "' " .
" ORDER BY version DESC ";

Then I used the setInterval() to update the progress on the page.

var progressInterval = setInterval(function () {
$.post('progress.php', params, function (response) {
if (response.success === true) {
// do something

One more thing I missed mentioning below issue in my previous blog post. This was completed last week.

Double Character Encoding Issue:

removed double charset encoding

I have used phpmyadmin sql parser to do this.

use PhpMyAdmin\SqlParser\Parser;
use PhpMyAdmin\SqlParser\Utils\Query;

$query = 'SET NAMES latin1';
$parser = new Parser($query);
$flags = Query::getFlags($parser->statements[0]);

echo $flags['querytype'];

Next Steps

This was my eighth week progress. I will post an update for this week soon.

This was originally posted on my medium account.

No comments:

Post a Comment