diff options
author | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2017-09-14 20:42:33 +0300 |
---|---|---|
committer | Maurício Meneghini Fauth <mauriciofauth@gmail.com> | 2017-09-14 23:51:34 +0300 |
commit | ca27f9303ba92c035712e2b5f8d612eb9547dfbc (patch) | |
tree | bc8a011dbd7bd89d0fafa67f4e2e47a141f6d9d4 /schema_export.php | |
parent | b68b570773c97211a9343515aa7e4f4ea22bffe3 (diff) |
Refactor schema_export function to a static method
Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
Diffstat (limited to 'schema_export.php')
-rw-r--r-- | schema_export.php | 46 |
1 files changed, 4 insertions, 42 deletions
diff --git a/schema_export.php b/schema_export.php index fd5d2d13ce..6a007512e6 100644 --- a/schema_export.php +++ b/schema_export.php @@ -6,10 +6,9 @@ * @package PhpMyAdmin */ -use PhpMyAdmin\Core; -use PhpMyAdmin\Plugins; -use PhpMyAdmin\Plugins\SchemaPlugin; +use PhpMyAdmin\Export; use PhpMyAdmin\Relation; +use PhpMyAdmin\Util; /** * Gets some core libraries @@ -23,48 +22,11 @@ require_once 'libraries/common.inc.php'; $cfgRelation = Relation::getRelationsParam(); if (! isset($_REQUEST['export_type'])) { - PhpMyAdmin\Util::checkParameters(array('export_type')); + Util::checkParameters(array('export_type')); } /** * Include the appropriate Schema Class depending on $export_type * default is PDF */ -PMA_processExportSchema($_REQUEST['export_type']); - -/** - * get all the export options and verify - * call and include the appropriate Schema Class depending on $export_type - * - * @param string $export_type format of the export - * - * @return void - */ -function PMA_processExportSchema($export_type) -{ - /** - * default is PDF, otherwise validate it's only letters a-z - */ - if (! isset($export_type) || ! preg_match('/^[a-zA-Z]+$/', $export_type)) { - $export_type = 'pdf'; - } - - // sanitize this parameter which will be used below in a file inclusion - $export_type = Core::securePath($export_type); - - // get the specific plugin - /* @var $export_plugin SchemaPlugin */ - $export_plugin = Plugins::getPlugin( - "schema", - $export_type, - 'libraries/classes/Plugins/Schema/' - ); - - // Check schema export type - if (! isset($export_plugin)) { - Core::fatalError(__('Bad type!')); - } - - $GLOBALS['dbi']->selectDb($GLOBALS['db']); - $export_plugin->exportSchema($GLOBALS['db']); -} +Export::processExportSchema($_REQUEST['export_type']); |