Refactor PhpMyAdmin\Export static methods
Replaces static methods with instance methods. Signed-off-by: Maurício Meneghini Fauth <mauriciofauth@gmail.com>
This commit is contained in:
parent
aade3546b2
commit
2638eb9207
@ -24,6 +24,8 @@ $header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('export.js');
|
||||
|
||||
$export = new Export();
|
||||
|
||||
// $sub_part is used in Util::getDbInfo() to see if we are coming from
|
||||
// db_export.php, in which case we don't obey $cfg['MaxTableList']
|
||||
$sub_part = '_export';
|
||||
@ -95,25 +97,25 @@ foreach (array('table_select', 'table_structure', 'table_data') as $one_key) {
|
||||
|
||||
foreach ($tables as $each_table) {
|
||||
if (isset($_GET['table_select']) && is_array($_GET['table_select'])) {
|
||||
$is_checked = Export::getCheckedClause(
|
||||
$is_checked = $export->getCheckedClause(
|
||||
$each_table['Name'], $_GET['table_select']
|
||||
);
|
||||
} elseif (isset($table_select)) {
|
||||
$is_checked = Export::getCheckedClause(
|
||||
$is_checked = $export->getCheckedClause(
|
||||
$each_table['Name'], $table_select
|
||||
);
|
||||
} else {
|
||||
$is_checked = ' checked="checked"';
|
||||
}
|
||||
if (isset($_GET['table_structure']) && is_array($_GET['table_structure'])) {
|
||||
$structure_checked = Export::getCheckedClause(
|
||||
$structure_checked = $export->getCheckedClause(
|
||||
$each_table['Name'], $_GET['table_structure']
|
||||
);
|
||||
} else {
|
||||
$structure_checked = $is_checked;
|
||||
}
|
||||
if (isset($_GET['table_data']) && is_array($_GET['table_data'])) {
|
||||
$data_checked = Export::getCheckedClause(
|
||||
$data_checked = $export->getCheckedClause(
|
||||
$each_table['Name'], $_GET['table_data']
|
||||
);
|
||||
} else {
|
||||
|
||||
46
export.php
46
export.php
@ -35,6 +35,8 @@ $header = $response->getHeader();
|
||||
$scripts = $header->getScripts();
|
||||
$scripts->addFile('export_output.js');
|
||||
|
||||
$export = new Export();
|
||||
|
||||
//check if it's the GET request to check export time out
|
||||
if (isset($_GET['check_time_out'])) {
|
||||
if (isset($_SESSION['pma_export_error'])) {
|
||||
@ -298,7 +300,7 @@ if ((!empty($parser->statements[0]))
|
||||
$aliases = \PhpMyAdmin\SqlParser\Utils\Misc::getAliases($parser->statements[0], $db);
|
||||
}
|
||||
if (!empty($_REQUEST['aliases'])) {
|
||||
$aliases = Export::mergeAliases($aliases, $_REQUEST['aliases']);
|
||||
$aliases = $export->mergeAliases($aliases, $_REQUEST['aliases']);
|
||||
$_SESSION['tmpval']['aliases'] = $_REQUEST['aliases'];
|
||||
}
|
||||
|
||||
@ -309,7 +311,7 @@ Util::setTimeLimit();
|
||||
if (! empty($cfg['MemoryLimit'])) {
|
||||
ini_set('memory_limit', $cfg['MemoryLimit']);
|
||||
}
|
||||
register_shutdown_function('PhpMyAdmin\Export::shutdown');
|
||||
register_shutdown_function([$export, 'shutdown']);
|
||||
// Start with empty buffer
|
||||
$dump_buffer = '';
|
||||
$dump_buffer_len = 0;
|
||||
@ -339,7 +341,7 @@ $output_charset_conversion = $asfile
|
||||
$GLOBALS['onfly_compression'] = $GLOBALS['cfg']['CompressOnFly']
|
||||
&& $compression == 'gzip';
|
||||
if ($GLOBALS['onfly_compression']) {
|
||||
$GLOBALS['memory_limit'] = Export::getMemoryLimit();
|
||||
$GLOBALS['memory_limit'] = $export->getMemoryLimit();
|
||||
}
|
||||
|
||||
// Generate filename and mime type if needed
|
||||
@ -347,7 +349,7 @@ if ($asfile) {
|
||||
if (empty($remember_template)) {
|
||||
$remember_template = '';
|
||||
}
|
||||
list($filename, $mime_type) = Export::getFilenameAndMimetype(
|
||||
list($filename, $mime_type) = $export->getFilenameAndMimetype(
|
||||
$export_type, $remember_template, $export_plugin, $compression,
|
||||
$filename_template
|
||||
);
|
||||
@ -357,13 +359,13 @@ if ($asfile) {
|
||||
|
||||
// Open file on server if needed
|
||||
if ($save_on_server) {
|
||||
list($save_filename, $message, $file_handle) = Export::openFile(
|
||||
list($save_filename, $message, $file_handle) = $export->openFile(
|
||||
$filename, $quick_export
|
||||
);
|
||||
|
||||
// problem opening export file on server?
|
||||
if (! empty($message)) {
|
||||
Export::showPage($db, $table, $export_type);
|
||||
$export->showPage($db, $table, $export_type);
|
||||
}
|
||||
} else {
|
||||
/**
|
||||
@ -391,7 +393,7 @@ if ($save_on_server) {
|
||||
exit();
|
||||
}
|
||||
}
|
||||
list($html, $back_button, $refreshButton) = Export::getHtmlForDisplayedExportHeader(
|
||||
list($html, $back_button, $refreshButton) = $export->getHtmlForDisplayedExportHeader(
|
||||
$export_type, $db, $table
|
||||
);
|
||||
echo $html;
|
||||
@ -434,7 +436,7 @@ do {
|
||||
if (! isset($db_select)) {
|
||||
$db_select = '';
|
||||
}
|
||||
Export::exportServer(
|
||||
$export->exportServer(
|
||||
$db_select, $whatStrucOrData, $export_plugin, $crlf, $err_url,
|
||||
$export_type, $do_relation, $do_comments, $do_mime, $do_dates,
|
||||
$aliases, $separate_files
|
||||
@ -451,19 +453,19 @@ do {
|
||||
$table_data = $tables;
|
||||
}
|
||||
if (isset($lock_tables)) {
|
||||
Export::lockTables($db, $tables, "READ");
|
||||
$export->lockTables($db, $tables, "READ");
|
||||
try {
|
||||
Export::exportDatabase(
|
||||
$export->exportDatabase(
|
||||
$db, $tables, $whatStrucOrData, $table_structure,
|
||||
$table_data, $export_plugin, $crlf, $err_url, $export_type,
|
||||
$do_relation, $do_comments, $do_mime, $do_dates, $aliases,
|
||||
$separate_files
|
||||
);
|
||||
} finally {
|
||||
Export::unlockTables();
|
||||
$export->unlockTables();
|
||||
}
|
||||
} else {
|
||||
Export::exportDatabase(
|
||||
$export->exportDatabase(
|
||||
$db, $tables, $whatStrucOrData, $table_structure, $table_data,
|
||||
$export_plugin, $crlf, $err_url, $export_type, $do_relation,
|
||||
$do_comments, $do_mime, $do_dates, $aliases, $separate_files
|
||||
@ -483,18 +485,18 @@ do {
|
||||
}
|
||||
if (isset($lock_tables)) {
|
||||
try {
|
||||
Export::lockTables($db, array($table), "READ");
|
||||
Export::exportTable(
|
||||
$export->lockTables($db, array($table), "READ");
|
||||
$export->exportTable(
|
||||
$db, $table, $whatStrucOrData, $export_plugin, $crlf,
|
||||
$err_url, $export_type, $do_relation, $do_comments,
|
||||
$do_mime, $do_dates, $allrows, $limit_to, $limit_from,
|
||||
$sql_query, $aliases
|
||||
);
|
||||
} finally {
|
||||
Export::unlockTables();
|
||||
$export->unlockTables();
|
||||
}
|
||||
} else {
|
||||
Export::exportTable(
|
||||
$export->exportTable(
|
||||
$db, $table, $whatStrucOrData, $export_plugin, $crlf, $err_url,
|
||||
$export_type, $do_relation, $do_comments, $do_mime, $do_dates,
|
||||
$allrows, $limit_to, $limit_from, $sql_query, $aliases
|
||||
@ -509,14 +511,14 @@ do {
|
||||
// End of fake loop
|
||||
|
||||
if ($save_on_server && ! empty($message)) {
|
||||
Export::showPage($db, $table, $export_type);
|
||||
$export->showPage($db, $table, $export_type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the dump as a file...
|
||||
*/
|
||||
if (empty($asfile)) {
|
||||
echo Export::getHtmlForDisplayedExportFooter($back_button, $refreshButton);
|
||||
echo $export->getHtmlForDisplayedExportFooter($back_button, $refreshButton);
|
||||
return;
|
||||
} // end if
|
||||
|
||||
@ -532,21 +534,21 @@ if ($output_charset_conversion) {
|
||||
// Compression needed?
|
||||
if ($compression) {
|
||||
if (! empty($separate_files)) {
|
||||
$dump_buffer = Export::compress(
|
||||
$dump_buffer = $export->compress(
|
||||
$dump_buffer_objects, $compression, $filename
|
||||
);
|
||||
} else {
|
||||
$dump_buffer = Export::compress($dump_buffer, $compression, $filename);
|
||||
$dump_buffer = $export->compress($dump_buffer, $compression, $filename);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* If we saved on server, we have to close file now */
|
||||
if ($save_on_server) {
|
||||
$message = Export::closeFile(
|
||||
$message = $export->closeFile(
|
||||
$file_handle, $dump_buffer, $save_filename
|
||||
);
|
||||
Export::showPage($db, $table, $export_type);
|
||||
$export->showPage($db, $table, $export_type);
|
||||
} else {
|
||||
echo $dump_buffer;
|
||||
}
|
||||
|
||||
@ -4938,7 +4938,7 @@ class Results
|
||||
|
||||
// Export link
|
||||
// (the url_query has extra parameters that won't be used to export)
|
||||
// (the single_table parameter is used in Export::getDisplay()
|
||||
// (the single_table parameter is used in \PhpMyAdmin\Export->getDisplay()
|
||||
// to hide the SQL and the structure export dialogs)
|
||||
// If the parser found a PROCEDURE clause
|
||||
// (most probably PROCEDURE ANALYSE()) it makes no sense to
|
||||
|
||||
@ -30,7 +30,7 @@ class Export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function shutdown()
|
||||
public function shutdown()
|
||||
{
|
||||
$error = error_get_last();
|
||||
if ($error != null && mb_strpos($error['message'], "execution time")) {
|
||||
@ -44,7 +44,7 @@ class Export
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
public static function isGzHandlerEnabled()
|
||||
public function isGzHandlerEnabled()
|
||||
{
|
||||
return in_array('ob_gzhandler', ob_list_handlers());
|
||||
}
|
||||
@ -55,7 +55,7 @@ class Export
|
||||
*
|
||||
* @return bool Whether gzencode is needed
|
||||
*/
|
||||
public static function gzencodeNeeded()
|
||||
public function gzencodeNeeded()
|
||||
{
|
||||
/*
|
||||
* We should gzencode only if the function exists
|
||||
@ -69,7 +69,7 @@ class Export
|
||||
|
||||
if (function_exists('gzencode')
|
||||
&& ((! ini_get('zlib.output_compression')
|
||||
&& ! self::isGzHandlerEnabled())
|
||||
&& ! $this->isGzHandlerEnabled())
|
||||
|| $GLOBALS['save_on_server']
|
||||
|| $chromeAndGreaterThan43)
|
||||
) {
|
||||
@ -87,7 +87,7 @@ class Export
|
||||
*
|
||||
* @return bool Whether output succeeded
|
||||
*/
|
||||
public static function outputHandler($line)
|
||||
public function outputHandler($line)
|
||||
{
|
||||
global $time_start, $dump_buffer, $dump_buffer_len, $save_filename;
|
||||
|
||||
@ -117,7 +117,7 @@ class Export
|
||||
);
|
||||
}
|
||||
if ($GLOBALS['compression'] == 'gzip'
|
||||
&& self::gzencodeNeeded()
|
||||
&& $this->gzencodeNeeded()
|
||||
) {
|
||||
// as a gzipped file
|
||||
// without the optional parameter level because it bugs
|
||||
@ -184,7 +184,7 @@ class Export
|
||||
}
|
||||
}
|
||||
return true;
|
||||
} // end of the 'self::outputHandler()' function
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns HTML containing the footer for a displayed export
|
||||
@ -194,7 +194,7 @@ class Export
|
||||
*
|
||||
* @return string $html the HTML output
|
||||
*/
|
||||
public static function getHtmlForDisplayedExportFooter($back_button, $refreshButton)
|
||||
public function getHtmlForDisplayedExportFooter($back_button, $refreshButton)
|
||||
{
|
||||
/**
|
||||
* Close the html tags and add the footers for on-screen export
|
||||
@ -222,7 +222,7 @@ class Export
|
||||
*
|
||||
* @return int $memory_limit the memory limit
|
||||
*/
|
||||
public static function getMemoryLimit()
|
||||
public function getMemoryLimit()
|
||||
{
|
||||
$memory_limit = trim(ini_get('memory_limit'));
|
||||
$memory_limit_num = (int)substr($memory_limit, 0, -1);
|
||||
@ -263,7 +263,7 @@ class Export
|
||||
*
|
||||
* @return string[] the filename template and mime type
|
||||
*/
|
||||
public static function getFilenameAndMimetype(
|
||||
public function getFilenameAndMimetype(
|
||||
$export_type, $remember_template, $export_plugin, $compression,
|
||||
$filename_template
|
||||
) {
|
||||
@ -332,7 +332,7 @@ class Export
|
||||
*
|
||||
* @return array the full save filename, possible message and the file handle
|
||||
*/
|
||||
public static function openFile($filename, $quick_export)
|
||||
public function openFile($filename, $quick_export)
|
||||
{
|
||||
$file_handle = null;
|
||||
$message = '';
|
||||
@ -381,7 +381,7 @@ class Export
|
||||
*
|
||||
* @return Message $message a message object (or empty string)
|
||||
*/
|
||||
public static function closeFile($file_handle, $dump_buffer, $save_filename)
|
||||
public function closeFile($file_handle, $dump_buffer, $save_filename)
|
||||
{
|
||||
$write_result = @fwrite($file_handle, $dump_buffer);
|
||||
fclose($file_handle);
|
||||
@ -414,13 +414,13 @@ class Export
|
||||
*
|
||||
* @return object $message a message object (or empty string)
|
||||
*/
|
||||
public static function compress($dump_buffer, $compression, $filename)
|
||||
public function compress($dump_buffer, $compression, $filename)
|
||||
{
|
||||
if ($compression == 'zip' && function_exists('gzcompress')) {
|
||||
$zipExtension = new ZipExtension();
|
||||
$filename = substr($filename, 0, -4); // remove extension (.zip)
|
||||
$dump_buffer = $zipExtension->createFile($dump_buffer, $filename);
|
||||
} elseif ($compression == 'gzip' && self::gzencodeNeeded()) {
|
||||
} elseif ($compression == 'gzip' && $this->gzencodeNeeded()) {
|
||||
// without the optional parameter level because it bugs
|
||||
$dump_buffer = gzencode($dump_buffer);
|
||||
}
|
||||
@ -436,7 +436,7 @@ class Export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function saveObjectInBuffer($object_name, $append = false)
|
||||
public function saveObjectInBuffer($object_name, $append = false)
|
||||
{
|
||||
|
||||
global $dump_buffer_objects, $dump_buffer, $dump_buffer_len;
|
||||
@ -464,7 +464,7 @@ class Export
|
||||
*
|
||||
* @return string[] the generated HTML and back button
|
||||
*/
|
||||
public static function getHtmlForDisplayedExportHeader($export_type, $db, $table)
|
||||
public function getHtmlForDisplayedExportHeader($export_type, $db, $table)
|
||||
{
|
||||
$html = '<div>';
|
||||
|
||||
@ -555,7 +555,7 @@ class Export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function exportServer(
|
||||
public function exportServer(
|
||||
$db_select, $whatStrucOrData, $export_plugin, $crlf, $err_url,
|
||||
$export_type, $do_relation, $do_comments, $do_mime, $do_dates,
|
||||
array $aliases, $separate_files
|
||||
@ -570,14 +570,14 @@ class Export
|
||||
&& mb_strpos(' ' . $tmp_select, '|' . $current_db . '|')
|
||||
) {
|
||||
$tables = $GLOBALS['dbi']->getTables($current_db);
|
||||
self::exportDatabase(
|
||||
$this->exportDatabase(
|
||||
$current_db, $tables, $whatStrucOrData, $tables, $tables,
|
||||
$export_plugin, $crlf, $err_url, $export_type, $do_relation,
|
||||
$do_comments, $do_mime, $do_dates, $aliases,
|
||||
$separate_files == 'database' ? $separate_files : ''
|
||||
);
|
||||
if ($separate_files == 'server') {
|
||||
self::saveObjectInBuffer($current_db);
|
||||
$this->saveObjectInBuffer($current_db);
|
||||
}
|
||||
}
|
||||
} // end foreach database
|
||||
@ -604,7 +604,7 @@ class Export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function exportDatabase(
|
||||
public function exportDatabase(
|
||||
$db, array $tables, $whatStrucOrData, array $table_structure, array $table_data,
|
||||
$export_plugin, $crlf, $err_url, $export_type, $do_relation,
|
||||
$do_comments, $do_mime, $do_dates, array $aliases, $separate_files
|
||||
@ -619,7 +619,7 @@ class Export
|
||||
return;
|
||||
}
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('database', true);
|
||||
$this->saveObjectInBuffer('database', true);
|
||||
}
|
||||
|
||||
if (($GLOBALS['sql_structure_or_data'] == 'structure'
|
||||
@ -629,7 +629,7 @@ class Export
|
||||
$export_plugin->exportRoutines($db, $aliases);
|
||||
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('routines');
|
||||
$this->saveObjectInBuffer('routines');
|
||||
}
|
||||
}
|
||||
|
||||
@ -712,7 +712,7 @@ class Export
|
||||
|
||||
// this buffer was filled, we save it and go to the next one
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('table_' . $table);
|
||||
$this->saveObjectInBuffer('table_' . $table);
|
||||
}
|
||||
|
||||
// now export the triggers (needs to be done after the data because
|
||||
@ -730,7 +730,7 @@ class Export
|
||||
}
|
||||
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('table_' . $table, true);
|
||||
$this->saveObjectInBuffer('table_' . $table, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -752,7 +752,7 @@ class Export
|
||||
}
|
||||
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('view_' . $view);
|
||||
$this->saveObjectInBuffer('view_' . $view);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -767,16 +767,16 @@ class Export
|
||||
if (isset($GLOBALS['sql_metadata'])) {
|
||||
// Types of metadata to export.
|
||||
// In the future these can be allowed to be selected by the user
|
||||
$metadataTypes = self::getMetadataTypes();
|
||||
$metadataTypes = $this->getMetadataTypes();
|
||||
$export_plugin->exportMetadata($db, $tables, $metadataTypes);
|
||||
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('metadata');
|
||||
$this->saveObjectInBuffer('metadata');
|
||||
}
|
||||
}
|
||||
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('extra');
|
||||
$this->saveObjectInBuffer('extra');
|
||||
}
|
||||
|
||||
if (($GLOBALS['sql_structure_or_data'] == 'structure'
|
||||
@ -786,7 +786,7 @@ class Export
|
||||
$export_plugin->exportEvents($db);
|
||||
|
||||
if ($separate_files == 'database') {
|
||||
self::saveObjectInBuffer('events');
|
||||
$this->saveObjectInBuffer('events');
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -813,7 +813,7 @@ class Export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function exportTable(
|
||||
public function exportTable(
|
||||
$db, $table, $whatStrucOrData, $export_plugin, $crlf, $err_url,
|
||||
$export_type, $do_relation, $do_comments, $do_mime, $do_dates,
|
||||
$allrows, $limit_to, $limit_from, $sql_query, array $aliases
|
||||
@ -915,7 +915,7 @@ class Export
|
||||
if (isset($GLOBALS['sql_metadata'])) {
|
||||
// Types of metadata to export.
|
||||
// In the future these can be allowed to be selected by the user
|
||||
$metadataTypes = self::getMetadataTypes();
|
||||
$metadataTypes = $this->getMetadataTypes();
|
||||
$export_plugin->exportMetadata($db, $table, $metadataTypes);
|
||||
}
|
||||
}
|
||||
@ -929,7 +929,7 @@ class Export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function showPage($db, $table, $export_type)
|
||||
public function showPage($db, $table, $export_type)
|
||||
{
|
||||
global $cfg;
|
||||
if ($export_type == 'server') {
|
||||
@ -955,7 +955,7 @@ class Export
|
||||
*
|
||||
* @return array resultant merged aliases info
|
||||
*/
|
||||
public static function mergeAliases(array $aliases1, array $aliases2)
|
||||
public function mergeAliases(array $aliases1, array $aliases2)
|
||||
{
|
||||
// First do a recursive array merge
|
||||
// on aliases arrays.
|
||||
@ -1008,7 +1008,7 @@ class Export
|
||||
*
|
||||
* @return mixed result of the query
|
||||
*/
|
||||
public static function lockTables($db, array $tables, $lockType = "WRITE")
|
||||
public function lockTables($db, array $tables, $lockType = "WRITE")
|
||||
{
|
||||
$locks = array();
|
||||
foreach ($tables as $table) {
|
||||
@ -1025,7 +1025,7 @@ class Export
|
||||
*
|
||||
* @return mixed result of the query
|
||||
*/
|
||||
public static function unlockTables()
|
||||
public function unlockTables()
|
||||
{
|
||||
return $GLOBALS['dbi']->tryQuery("UNLOCK TABLES");
|
||||
}
|
||||
@ -1035,7 +1035,7 @@ class Export
|
||||
*
|
||||
* @return string[] metadata types.
|
||||
*/
|
||||
public static function getMetadataTypes()
|
||||
public function getMetadataTypes()
|
||||
{
|
||||
return array(
|
||||
'column_info',
|
||||
@ -1059,7 +1059,7 @@ class Export
|
||||
*
|
||||
* @return string the checked clause
|
||||
*/
|
||||
public static function getCheckedClause($key, array $array)
|
||||
public function getCheckedClause($key, array $array)
|
||||
{
|
||||
if (in_array($key, $array)) {
|
||||
return ' checked="checked"';
|
||||
@ -1076,7 +1076,7 @@ class Export
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public static function processExportSchema($export_type)
|
||||
public function processExportSchema($export_type)
|
||||
{
|
||||
/**
|
||||
* default is PDF, otherwise validate it's only letters a-z
|
||||
|
||||
@ -44,6 +44,7 @@ class ExportCodegen extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
// initialize the specific export CodeGen variables
|
||||
$this->initSpecificVariables();
|
||||
$this->setProperties();
|
||||
@ -196,12 +197,12 @@ class ExportCodegen extends ExportPlugin
|
||||
if (isset($CG_FORMATS[$format])) {
|
||||
$method = $CG_HANDLERS[$format];
|
||||
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
$this->$method($db, $table, $crlf, $aliases)
|
||||
);
|
||||
}
|
||||
|
||||
return Export::outputHandler(sprintf("%s is not supported.", $format));
|
||||
return $this->export->outputHandler(sprintf("%s is not supported.", $format));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -32,6 +32,7 @@ class ExportCsv extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setProperties();
|
||||
}
|
||||
|
||||
@ -256,7 +257,7 @@ class ExportCsv extends ExportPlugin
|
||||
$schema_insert .= $csv_separator;
|
||||
} // end for
|
||||
$schema_insert = trim(mb_substr($schema_insert, 0, -1));
|
||||
if (!Export::outputHandler($schema_insert . $csv_terminated)) {
|
||||
if (!$this->export->outputHandler($schema_insert . $csv_terminated)) {
|
||||
return false;
|
||||
}
|
||||
} // end if
|
||||
@ -321,7 +322,7 @@ class ExportCsv extends ExportPlugin
|
||||
}
|
||||
} // end for
|
||||
|
||||
if (!Export::outputHandler($schema_insert . $csv_terminated)) {
|
||||
if (!$this->export->outputHandler($schema_insert . $csv_terminated)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
@ -109,7 +109,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
{
|
||||
global $charset;
|
||||
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
'<html xmlns:o="urn:schemas-microsoft-com:office:office"
|
||||
xmlns:x="urn:schemas-microsoft-com:office:word"
|
||||
xmlns="http://www.w3.org/TR/REC-html40">
|
||||
@ -132,7 +132,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
*/
|
||||
public function exportFooter()
|
||||
{
|
||||
return Export::outputHandler('</body></html>');
|
||||
return $this->export->outputHandler('</body></html>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -149,7 +149,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
$db_alias = $db;
|
||||
}
|
||||
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
'<h1>' . __('Database') . ' ' . htmlspecialchars($db_alias) . '</h1>'
|
||||
);
|
||||
}
|
||||
@ -206,7 +206,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
$table_alias = $table;
|
||||
$this->initAlias($aliases, $db_alias, $table_alias);
|
||||
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
'<h2>'
|
||||
. __('Dumping data for table') . ' ' . htmlspecialchars($table_alias)
|
||||
. '</h2>'
|
||||
@ -214,7 +214,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
) {
|
||||
return false;
|
||||
}
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
'<table class="width100" cellspacing="1">'
|
||||
)
|
||||
) {
|
||||
@ -243,7 +243,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
. '</strong></td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (!Export::outputHandler($schema_insert)) {
|
||||
if (!$this->export->outputHandler($schema_insert)) {
|
||||
return false;
|
||||
}
|
||||
} // end if
|
||||
@ -264,13 +264,13 @@ class ExportHtmlword extends ExportPlugin
|
||||
. '</td>';
|
||||
} // end for
|
||||
$schema_insert .= '</tr>';
|
||||
if (!Export::outputHandler($schema_insert)) {
|
||||
if (!$this->export->outputHandler($schema_insert)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
$GLOBALS['dbi']->freeResult($result);
|
||||
|
||||
return Export::outputHandler('</table>');
|
||||
return $this->export->outputHandler('</table>');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -604,7 +604,7 @@ class ExportHtmlword extends ExportPlugin
|
||||
$dump .= $this->getTableDefStandIn($db, $table, $crlf, $aliases);
|
||||
} // end switch
|
||||
|
||||
return Export::outputHandler($dump);
|
||||
return $this->export->outputHandler($dump);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -32,6 +32,7 @@ class ExportJson extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setProperties();
|
||||
}
|
||||
|
||||
@ -119,7 +120,7 @@ class ExportJson extends ExportPlugin
|
||||
'comment' => 'Export to JSON plugin for PHPMyAdmin',
|
||||
);
|
||||
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
'[' . $crlf . $this->encode($meta) . ',' . $crlf
|
||||
);
|
||||
}
|
||||
@ -133,7 +134,7 @@ class ExportJson extends ExportPlugin
|
||||
{
|
||||
global $crlf;
|
||||
|
||||
return Export::outputHandler(']' . $crlf);
|
||||
return $this->export->outputHandler(']' . $crlf);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -157,7 +158,7 @@ class ExportJson extends ExportPlugin
|
||||
'name' => $db_alias
|
||||
);
|
||||
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
$this->encode($meta) . ',' . $crlf
|
||||
);
|
||||
}
|
||||
@ -213,7 +214,7 @@ class ExportJson extends ExportPlugin
|
||||
$this->initAlias($aliases, $db_alias, $table_alias);
|
||||
|
||||
if (! $this->first) {
|
||||
if (!Export::outputHandler(',')) {
|
||||
if (!$this->export->outputHandler(',')) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
@ -230,7 +231,7 @@ class ExportJson extends ExportPlugin
|
||||
);
|
||||
list($header, $footer) = explode('"@@DATA@@"', $buffer);
|
||||
|
||||
if (!Export::outputHandler($header . $crlf . '[' . $crlf)) {
|
||||
if (!$this->export->outputHandler($header . $crlf . '[' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -257,7 +258,7 @@ class ExportJson extends ExportPlugin
|
||||
|
||||
// Output table name as comment if this is the first record of the table
|
||||
if ($record_cnt > 1) {
|
||||
if (!Export::outputHandler(',' . $crlf)) {
|
||||
if (!$this->export->outputHandler(',' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -268,12 +269,12 @@ class ExportJson extends ExportPlugin
|
||||
$data[$columns[$i]] = $record[$i];
|
||||
}
|
||||
|
||||
if (!Export::outputHandler($this->encode($data))) {
|
||||
if (!$this->export->outputHandler($this->encode($data))) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
if (!Export::outputHandler($crlf . ']' . $crlf . $footer . $crlf)) {
|
||||
if (!$this->export->outputHandler($crlf . ']' . $crlf . $footer . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -223,7 +223,7 @@ class ExportLatex extends ExportPlugin
|
||||
. '% ' . __('Server version:') . ' ' . $GLOBALS['dbi']->getVersionString() . $crlf
|
||||
. '% ' . __('PHP Version:') . ' ' . phpversion() . $crlf;
|
||||
|
||||
return Export::outputHandler($head);
|
||||
return $this->export->outputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -254,7 +254,7 @@ class ExportLatex extends ExportPlugin
|
||||
. '% ' . __('Database:') . ' ' . '\'' . $db_alias . '\'' . $crlf
|
||||
. '% ' . $crlf;
|
||||
|
||||
return Export::outputHandler($head);
|
||||
return $this->export->outputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -351,7 +351,7 @@ class ExportLatex extends ExportPlugin
|
||||
)
|
||||
. '} \\\\';
|
||||
}
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -364,11 +364,11 @@ class ExportLatex extends ExportPlugin
|
||||
}
|
||||
|
||||
$buffer = mb_substr($buffer, 0, -2) . '\\\\ \\hline \hline ';
|
||||
if (!Export::outputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
|
||||
if (!$this->export->outputHandler($buffer . ' \\endfirsthead ' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
if (isset($GLOBALS['latex_caption'])) {
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
'\\caption{'
|
||||
. Util::expandUserString(
|
||||
$GLOBALS['latex_data_continued_caption'],
|
||||
@ -384,11 +384,11 @@ class ExportLatex extends ExportPlugin
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if (!Export::outputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
|
||||
if (!$this->export->outputHandler($buffer . '\\endhead \\endfoot' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
if (!Export::outputHandler('\\\\ \hline')) {
|
||||
if (!$this->export->outputHandler('\\\\ \hline')) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -417,13 +417,13 @@ class ExportLatex extends ExportPlugin
|
||||
}
|
||||
}
|
||||
$buffer .= ' \\\\ \\hline ' . $crlf;
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
$buffer = ' \\end{longtable}' . $crlf;
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -506,7 +506,7 @@ class ExportLatex extends ExportPlugin
|
||||
*/
|
||||
$buffer = $crlf . '%' . $crlf . '% ' . __('Structure:') . ' '
|
||||
. $table_alias . $crlf . '%' . $crlf . ' \\begin{longtable}{';
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -575,7 +575,7 @@ class ExportLatex extends ExportPlugin
|
||||
}
|
||||
$buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . $crlf;
|
||||
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -648,14 +648,14 @@ class ExportLatex extends ExportPlugin
|
||||
$buffer = str_replace("\000", ' & ', $local_buffer);
|
||||
$buffer .= ' \\\\ \\hline ' . $crlf;
|
||||
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
|
||||
$buffer = ' \\end{longtable}' . $crlf;
|
||||
|
||||
return Export::outputHandler($buffer);
|
||||
return $this->export->outputHandler($buffer);
|
||||
} // end of the 'exportStructure' method
|
||||
|
||||
/**
|
||||
|
||||
@ -32,6 +32,7 @@ class ExportMediawiki extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setProperties();
|
||||
}
|
||||
|
||||
@ -262,7 +263,7 @@ class ExportMediawiki extends ExportPlugin
|
||||
break;
|
||||
} // end switch
|
||||
|
||||
return Export::outputHandler($output);
|
||||
return $this->export->outputHandler($output);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -347,7 +348,7 @@ class ExportMediawiki extends ExportPlugin
|
||||
// End table construction
|
||||
$output .= "|}" . str_repeat($this->_exportCRLF(), 2);
|
||||
|
||||
return Export::outputHandler($output);
|
||||
return $this->export->outputHandler($output);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -32,6 +32,7 @@ class ExportOds extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$GLOBALS['ods_buffer'] = '';
|
||||
$this->setProperties();
|
||||
}
|
||||
@ -149,7 +150,7 @@ class ExportOds extends ExportPlugin
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
OpenDocument::create(
|
||||
'application/vnd.oasis.opendocument.spreadsheet',
|
||||
$GLOBALS['ods_buffer']
|
||||
|
||||
@ -18,7 +18,6 @@ use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyRootGroup;
|
||||
use PhpMyAdmin\Properties\Options\Items\BoolPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\Transformations;
|
||||
use PhpMyAdmin\Util;
|
||||
|
||||
@ -168,7 +167,7 @@ class ExportOdt extends ExportPlugin
|
||||
$GLOBALS['odt_buffer'] .= '</office:text>'
|
||||
. '</office:body>'
|
||||
. '</office:document-content>';
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
OpenDocument::create(
|
||||
'application/vnd.oasis.opendocument.text',
|
||||
$GLOBALS['odt_buffer']
|
||||
|
||||
@ -39,6 +39,7 @@ class ExportPdf extends ExportPlugin
|
||||
* @var Pdf
|
||||
*/
|
||||
private $_pdf;
|
||||
|
||||
/**
|
||||
* PDF Report Title
|
||||
*
|
||||
@ -51,6 +52,8 @@ class ExportPdf extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
// initialize the specific export PDF variables
|
||||
$this->initSpecificVariables();
|
||||
|
||||
@ -151,7 +154,7 @@ class ExportPdf extends ExportPlugin
|
||||
$pdf = $this->_getPdf();
|
||||
|
||||
// instead of $pdf->Output():
|
||||
return Export::outputHandler($pdf->getPDFData());
|
||||
return $this->export->outputHandler($pdf->getPDFData());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -31,6 +31,7 @@ class ExportPhparray extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setProperties();
|
||||
}
|
||||
|
||||
@ -87,7 +88,7 @@ class ExportPhparray extends ExportPlugin
|
||||
*/
|
||||
public function exportHeader()
|
||||
{
|
||||
Export::outputHandler(
|
||||
$this->export->outputHandler(
|
||||
'<?php' . $GLOBALS['crlf']
|
||||
. '/**' . $GLOBALS['crlf']
|
||||
. ' * Export to PHP Array plugin for PHPMyAdmin' . $GLOBALS['crlf']
|
||||
@ -121,7 +122,7 @@ class ExportPhparray extends ExportPlugin
|
||||
if (empty($db_alias)) {
|
||||
$db_alias = $db;
|
||||
}
|
||||
Export::outputHandler(
|
||||
$this->export->outputHandler(
|
||||
'/**' . $GLOBALS['crlf']
|
||||
. ' * Database ' . $this->commentString(Util::backquote($db_alias))
|
||||
. $GLOBALS['crlf'] . ' */' . $GLOBALS['crlf']
|
||||
@ -246,7 +247,7 @@ class ExportPhparray extends ExportPlugin
|
||||
}
|
||||
|
||||
$buffer .= $crlf . ');' . $crlf;
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@ -22,7 +22,6 @@ use PhpMyAdmin\Properties\Options\Items\NumberPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\RadioPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\SelectPropertyItem;
|
||||
use PhpMyAdmin\Properties\Options\Items\TextPropertyItem;
|
||||
use PhpMyAdmin\Relation;
|
||||
use PhpMyAdmin\SqlParser\Components\CreateDefinition;
|
||||
use PhpMyAdmin\SqlParser\Context;
|
||||
use PhpMyAdmin\SqlParser\Parser;
|
||||
@ -581,7 +580,7 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
|
||||
if (!empty($text)) {
|
||||
return Export::outputHandler($text);
|
||||
return $this->export->outputHandler($text);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -667,7 +666,7 @@ class ExportSql extends ExportPlugin
|
||||
$GLOBALS['dbi']->query('SET time_zone = "' . $GLOBALS['old_tz'] . '"');
|
||||
}
|
||||
|
||||
return Export::outputHandler($foot);
|
||||
return $this->export->outputHandler($foot);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -774,7 +773,7 @@ class ExportSql extends ExportPlugin
|
||||
$this->_sent_charset = true;
|
||||
}
|
||||
|
||||
return Export::outputHandler($head);
|
||||
return $this->export->outputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -799,7 +798,7 @@ class ExportSql extends ExportPlugin
|
||||
$compat = 'NONE';
|
||||
}
|
||||
if (isset($GLOBALS['sql_drop_database'])) {
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
'DROP DATABASE IF EXISTS '
|
||||
. Util::backquoteCompat(
|
||||
$db_alias,
|
||||
@ -835,7 +834,7 @@ class ExportSql extends ExportPlugin
|
||||
$create_query .= ' DEFAULT CHARACTER SET ' . $collation;
|
||||
}
|
||||
$create_query .= ';' . $crlf;
|
||||
if (!Export::outputHandler($create_query)) {
|
||||
if (!$this->export->outputHandler($create_query)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -857,7 +856,7 @@ class ExportSql extends ExportPlugin
|
||||
if (isset($GLOBALS['sql_compatibility'])
|
||||
&& $GLOBALS['sql_compatibility'] == 'NONE'
|
||||
) {
|
||||
$result = Export::outputHandler(
|
||||
$result = $this->export->outputHandler(
|
||||
'USE '
|
||||
. Util::backquoteCompat(
|
||||
$db,
|
||||
@ -867,7 +866,7 @@ class ExportSql extends ExportPlugin
|
||||
. ';' . $crlf
|
||||
);
|
||||
} else {
|
||||
$result = Export::outputHandler('USE ' . $db . ';' . $crlf);
|
||||
$result = $this->export->outputHandler('USE ' . $db . ';' . $crlf);
|
||||
}
|
||||
|
||||
return $result;
|
||||
@ -902,7 +901,7 @@ class ExportSql extends ExportPlugin
|
||||
)
|
||||
. $this->_exportComment();
|
||||
|
||||
return Export::outputHandler($head);
|
||||
return $this->export->outputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -920,17 +919,17 @@ class ExportSql extends ExportPlugin
|
||||
|
||||
//add indexes to the sql dump file
|
||||
if (isset($GLOBALS['sql_indexes'])) {
|
||||
$result = Export::outputHandler($GLOBALS['sql_indexes']);
|
||||
$result = $this->export->outputHandler($GLOBALS['sql_indexes']);
|
||||
unset($GLOBALS['sql_indexes']);
|
||||
}
|
||||
//add auto increments to the sql dump file
|
||||
if (isset($GLOBALS['sql_auto_increments'])) {
|
||||
$result = Export::outputHandler($GLOBALS['sql_auto_increments']);
|
||||
$result = $this->export->outputHandler($GLOBALS['sql_auto_increments']);
|
||||
unset($GLOBALS['sql_auto_increments']);
|
||||
}
|
||||
//add constraints to the sql dump file
|
||||
if (isset($GLOBALS['sql_constraints'])) {
|
||||
$result = Export::outputHandler($GLOBALS['sql_constraints']);
|
||||
$result = $this->export->outputHandler($GLOBALS['sql_constraints']);
|
||||
unset($GLOBALS['sql_constraints']);
|
||||
}
|
||||
|
||||
@ -979,7 +978,7 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
|
||||
if (!empty($text)) {
|
||||
return Export::outputHandler($text);
|
||||
return $this->export->outputHandler($text);
|
||||
}
|
||||
|
||||
return false;
|
||||
@ -1009,7 +1008,7 @@ class ExportSql extends ExportPlugin
|
||||
. $this->_exportComment()
|
||||
. $this->_exportComment(__('Metadata'))
|
||||
. $this->_exportComment();
|
||||
if (!Export::outputHandler($comment)) {
|
||||
if (!$this->export->outputHandler($comment)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1092,7 +1091,7 @@ class ExportSql extends ExportPlugin
|
||||
|
||||
$comment .= $this->_exportComment();
|
||||
|
||||
if (!Export::outputHandler($comment)) {
|
||||
if (!$this->export->outputHandler($comment)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1142,7 +1141,7 @@ class ExportSql extends ExportPlugin
|
||||
$lastPage = $GLOBALS['crlf']
|
||||
. "SET @LAST_PAGE = LAST_INSERT_ID();"
|
||||
. $GLOBALS['crlf'];
|
||||
if (!Export::outputHandler($lastPage)) {
|
||||
if (!$this->export->outputHandler($lastPage)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -2132,7 +2131,7 @@ class ExportSql extends ExportPlugin
|
||||
// but not in the case of export
|
||||
unset($GLOBALS['sql_constraints_query']);
|
||||
|
||||
return Export::outputHandler($dump);
|
||||
return $this->export->outputHandler($dump);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -2190,7 +2189,7 @@ class ExportSql extends ExportPlugin
|
||||
. $this->_exportComment()
|
||||
. $this->_possibleCRLF();
|
||||
|
||||
return Export::outputHandler($head);
|
||||
return $this->export->outputHandler($head);
|
||||
}
|
||||
|
||||
$result = $GLOBALS['dbi']->tryQuery(
|
||||
@ -2206,7 +2205,7 @@ class ExportSql extends ExportPlugin
|
||||
if (! defined('TESTSUITE')) {
|
||||
trigger_error($message, E_USER_ERROR);
|
||||
}
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
$this->_exportComment($message)
|
||||
);
|
||||
}
|
||||
@ -2296,8 +2295,8 @@ class ExportSql extends ExportPlugin
|
||||
)
|
||||
. $this->_exportComment()
|
||||
. $crlf;
|
||||
Export::outputHandler($truncatehead);
|
||||
Export::outputHandler($truncate);
|
||||
$this->export->outputHandler($truncatehead);
|
||||
$this->export->outputHandler($truncate);
|
||||
}
|
||||
|
||||
// scheme for inserting fields
|
||||
@ -2348,7 +2347,7 @@ class ExportSql extends ExportPlugin
|
||||
)
|
||||
. $this->_exportComment()
|
||||
. $crlf;
|
||||
if (!Export::outputHandler($head)) {
|
||||
if (!$this->export->outputHandler($head)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2357,7 +2356,7 @@ class ExportSql extends ExportPlugin
|
||||
&& $GLOBALS['sql_compatibility'] == 'MSSQL'
|
||||
&& $current_row == 0
|
||||
) {
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
'SET IDENTITY_INSERT '
|
||||
. Util::backquoteCompat(
|
||||
$table_alias,
|
||||
@ -2468,7 +2467,7 @@ class ExportSql extends ExportPlugin
|
||||
&& $sql_max_size > 0
|
||||
&& $query_size + $insertLineSize > $sql_max_size
|
||||
) {
|
||||
if (!Export::outputHandler(';' . $crlf)) {
|
||||
if (!$this->export->outputHandler(';' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
$query_size = 0;
|
||||
@ -2485,7 +2484,7 @@ class ExportSql extends ExportPlugin
|
||||
}
|
||||
unset($values);
|
||||
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
($current_row == 1 ? '' : $separator . $crlf)
|
||||
. $insert_line
|
||||
)
|
||||
@ -2495,7 +2494,7 @@ class ExportSql extends ExportPlugin
|
||||
} // end while
|
||||
|
||||
if ($current_row > 0) {
|
||||
if (!Export::outputHandler(';' . $crlf)) {
|
||||
if (!$this->export->outputHandler(';' . $crlf)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -2505,7 +2504,7 @@ class ExportSql extends ExportPlugin
|
||||
&& $GLOBALS['sql_compatibility'] == 'MSSQL'
|
||||
&& $current_row > 0
|
||||
) {
|
||||
$outputSucceeded = Export::outputHandler(
|
||||
$outputSucceeded = $this->export->outputHandler(
|
||||
$crlf . 'SET IDENTITY_INSERT '
|
||||
. Util::backquoteCompat(
|
||||
$table_alias,
|
||||
|
||||
@ -133,7 +133,7 @@ class ExportTexytext extends ExportPlugin
|
||||
$db_alias = $db;
|
||||
}
|
||||
|
||||
return Export::outputHandler(
|
||||
return $this->export->outputHandler(
|
||||
'===' . __('Database') . ' ' . $db_alias . "\n\n"
|
||||
);
|
||||
}
|
||||
@ -190,7 +190,7 @@ class ExportTexytext extends ExportPlugin
|
||||
$table_alias = $table;
|
||||
$this->initAlias($aliases, $db_alias, $table_alias);
|
||||
|
||||
if (!Export::outputHandler(
|
||||
if (!$this->export->outputHandler(
|
||||
'== ' . __('Dumping data for table') . ' ' . $table_alias . "\n\n"
|
||||
)
|
||||
) {
|
||||
@ -217,7 +217,7 @@ class ExportTexytext extends ExportPlugin
|
||||
. htmlspecialchars(stripslashes($col_as));
|
||||
} // end for
|
||||
$text_output .= "\n|------\n";
|
||||
if (!Export::outputHandler($text_output)) {
|
||||
if (!$this->export->outputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
} // end if
|
||||
@ -241,7 +241,7 @@ class ExportTexytext extends ExportPlugin
|
||||
);
|
||||
} // end for
|
||||
$text_output .= "\n";
|
||||
if (!Export::outputHandler($text_output)) {
|
||||
if (!$this->export->outputHandler($text_output)) {
|
||||
return false;
|
||||
}
|
||||
} // end while
|
||||
@ -561,7 +561,7 @@ class ExportTexytext extends ExportPlugin
|
||||
$dump .= $this->getTableDefStandIn($db, $table, $crlf, $aliases);
|
||||
} // end switch
|
||||
|
||||
return Export::outputHandler($dump);
|
||||
return $this->export->outputHandler($dump);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -49,6 +49,7 @@ class ExportXml extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setProperties();
|
||||
}
|
||||
|
||||
@ -368,7 +369,7 @@ class ExportXml extends ExportPlugin
|
||||
}
|
||||
}
|
||||
|
||||
return Export::outputHandler($head);
|
||||
return $this->export->outputHandler($head);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -380,7 +381,7 @@ class ExportXml extends ExportPlugin
|
||||
{
|
||||
$foot = '</pma_xml_export>';
|
||||
|
||||
return Export::outputHandler($foot);
|
||||
return $this->export->outputHandler($foot);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -407,7 +408,7 @@ class ExportXml extends ExportPlugin
|
||||
. ' -->' . $crlf . ' <database name="'
|
||||
. htmlspecialchars($db_alias) . '">' . $crlf;
|
||||
|
||||
return Export::outputHandler($head);
|
||||
return $this->export->outputHandler($head);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -427,7 +428,7 @@ class ExportXml extends ExportPlugin
|
||||
if (isset($GLOBALS['xml_export_contents'])
|
||||
&& $GLOBALS['xml_export_contents']
|
||||
) {
|
||||
return Export::outputHandler(' </database>' . $crlf);
|
||||
return $this->export->outputHandler(' </database>' . $crlf);
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -493,7 +494,7 @@ class ExportXml extends ExportPlugin
|
||||
|
||||
$buffer = ' <!-- ' . __('Table') . ' '
|
||||
. htmlspecialchars($table_alias) . ' -->' . $crlf;
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -519,7 +520,7 @@ class ExportXml extends ExportPlugin
|
||||
}
|
||||
$buffer .= ' </table>' . $crlf;
|
||||
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -30,6 +30,7 @@ class ExportYaml extends ExportPlugin
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
$this->setProperties();
|
||||
}
|
||||
|
||||
@ -74,7 +75,7 @@ class ExportYaml extends ExportPlugin
|
||||
*/
|
||||
public function exportHeader()
|
||||
{
|
||||
Export::outputHandler(
|
||||
$this->export->outputHandler(
|
||||
'%YAML 1.1' . $GLOBALS['crlf'] . '---' . $GLOBALS['crlf']
|
||||
);
|
||||
|
||||
@ -88,7 +89,7 @@ class ExportYaml extends ExportPlugin
|
||||
*/
|
||||
public function exportFooter()
|
||||
{
|
||||
Export::outputHandler('...' . $GLOBALS['crlf']);
|
||||
$this->export->outputHandler('...' . $GLOBALS['crlf']);
|
||||
|
||||
return true;
|
||||
}
|
||||
@ -207,7 +208,7 @@ class ExportYaml extends ExportPlugin
|
||||
$buffer .= ' ' . $columns[$i] . ': "' . $record[$i] . '"' . $crlf;
|
||||
}
|
||||
|
||||
if (!Export::outputHandler($buffer)) {
|
||||
if (!$this->export->outputHandler($buffer)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@
|
||||
|
||||
namespace PhpMyAdmin\Plugins;
|
||||
|
||||
use PhpMyAdmin\Export;
|
||||
use PhpMyAdmin\Properties\Plugins\ExportPluginProperties;
|
||||
use PhpMyAdmin\Relation;
|
||||
|
||||
@ -34,12 +35,18 @@ abstract class ExportPlugin
|
||||
*/
|
||||
protected $relation;
|
||||
|
||||
/**
|
||||
* @var Export $export
|
||||
*/
|
||||
protected $export;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
$this->relation = new Relation();
|
||||
$this->export = new Export();
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@ -30,4 +30,5 @@ if (! isset($_REQUEST['export_type'])) {
|
||||
* Include the appropriate Schema Class depending on $export_type
|
||||
* default is PDF
|
||||
*/
|
||||
Export::processExportSchema($_REQUEST['export_type']);
|
||||
$export = new Export();
|
||||
$export->processExportSchema($_REQUEST['export_type']);
|
||||
|
||||
@ -21,11 +21,26 @@ use PHPUnit\Framework\TestCase;
|
||||
class ExportTest extends TestCase
|
||||
{
|
||||
/**
|
||||
* Test for Export::mergeAliases
|
||||
* @var Export
|
||||
*/
|
||||
private $export;
|
||||
|
||||
/**
|
||||
* Sets up the fixture
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testPMAMergeAliases()
|
||||
protected function setUp()
|
||||
{
|
||||
$this->export = new Export();
|
||||
}
|
||||
|
||||
/**
|
||||
* Test for mergeAliases
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function testMergeAliases()
|
||||
{
|
||||
$aliases1 = array(
|
||||
'test_db' => array(
|
||||
@ -91,7 +106,7 @@ class ExportTest extends TestCase
|
||||
)
|
||||
)
|
||||
);
|
||||
$actual = Export::mergeAliases($aliases1, $aliases2);
|
||||
$actual = $this->export->mergeAliases($aliases1, $aliases2);
|
||||
$this->assertEquals($expected, $actual);
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user