[Phpmyadmin-devel] origin of the variable $selected in sql.php

Marc Delisle marc at infomarc.info
Tue Jul 16 20:07:16 CEST 2013


Le 2013-07-16 12:17, Supun Nakandala a écrit :
> Hi devs,
> According to my research I couldn't find any place where the variable
> $selected is set which is used in sql.php. Also this variable is used to
> check indexes if indexes should be checked in sql.lib.php. I am not sure
> about what is meant by checking an index. But since $selected seems to
> be not initialized this code will never run. I would like to know your
> opinion on this issue.
>
> regards supun.

Hi Supun,

this is a very good example of the improvements I hope you'll achieve 
with this refactoring.

To run this code, do the following:
- ensure you have a table having two indexes on the same column
- open the db containing this table
- go to Structure for this db
- tick the checkbox for this table name
- in the dropdown, pick "Check table"

You'll see the "Problems with indexes of table" message. To prove that 
it's coming from sql.lib.php, make a slight change in one of the 
messages output by PMA_getHtmlForIndexesProblems().

Finding the code path that leads to this result is an interesting 
exercise that I have done, but I suggest you do it by yourself to gain 
experience with the code.

Once you understand this code path, you'll be able to remove one place 
where sql.php is included.

-- 
Marc Delisle
http://infomarc.info




More information about the Developers mailing list