I have refactored some parts of the tbl_change.php using extract method in this pull request.
the variable is never used.
unused code segment
new variable used only once. So removed
added method PMA_getTableFields
unwanted require_once statement removed
added method PMA_determineInsertOrEdit
transfered to PMA_determineInsertOrEdit
added method PMA_getCommentsMap
can be done in a single place
added method PMA_getUrlParameters
can be done only once
updated the comment.
phpcs errors corrected
I'm not sure that this is not used. There are some libraries that are using global $analyzed_sql (which is not a good idea but it's the current state of the code base).
But for the moment the tests are fine so it might be acceptable to remove it,
If the UploadDir directive is defined in config.inc.php, and your table contains a BLOB column, this library is used to list the files present in the upload directory, to be able to upload one of them inside the BLOB.
You explained only $disp_message and lost the $disp_query question.
the $disp_query is not used in the bellow code. So I thought it is not required to mention about it here.
added back mistakenly removed require_once statement.
Supun, I found a bug: