Hello,
I was trying to implement some ideas of mine related to the export plugin, and I have a small question.
I saw that export.php uses a function called PMA_getPlugins (from libraries/plugin_interface.lib.php) to get the export list with all of the plugins. That function includes all the files in the libraries/export folder, which in turn define the options and functions for each of the plugins. After the user chooses a format and submits, one of the exports is selected and used.
I was wondering if there is any reason for using that $plugin_list ( in this case $export_list ) or if that variable is actually needed somewhere else except the export.php and libraries/display_export.lib.php, where it displays the list of export plugins. Because if not, I was thinking that the export list could be replaced with a single element which will be an instance of one of the export classes.
This way, all the other export plugins don't need to be included, and only one export class will be instantiated and its output functions will be used. I tested this scenario and it works, but I don't know if I may cause something else to malfunction in some part. Would you have any objections for such a replacement?
Thanks, Alex
Le 2012-02-22 10:09, Alex UKF a écrit :
Hello,
I was trying to implement some ideas of mine related to the export plugin, and I have a small question.
I saw that export.php uses a function called PMA_getPlugins (from libraries/plugin_interface.lib.php) to get the export list with all of the plugins. That function includes all the files in the libraries/export folder, which in turn define the options and functions for each of the plugins. After the user chooses a format and submits, one of the exports is selected and used.
I was wondering if there is any reason for using that $plugin_list ( in this case $export_list ) or if that variable is actually needed somewhere else except the export.php and libraries/display_export.lib.php, where it displays the list of export plugins. Because if not, I was thinking that the export list could be replaced with a single element which will be an instance of one of the export classes.
This way, all the other export plugins don't need to be included, and only one export class will be instantiated and its output functions will be used. I tested this scenario and it works, but I don't know if I may cause something else to malfunction in some part. Would you have any objections for such a replacement?
Thanks, Alex
Alex,
$export_list is used only in export.php and libraries/display_export.lib.php, so your idea looks good.
However, beware that someone could have placed a custom script under libraries/export and would expect his custom export format to be shown.
Hi
Dne Wed, 22 Feb 2012 17:09:26 +0200 Alex UKF alex.ukf@gmail.com napsal(a):
This way, all the other export plugins don't need to be included, and only one export class will be instantiated and its output functions will be used. I tested this scenario and it works, but I don't know if I may cause something else to malfunction in some part. Would you have any objections for such a replacement?
It sounds reasonable, just double check if some of standard plugins does not rely on other options being set (eg. CSV/CSV for Excel, which share code).