oop: fix display import plugins list bug

This commit is contained in:
Alex Marin 2012-06-19 14:53:04 +03:00
parent 0cfb03331c
commit ab436a573c
6 changed files with 38 additions and 20 deletions

View File

@ -17,8 +17,13 @@
*
* @return new plugin instance
*/
function PMA_getPlugin($plugin_type, $plugin_format, $plugins_dir, $plugin_param = false)
{
function PMA_getPlugin(
$plugin_type,
$plugin_format,
$plugins_dir,
$plugin_param = false
){
$GLOBALS['plugin_param'] = $plugin_param;
$class_name = strtoupper($plugin_type[0])
. strtolower(substr($plugin_type, 1))
. strtoupper($plugin_format[0])
@ -44,6 +49,7 @@ function PMA_getPlugin($plugin_type, $plugin_format, $plugins_dir, $plugin_param
*/
function PMA_getPlugins($plugin_type, $plugins_dir, $plugin_param)
{
$GLOBALS['plugin_param'] = $plugin_param;
/* Scan for plugins */
$plugin_list = array();
if ($handle = @opendir($plugins_dir)) {
@ -61,9 +67,12 @@ function PMA_getPlugins($plugin_type, $plugins_dir, $plugin_param)
$matches
)
) {
$GLOBALS['skip_import'] = false;
include_once $plugins_dir . $file;
$class_name = $class_type . $matches[1];
$plugin_list [] = new $class_name;
if (! $GLOBALS['skip_import']) {
$class_name = $class_type . $matches[1];
$plugin_list [] = new $class_name;
}
}
}
}

View File

@ -44,10 +44,9 @@ class ImportCsv extends ImportPlugin
*/
protected function setProperties()
{
global $plugin_param;
$this->_setAnalyze(false);
if ($plugin_param !== 'table') {
if ($GLOBALS['plugin_param'] !== 'table') {
$this->_setAnalyze(true);
}
@ -102,7 +101,7 @@ class ImportCsv extends ImportPlugin
)
);
if ($plugin_param !== 'table') {
if ($GLOBALS['plugin_param'] !== 'table') {
$this->properties['options'][] = array(
'type' => 'bool',
'name' => 'col_names',

View File

@ -13,6 +13,12 @@ if (! defined('PHPMYADMIN')) {
/* Get the import interface */
require_once "libraries/plugins/ImportPlugin.class.php";
// We need relations enabled and we work only on database
if ($GLOBALS['plugin_param'] !== 'database') {
$GLOBALS['skip_import'] = true;
return;
}
/**
* Handles the import for the DocSQL format
*
@ -43,13 +49,9 @@ class ImportDocsql extends ImportPlugin
*/
protected function setProperties()
{
global $plugin_param;
$this->_setCfgRelation(PMA_getRelationsParam());
$cfgRelation = $this->_getCfgRelation();
// We need relations enabled and we work only on database
if ($plugin_param !== 'database'
|| $GLOBALS['num_tables'] < 1
if ( $GLOBALS['num_tables'] < 1
|| ! $cfgRelation['relwork']
|| ! $cfgRelation['commwork']
) {

View File

@ -13,6 +13,12 @@ if (! defined('PHPMYADMIN')) {
/* Get the import interface */
require_once "libraries/plugins/ImportPlugin.class.php";
// We need relations enabled and we work only on database
if ($GLOBALS['plugin_param'] !== 'table') {
$GLOBALS['skip_import'] = true;
return;
}
/**
* Handles the import for the CSV format using load data
*
@ -36,11 +42,6 @@ class ImportLdi extends ImportPlugin
*/
protected function setProperties()
{
global $plugin_param;
if ($plugin_param !== 'table') {
return;
}
if ($GLOBALS['cfg']['Import']['ldi_local_option'] == 'auto') {
$GLOBALS['cfg']['Import']['ldi_local_option'] = false;

View File

@ -43,9 +43,8 @@ class ImportMediawiki extends ImportPlugin
*/
protected function setProperties()
{
global $plugin_param;
$this->_setAnalyze(false);
if ($plugin_param !== 'table') {
if ($GLOBALS['plugin_param'] !== 'table') {
$this->_setAnalyze(true);
}

View File

@ -28,7 +28,15 @@ require_once "libraries/plugins/import/PMA_ShapeRecord.class.php";
* @package PhpMyAdmin-Import
*/
class ImportShp extends ImportPlugin
{
{
/**
* Constructor
*/
public function __construct()
{
$this->setProperties();
}
/**
* Sets the import plugin properties.
* Called in the constructor.