diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index c2ae2c35c4..c0f631456c 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -9436,7 +9436,7 @@ parameters: path: src/Plugins/Export/ExportPdf.php - - message: '#^Parameter \#1 \$line of callable PhpMyAdmin\\Export\\OutputHandler expects string, mixed given\.$#' + message: '#^Parameter \#1 \$line of method PhpMyAdmin\\Export\\OutputHandler\:\:addLine\(\) expects string, mixed given\.$#' identifier: argument.type count: 1 path: src/Plugins/Export/ExportPdf.php diff --git a/src/Export/OutputHandler.php b/src/Export/OutputHandler.php index 8cd4c72534..7f4c47482d 100644 --- a/src/Export/OutputHandler.php +++ b/src/Export/OutputHandler.php @@ -51,7 +51,7 @@ class OutputHandler public bool $onFlyCompression = false; public int $timeStart = 0; - public function __invoke(string $line): bool + public function addLine(string $line): bool { // Kanji encoding convert feature if ($this->outputKanjiConversion) { diff --git a/src/Plugins.php b/src/Plugins.php index 1579b905d3..b63accb756 100644 --- a/src/Plugins.php +++ b/src/Plugins.php @@ -78,7 +78,7 @@ class Plugins /** @psalm-suppress MixedMethodCall */ return new $class( $container->get(Relation::class), - $container->get(Export::class), + $container->get(Export::class)->outputHandler, $container->get(Transformations::class), ); } @@ -158,7 +158,7 @@ class Plugins $container = ContainerBuilder::getContainer(); $plugins[] = new $class( $container->get(Relation::class), - $container->get(Export::class), + $container->get(Export::class)->outputHandler, $container->get(Transformations::class), ); } elseif ($type === 'Import' && is_subclass_of($class, ImportPlugin::class)) { diff --git a/src/Plugins/Export/ExportCodegen.php b/src/Plugins/Export/ExportCodegen.php index c5f5898c33..8ae0d7182a 100644 --- a/src/Plugins/Export/ExportCodegen.php +++ b/src/Plugins/Export/ExportCodegen.php @@ -97,10 +97,10 @@ class ExportCodegen extends ExportPlugin array $aliases = [], ): bool { if ($this->format === self::HANDLER_NHIBERNATE_XML) { - return ($this->export->outputHandler)($this->handleNHibernateXMLBody($db, $table, $aliases)); + return $this->outputHandler->addLine($this->handleNHibernateXMLBody($db, $table, $aliases)); } - return ($this->export->outputHandler)($this->handleNHibernateCSBody($db, $table, $aliases)); + return $this->outputHandler->addLine($this->handleNHibernateCSBody($db, $table, $aliases)); } /** diff --git a/src/Plugins/Export/ExportCsv.php b/src/Plugins/Export/ExportCsv.php index 89309c314f..9c6c10d5f7 100644 --- a/src/Plugins/Export/ExportCsv.php +++ b/src/Plugins/Export/ExportCsv.php @@ -164,7 +164,7 @@ class ExportCsv extends ExportPlugin } $schemaInsert = implode($this->separator, $insertFields); - if (! ($this->export->outputHandler)($schemaInsert . $this->terminated)) { + if (! $this->outputHandler->addLine($schemaInsert . $this->terminated)) { return false; } } @@ -218,7 +218,7 @@ class ExportCsv extends ExportPlugin } $schemaInsert = implode($this->separator, $insertValues); - if (! ($this->export->outputHandler)($schemaInsert . $this->terminated)) { + if (! $this->outputHandler->addLine($schemaInsert . $this->terminated)) { return false; } } diff --git a/src/Plugins/Export/ExportExcel.php b/src/Plugins/Export/ExportExcel.php index 7ae97d3e10..9821527ca4 100644 --- a/src/Plugins/Export/ExportExcel.php +++ b/src/Plugins/Export/ExportExcel.php @@ -155,7 +155,7 @@ class ExportExcel extends ExportPlugin } $schemaInsert = implode($this->separator, $insertFields); - if (! ($this->export->outputHandler)($schemaInsert . $this->terminated)) { + if (! $this->outputHandler->addLine($schemaInsert . $this->terminated)) { return false; } } @@ -206,7 +206,7 @@ class ExportExcel extends ExportPlugin } $schemaInsert = implode($this->separator, $insertValues); - if (! ($this->export->outputHandler)($schemaInsert . $this->terminated)) { + if (! $this->outputHandler->addLine($schemaInsert . $this->terminated)) { return false; } } diff --git a/src/Plugins/Export/ExportHtmlword.php b/src/Plugins/Export/ExportHtmlword.php index 311bfb9fe8..bf5466f3ea 100644 --- a/src/Plugins/Export/ExportHtmlword.php +++ b/src/Plugins/Export/ExportHtmlword.php @@ -106,7 +106,7 @@ class ExportHtmlword extends ExportPlugin */ public function exportHeader(): bool { - return ($this->export->outputHandler)( + return $this->outputHandler->addLine( ' @@ -127,7 +127,7 @@ class ExportHtmlword extends ExportPlugin */ public function exportFooter(): bool { - return ($this->export->outputHandler)(''); + return $this->outputHandler->addLine(''); } /** @@ -142,7 +142,7 @@ class ExportHtmlword extends ExportPlugin $dbAlias = $db; } - return ($this->export->outputHandler)( + return $this->outputHandler->addLine( '

' . __('Database') . ' ' . htmlspecialchars($dbAlias) . '

', ); } @@ -164,7 +164,7 @@ class ExportHtmlword extends ExportPlugin $tableAlias = $this->getTableAlias($aliases, $db, $table); if ( - ! ($this->export->outputHandler)( + ! $this->outputHandler->addLine( '

' . __('Dumping data for table') . ' ' . htmlspecialchars($tableAlias) . '

', @@ -173,7 +173,7 @@ class ExportHtmlword extends ExportPlugin return false; } - if (! ($this->export->outputHandler)('')) { + if (! $this->outputHandler->addLine('
')) { return false; } @@ -195,7 +195,7 @@ class ExportHtmlword extends ExportPlugin } $schemaInsert .= ''; - if (! ($this->export->outputHandler)($schemaInsert)) { + if (! $this->outputHandler->addLine($schemaInsert)) { return false; } } @@ -210,12 +210,12 @@ class ExportHtmlword extends ExportPlugin } $schemaInsert .= ''; - if (! ($this->export->outputHandler)($schemaInsert)) { + if (! $this->outputHandler->addLine($schemaInsert)) { return false; } } - return ($this->export->outputHandler)('
'); + return $this->outputHandler->addLine(''); } /** @@ -480,7 +480,7 @@ class ExportHtmlword extends ExportPlugin $dump .= $this->getTableDefStandIn($db, $table, $aliases); } - return ($this->export->outputHandler)($dump); + return $this->outputHandler->addLine($dump); } /** diff --git a/src/Plugins/Export/ExportJson.php b/src/Plugins/Export/ExportJson.php index 16b821fda7..06ef02a770 100644 --- a/src/Plugins/Export/ExportJson.php +++ b/src/Plugins/Export/ExportJson.php @@ -116,7 +116,7 @@ class ExportJson extends ExportPlugin return false; } - return ($this->export->outputHandler)('[' . "\n" . $data . ',' . "\n"); + return $this->outputHandler->addLine('[' . "\n" . $data . ',' . "\n"); } /** @@ -124,7 +124,7 @@ class ExportJson extends ExportPlugin */ public function exportFooter(): bool { - return ($this->export->outputHandler)(']' . "\n"); + return $this->outputHandler->addLine(']' . "\n"); } /** @@ -144,7 +144,7 @@ class ExportJson extends ExportPlugin return false; } - return ($this->export->outputHandler)($data . ',' . "\n"); + return $this->outputHandler->addLine($data . ',' . "\n"); } /** @@ -165,7 +165,7 @@ class ExportJson extends ExportPlugin $tableAlias = $this->getTableAlias($aliases, $db, $table); if (! $this->first) { - if (! ($this->export->outputHandler)(',')) { + if (! $this->outputHandler->addLine(',')) { return false; } } else { @@ -208,7 +208,7 @@ class ExportJson extends ExportPlugin ): bool { [$header, $footer] = explode('"@@DATA@@"', $buffer); - if (! ($this->export->outputHandler)($header . "\n" . '[' . "\n")) { + if (! $this->outputHandler->addLine($header . "\n" . '[' . "\n")) { return false; } @@ -234,7 +234,7 @@ class ExportJson extends ExportPlugin // Output table name as comment if this is the first record of the table if ($recordCnt > 1) { - if (! ($this->export->outputHandler)(',' . "\n")) { + if (! $this->outputHandler->addLine(',' . "\n")) { return false; } } @@ -272,12 +272,12 @@ class ExportJson extends ExportPlugin return false; } - if (! ($this->export->outputHandler)($encodedData)) { + if (! $this->outputHandler->addLine($encodedData)) { return false; } } - return ($this->export->outputHandler)("\n" . ']' . "\n" . $footer . "\n"); + return $this->outputHandler->addLine("\n" . ']' . "\n" . $footer . "\n"); } /** diff --git a/src/Plugins/Export/ExportLatex.php b/src/Plugins/Export/ExportLatex.php index cb76cd0a51..7db719e11c 100644 --- a/src/Plugins/Export/ExportLatex.php +++ b/src/Plugins/Export/ExportLatex.php @@ -233,7 +233,7 @@ class ExportLatex extends ExportPlugin . '% ' . __('Server version:') . ' ' . DatabaseInterface::getInstance()->getVersionString() . "\n" . '% ' . __('PHP Version:') . ' ' . PHP_VERSION . "\n"; - return ($this->export->outputHandler)($head); + return $this->outputHandler->addLine($head); } /** @@ -252,7 +252,7 @@ class ExportLatex extends ExportPlugin . '% ' . __('Database:') . ' \'' . $dbAlias . '\'' . "\n" . '% ' . "\n"; - return ($this->export->outputHandler)($head); + return $this->outputHandler->addLine($head); } /** @@ -309,7 +309,7 @@ class ExportLatex extends ExportPlugin . '} \\\\'; } - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } @@ -322,13 +322,13 @@ class ExportLatex extends ExportPlugin } $buffer = mb_substr($buffer, 0, -2) . '\\\\ \\hline \hline '; - if (! ($this->export->outputHandler)($buffer . ' \\endfirsthead ' . "\n")) { + if (! $this->outputHandler->addLine($buffer . ' \\endfirsthead ' . "\n")) { return false; } if ($this->caption) { if ( - ! ($this->export->outputHandler)( + ! $this->outputHandler->addLine( '\\caption{' . Util::expandUserString( $this->dataContinuedCaption, @@ -342,10 +342,10 @@ class ExportLatex extends ExportPlugin } } - if (! ($this->export->outputHandler)($buffer . '\\endhead \\endfoot' . "\n")) { + if (! $this->outputHandler->addLine($buffer . '\\endhead \\endfoot' . "\n")) { return false; } - } elseif (! ($this->export->outputHandler)('\\\\ \hline')) { + } elseif (! $this->outputHandler->addLine('\\\\ \hline')) { return false; } @@ -370,14 +370,14 @@ class ExportLatex extends ExportPlugin } $buffer .= ' \\\\ \\hline ' . "\n"; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } } $buffer = ' \\end{longtable}' . "\n"; - return ($this->export->outputHandler)($buffer); + return $this->outputHandler->addLine($buffer); } /** @@ -443,7 +443,7 @@ class ExportLatex extends ExportPlugin */ $buffer = "\n" . '%' . "\n" . '% ' . __('Structure:') . ' ' . $tableAlias . "\n" . '%' . "\n" . ' \\begin{longtable}{'; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } @@ -513,7 +513,7 @@ class ExportLatex extends ExportPlugin $buffer .= $header . ' \\\\ \\hline \\hline \\endhead \\endfoot ' . "\n"; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } @@ -565,14 +565,14 @@ class ExportLatex extends ExportPlugin $buffer = str_replace("\000", ' & ', $localBuffer); $buffer .= ' \\\\ \\hline ' . "\n"; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } } $buffer = ' \\end{longtable}' . "\n"; - return ($this->export->outputHandler)($buffer); + return $this->outputHandler->addLine($buffer); } /** diff --git a/src/Plugins/Export/ExportMediawiki.php b/src/Plugins/Export/ExportMediawiki.php index 75be7b74e0..6bc5abb086 100644 --- a/src/Plugins/Export/ExportMediawiki.php +++ b/src/Plugins/Export/ExportMediawiki.php @@ -166,7 +166,7 @@ class ExportMediawiki extends ExportPlugin $output .= '|}' . str_repeat($this->exportCRLF(), 2); } - return ($this->export->outputHandler)($output); + return $this->outputHandler->addLine($output); } /** @@ -240,7 +240,7 @@ class ExportMediawiki extends ExportPlugin // End table construction $output .= '|}' . str_repeat($this->exportCRLF(), 2); - return ($this->export->outputHandler)($output); + return $this->outputHandler->addLine($output); } /** diff --git a/src/Plugins/Export/ExportOds.php b/src/Plugins/Export/ExportOds.php index d8dc2c45c1..ada82672b5 100644 --- a/src/Plugins/Export/ExportOds.php +++ b/src/Plugins/Export/ExportOds.php @@ -142,7 +142,7 @@ class ExportOds extends ExportPlugin { $this->buffer .= ''; - return ($this->export->outputHandler)( + return $this->outputHandler->addLine( OpenDocument::create('application/vnd.oasis.opendocument.spreadsheet', $this->buffer), ); } diff --git a/src/Plugins/Export/ExportOdt.php b/src/Plugins/Export/ExportOdt.php index f67377fc89..b5db5fae69 100644 --- a/src/Plugins/Export/ExportOdt.php +++ b/src/Plugins/Export/ExportOdt.php @@ -163,7 +163,7 @@ class ExportOdt extends ExportPlugin { $this->buffer .= ''; - return ($this->export->outputHandler)(OpenDocument::create( + return $this->outputHandler->addLine(OpenDocument::create( 'application/vnd.oasis.opendocument.text', $this->buffer, )); diff --git a/src/Plugins/Export/ExportPdf.php b/src/Plugins/Export/ExportPdf.php index 7da6bf7be9..a834652401 100644 --- a/src/Plugins/Export/ExportPdf.php +++ b/src/Plugins/Export/ExportPdf.php @@ -104,7 +104,7 @@ class ExportPdf extends ExportPlugin public function exportFooter(): bool { // instead of $pdf->Output(): - return ($this->export->outputHandler)($this->pdf->getPDFData()); + return $this->outputHandler->addLine($this->pdf->getPDFData()); } /** diff --git a/src/Plugins/Export/ExportPhparray.php b/src/Plugins/Export/ExportPhparray.php index 2e010ad2c9..255b435b01 100644 --- a/src/Plugins/Export/ExportPhparray.php +++ b/src/Plugins/Export/ExportPhparray.php @@ -78,7 +78,7 @@ class ExportPhparray extends ExportPlugin */ public function exportHeader(): bool { - ($this->export->outputHandler)( + $this->outputHandler->addLine( 'export->outputHandler)( + $this->outputHandler->addLine( '/**' . "\n" . ' * Database ' . $this->commentString(Util::backquote($dbAlias)) . "\n" . ' */' . "\n", @@ -160,7 +160,7 @@ class ExportPhparray extends ExportPlugin . $this->commentString(Util::backquote($dbAlias)) . '.' . $this->commentString(Util::backquote($tableAlias)) . ' */' . "\n"; $buffer .= '$' . $tableFixed . ' = array('; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } @@ -183,7 +183,7 @@ class ExportPhparray extends ExportPlugin } $buffer .= ')'; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } @@ -193,7 +193,7 @@ class ExportPhparray extends ExportPlugin $buffer .= "\n" . ');' . "\n"; - return ($this->export->outputHandler)($buffer); + return $this->outputHandler->addLine($buffer); } /** diff --git a/src/Plugins/Export/ExportSql.php b/src/Plugins/Export/ExportSql.php index 003ad3869f..b0d070e90f 100644 --- a/src/Plugins/Export/ExportSql.php +++ b/src/Plugins/Export/ExportSql.php @@ -650,7 +650,7 @@ class ExportSql extends ExportPlugin } if ($text !== '') { - return ($this->export->outputHandler)($text); + return $this->outputHandler->addLine($text); } return false; @@ -733,7 +733,7 @@ class ExportSql extends ExportPlugin DatabaseInterface::getInstance()->query('SET time_zone = "' . self::$oldTimezone . '"'); } - return ($this->export->outputHandler)($foot); + return $this->outputHandler->addLine($foot); } /** @@ -829,7 +829,7 @@ class ExportSql extends ExportPlugin $this->sentCharset = true; } - return ($this->export->outputHandler)($head); + return $this->outputHandler->addLine($head); } /** @@ -846,7 +846,7 @@ class ExportSql extends ExportPlugin if ($this->structureOrData !== StructureOrData::Data && $this->dropDatabase) { if ( - ! ($this->export->outputHandler)( + ! $this->outputHandler->addLine( 'DROP DATABASE IF EXISTS ' . Util::backquoteCompat($dbAlias, $this->compatibility, $this->useSqlBackquotes) . ';' . "\n", @@ -876,7 +876,7 @@ class ExportSql extends ExportPlugin } $createQuery .= ';' . "\n"; - if (! ($this->export->outputHandler)($createQuery)) { + if (! $this->outputHandler->addLine($createQuery)) { return false; } @@ -892,14 +892,14 @@ class ExportSql extends ExportPlugin private function exportUseStatement(string $db, string $compat): bool { if ($compat === 'NONE') { - return ($this->export->outputHandler)( + return $this->outputHandler->addLine( 'USE ' . Util::backquoteCompat($db, $compat, $this->useSqlBackquotes) . ';' . "\n", ); } - return ($this->export->outputHandler)('USE ' . $db . ';' . "\n"); + return $this->outputHandler->addLine('USE ' . $db . ';' . "\n"); } /** @@ -925,7 +925,7 @@ class ExportSql extends ExportPlugin ) . $this->exportComment(); - return ($this->export->outputHandler)($head); + return $this->outputHandler->addLine($head); } /** @@ -939,25 +939,25 @@ class ExportSql extends ExportPlugin //add indexes to the sql dump file if ($this->sqlIndexes !== null) { - $result = ($this->export->outputHandler)($this->sqlIndexes); + $result = $this->outputHandler->addLine($this->sqlIndexes); $this->sqlIndexes = null; } //add auto increments to the sql dump file if ($this->sqlAutoIncrements !== null) { - $result = ($this->export->outputHandler)($this->sqlAutoIncrements); + $result = $this->outputHandler->addLine($this->sqlAutoIncrements); $this->sqlAutoIncrements = null; } //add views to the sql dump file if ($this->sqlViews !== '') { - $result = ($this->export->outputHandler)($this->sqlViews); + $result = $this->outputHandler->addLine($this->sqlViews); $this->sqlViews = ''; } //add constraints to the sql dump file if ($this->sqlConstraints !== null) { - $result = ($this->export->outputHandler)($this->sqlConstraints); + $result = $this->outputHandler->addLine($this->sqlConstraints); $this->sqlConstraints = null; } @@ -1015,7 +1015,7 @@ class ExportSql extends ExportPlugin } if ($text !== '') { - return ($this->export->outputHandler)($text); + return $this->outputHandler->addLine($text); } return false; @@ -1043,7 +1043,7 @@ class ExportSql extends ExportPlugin . $this->exportComment() . $this->exportComment(__('Metadata')) . $this->exportComment(); - if (! ($this->export->outputHandler)($comment)) { + if (! $this->outputHandler->addLine($comment)) { return false; } @@ -1121,7 +1121,7 @@ class ExportSql extends ExportPlugin $comment .= $this->exportComment(); - if (! ($this->export->outputHandler)($comment)) { + if (! $this->outputHandler->addLine($comment)) { return false; } @@ -1166,7 +1166,7 @@ class ExportSql extends ExportPlugin $lastPage = "\n" . 'SET @LAST_PAGE = LAST_INSERT_ID();' . "\n"; - if (! ($this->export->outputHandler)($lastPage)) { + if (! $this->outputHandler->addLine($lastPage)) { return false; } @@ -1975,7 +1975,7 @@ class ExportSql extends ExportPlugin // but not in the case of export $this->sqlConstraintsQuery = ''; - return ($this->export->outputHandler)($dump); + return $this->outputHandler->addLine($dump); } /** @@ -2012,7 +2012,7 @@ class ExportSql extends ExportPlugin . $this->exportComment() . $this->possibleCRLF(); - return ($this->export->outputHandler)($head); + return $this->outputHandler->addLine($head); } $result = $dbi->tryQuery($sqlQuery, ConnectionType::User, DatabaseInterface::QUERY_UNBUFFERED); @@ -2083,8 +2083,8 @@ class ExportSql extends ExportPlugin ) . $this->exportComment() . "\n"; - ($this->export->outputHandler)($truncatehead); - ($this->export->outputHandler)($truncate); + $this->outputHandler->addLine($truncatehead); + $this->outputHandler->addLine($truncate); } // scheme for inserting fields @@ -2120,7 +2120,7 @@ class ExportSql extends ExportPlugin ) . $this->exportComment() . "\n"; - if (! ($this->export->outputHandler)($head)) { + if (! $this->outputHandler->addLine($head)) { return false; } } @@ -2128,7 +2128,7 @@ class ExportSql extends ExportPlugin // We need to SET IDENTITY_INSERT ON for MSSQL if ($currentRow === 0 && $this->compatibility === 'MSSQL') { if ( - ! ($this->export->outputHandler)( + ! $this->outputHandler->addLine( 'SET IDENTITY_INSERT ' . Util::backquoteCompat($tableAlias, $this->compatibility, $this->useSqlBackquotes) . ' ON ;' . "\n", @@ -2207,7 +2207,7 @@ class ExportSql extends ExportPlugin $insertLine = '(' . implode(', ', $values) . ')'; $insertLineSize = mb_strlen($insertLine); if ($this->maxQuerySize > 0 && $querySize + $insertLineSize > $this->maxQuerySize) { - if (! ($this->export->outputHandler)(';' . "\n")) { + if (! $this->outputHandler->addLine(';' . "\n")) { return false; } @@ -2223,20 +2223,20 @@ class ExportSql extends ExportPlugin $insertLine = $schemaInsert . '(' . implode(', ', $values) . ')'; } - if (! ($this->export->outputHandler)(($currentRow === 1 ? '' : $separator . "\n") . $insertLine)) { + if (! $this->outputHandler->addLine(($currentRow === 1 ? '' : $separator . "\n") . $insertLine)) { return false; } } if ($currentRow > 0) { - if (! ($this->export->outputHandler)(';' . "\n")) { + if (! $this->outputHandler->addLine(';' . "\n")) { return false; } } // We need to SET IDENTITY_INSERT OFF for MSSQL if ($this->compatibility === 'MSSQL' && $currentRow > 0) { - $outputSucceeded = ($this->export->outputHandler)( + $outputSucceeded = $this->outputHandler->addLine( "\n" . 'SET IDENTITY_INSERT ' . Util::backquoteCompat($tableAlias, $this->compatibility, $this->useSqlBackquotes) . ' OFF;' . "\n", diff --git a/src/Plugins/Export/ExportTexytext.php b/src/Plugins/Export/ExportTexytext.php index 684583989b..2751ebd7d6 100644 --- a/src/Plugins/Export/ExportTexytext.php +++ b/src/Plugins/Export/ExportTexytext.php @@ -111,7 +111,7 @@ class ExportTexytext extends ExportPlugin $dbAlias = $db; } - return ($this->export->outputHandler)( + return $this->outputHandler->addLine( '===' . __('Database') . ' ' . $dbAlias . "\n\n", ); } @@ -133,7 +133,7 @@ class ExportTexytext extends ExportPlugin $tableAlias = $this->getTableAlias($aliases, $db, $table); if ( - ! ($this->export->outputHandler)( + ! $this->outputHandler->addLine( $tableAlias !== '' ? '== ' . __('Dumping data for table') . ' ' . $tableAlias . "\n\n" : '==' . __('Dumping data for query result') . "\n\n", @@ -158,7 +158,7 @@ class ExportTexytext extends ExportPlugin } $textOutput .= "\n|------\n"; - if (! ($this->export->outputHandler)($textOutput)) { + if (! $this->outputHandler->addLine($textOutput)) { return false; } } @@ -184,7 +184,7 @@ class ExportTexytext extends ExportPlugin } $textOutput .= "\n"; - if (! ($this->export->outputHandler)($textOutput)) { + if (! $this->outputHandler->addLine($textOutput)) { return false; } } @@ -429,7 +429,7 @@ class ExportTexytext extends ExportPlugin $dump .= $this->getTableDefStandIn($db, $table, $aliases); } - return ($this->export->outputHandler)($dump); + return $this->outputHandler->addLine($dump); } /** diff --git a/src/Plugins/Export/ExportXml.php b/src/Plugins/Export/ExportXml.php index d9cf47d748..fd502ba4f5 100644 --- a/src/Plugins/Export/ExportXml.php +++ b/src/Plugins/Export/ExportXml.php @@ -194,7 +194,7 @@ class ExportXml extends ExportPlugin || $this->exportTriggers || $this->exportViews; - $charset = $this->export->outputHandler->outputCharsetConversion ? Current::$charset : 'utf-8'; + $charset = $this->outputHandler->outputCharsetConversion ? Current::$charset : 'utf-8'; $config = Config::getInstance(); $head = '' . "\n" @@ -336,7 +336,7 @@ class ExportXml extends ExportPlugin } } - return ($this->export->outputHandler)($head); + return $this->outputHandler->addLine($head); } /** @@ -346,7 +346,7 @@ class ExportXml extends ExportPlugin { $foot = ''; - return ($this->export->outputHandler)($foot); + return $this->outputHandler->addLine($foot); } /** @@ -368,7 +368,7 @@ class ExportXml extends ExportPlugin . ' -->' . "\n" . ' ' . "\n"; - return ($this->export->outputHandler)($head); + return $this->outputHandler->addLine($head); } return true; @@ -382,7 +382,7 @@ class ExportXml extends ExportPlugin public function exportDBFooter(string $db): bool { if ($this->exportContents) { - return ($this->export->outputHandler)(' ' . "\n"); + return $this->outputHandler->addLine(' ' . "\n"); } return true; @@ -417,7 +417,7 @@ class ExportXml extends ExportPlugin $buffer = ' ' . "\n"; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } @@ -441,7 +441,7 @@ class ExportXml extends ExportPlugin $buffer .= ' ' . "\n"; - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } } diff --git a/src/Plugins/Export/ExportYaml.php b/src/Plugins/Export/ExportYaml.php index dfe7292ed3..fd46f87d6a 100644 --- a/src/Plugins/Export/ExportYaml.php +++ b/src/Plugins/Export/ExportYaml.php @@ -67,7 +67,7 @@ class ExportYaml extends ExportPlugin */ public function exportHeader(): bool { - ($this->export->outputHandler)('%YAML 1.1' . "\n" . '---' . "\n"); + $this->outputHandler->addLine('%YAML 1.1' . "\n" . '---' . "\n"); return true; } @@ -77,7 +77,7 @@ class ExportYaml extends ExportPlugin */ public function exportFooter(): bool { - ($this->export->outputHandler)('...' . "\n"); + $this->outputHandler->addLine('...' . "\n"); return true; } @@ -148,7 +148,7 @@ class ExportYaml extends ExportPlugin $buffer .= ' ' . $columns[$i] . ': "' . $record[$i] . '"' . "\n"; } - if (! ($this->export->outputHandler)($buffer)) { + if (! $this->outputHandler->addLine($buffer)) { return false; } } diff --git a/src/Plugins/ExportPlugin.php b/src/Plugins/ExportPlugin.php index 853a2824a9..487666c431 100644 --- a/src/Plugins/ExportPlugin.php +++ b/src/Plugins/ExportPlugin.php @@ -8,7 +8,7 @@ declare(strict_types=1); namespace PhpMyAdmin\Plugins; use PhpMyAdmin\ConfigStorage\Relation; -use PhpMyAdmin\Export\Export; +use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Export\StructureOrData; use PhpMyAdmin\Http\ServerRequest; use PhpMyAdmin\Properties\Plugins\ExportPluginProperties; @@ -37,7 +37,7 @@ abstract class ExportPlugin implements Plugin final public function __construct( public Relation $relation, - protected Export $export, + protected OutputHandler $outputHandler, public Transformations $transformations, ) { $this->properties = $this->setProperties(); diff --git a/tests/unit/Export/ExportTest.php b/tests/unit/Export/ExportTest.php index cbc6293acb..37566e4764 100644 --- a/tests/unit/Export/ExportTest.php +++ b/tests/unit/Export/ExportTest.php @@ -69,7 +69,7 @@ class ExportTest extends AbstractTestCase DatabaseInterface::$instance = $dbi; $export = new Export($dbi); $relation = new Relation($dbi); - $exportPlugin = new ExportPhparray($relation, new Export($dbi), new Transformations($dbi, $relation)); + $exportPlugin = new ExportPhparray($relation, $export->outputHandler, new Transformations($dbi, $relation)); $export->outputHandler->setCompression('zip'); $finalFileName = $export->getFinalFilename($exportPlugin, 'myfilename'); @@ -88,7 +88,7 @@ class ExportTest extends AbstractTestCase DatabaseInterface::$instance = $dbi; $export = new Export($dbi); $relation = new Relation($dbi); - $exportPlugin = new ExportPhparray($relation, new Export($dbi), new Transformations($dbi, $relation)); + $exportPlugin = new ExportPhparray($relation, $export->outputHandler, new Transformations($dbi, $relation)); $export->outputHandler->setCompression('zip'); $mimeType = $export->getMimeType($exportPlugin); @@ -138,7 +138,7 @@ class ExportTest extends AbstractTestCase ['test_table'], ['test_table'], ['test_table'], - new ExportSql($relation, $export, new Transformations($dbi, $relation)), + new ExportSql($relation, $export->outputHandler, new Transformations($dbi, $relation)), [], '', ); @@ -208,7 +208,7 @@ class ExportTest extends AbstractTestCase $relation = new Relation($dbi); $export->exportServer( ['test_db'], - new ExportSql($relation, $export, new Transformations($dbi, $relation)), + new ExportSql($relation, $export->outputHandler, new Transformations($dbi, $relation)), [], '', ); diff --git a/tests/unit/Plugins/Export/ExportCodegenTest.php b/tests/unit/Plugins/Export/ExportCodegenTest.php index a2148531bb..d1f06bf011 100644 --- a/tests/unit/Plugins/Export/ExportCodegenTest.php +++ b/tests/unit/Plugins/Export/ExportCodegenTest.php @@ -6,7 +6,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportCodegen; @@ -41,7 +40,7 @@ class ExportCodegenTest extends AbstractTestCase $dbi = $this->createDatabaseInterface(); DatabaseInterface::$instance = $dbi; $relation = new Relation($dbi); - $this->object = new ExportCodegen($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportCodegen($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportCsvTest.php b/tests/unit/Plugins/Export/ExportCsvTest.php index 3504de5343..187fd70920 100644 --- a/tests/unit/Plugins/Export/ExportCsvTest.php +++ b/tests/unit/Plugins/Export/ExportCsvTest.php @@ -7,7 +7,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportCsv; @@ -47,7 +46,7 @@ class ExportCsvTest extends AbstractTestCase Current::$lang = ''; $relation = new Relation($dbi); - $this->object = new ExportCsv($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportCsv($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportExcelTest.php b/tests/unit/Plugins/Export/ExportExcelTest.php index a2530482d0..2024943c8f 100644 --- a/tests/unit/Plugins/Export/ExportExcelTest.php +++ b/tests/unit/Plugins/Export/ExportExcelTest.php @@ -6,7 +6,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportExcel; @@ -43,7 +42,7 @@ class ExportExcelTest extends AbstractTestCase $dbi = $this->createDatabaseInterface(); DatabaseInterface::$instance = $dbi; $relation = new Relation($dbi); - $this->object = new ExportExcel($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportExcel($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportHtmlwordTest.php b/tests/unit/Plugins/Export/ExportHtmlwordTest.php index b364f557ca..529ddebfa7 100644 --- a/tests/unit/Plugins/Export/ExportHtmlwordTest.php +++ b/tests/unit/Plugins/Export/ExportHtmlwordTest.php @@ -10,7 +10,6 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Identifiers\TableName; @@ -61,7 +60,7 @@ class ExportHtmlwordTest extends AbstractTestCase $relation = new Relation($this->dbi); $this->object = new ExportHtmlword( $relation, - new Export($this->dbi), + new OutputHandler(), new Transformations($this->dbi, $relation), ); OutputHandler::$asFile = true; @@ -372,7 +371,7 @@ class ExportHtmlwordTest extends AbstractTestCase $relation = new Relation($this->dbi); $this->object = $this->getMockBuilder(ExportHtmlword::class) ->onlyMethods(['formatOneColumnDefinition']) - ->setConstructorArgs([$relation, new Export($this->dbi), new Transformations($this->dbi, $relation)]) + ->setConstructorArgs([$relation, new OutputHandler(), new Transformations($this->dbi, $relation)]) ->getMock(); $keys = [['Non_unique' => 0, 'Column_name' => 'name1'], ['Non_unique' => 1, 'Column_name' => 'name2']]; diff --git a/tests/unit/Plugins/Export/ExportJsonTest.php b/tests/unit/Plugins/Export/ExportJsonTest.php index c18f88266b..5184e6911c 100644 --- a/tests/unit/Plugins/Export/ExportJsonTest.php +++ b/tests/unit/Plugins/Export/ExportJsonTest.php @@ -6,7 +6,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Plugins\Export\ExportJson; use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup; @@ -38,7 +37,7 @@ class ExportJsonTest extends AbstractTestCase DatabaseInterface::$instance = $dbi; OutputHandler::$asFile = true; $relation = new Relation($dbi); - $this->object = new ExportJson($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportJson($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportLatexTest.php b/tests/unit/Plugins/Export/ExportLatexTest.php index 8a44353ec1..6656d2f341 100644 --- a/tests/unit/Plugins/Export/ExportLatexTest.php +++ b/tests/unit/Plugins/Export/ExportLatexTest.php @@ -10,7 +10,6 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportLatex; @@ -56,7 +55,7 @@ class ExportLatexTest extends AbstractTestCase Current::$database = 'db'; Current::$table = 'table'; $relation = new Relation($dbi); - $this->object = new ExportLatex($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportLatex($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportMediawikiTest.php b/tests/unit/Plugins/Export/ExportMediawikiTest.php index db78381b01..bec7303ca9 100644 --- a/tests/unit/Plugins/Export/ExportMediawikiTest.php +++ b/tests/unit/Plugins/Export/ExportMediawikiTest.php @@ -8,7 +8,6 @@ use PhpMyAdmin\Column; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportMediawiki; @@ -49,7 +48,7 @@ class ExportMediawikiTest extends AbstractTestCase Current::$table = ''; Current::$lang = 'en'; $relation = new Relation($dbi); - $this->object = new ExportMediawiki($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportMediawiki($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportOdsTest.php b/tests/unit/Plugins/Export/ExportOdsTest.php index 030410849a..8c66794bad 100644 --- a/tests/unit/Plugins/Export/ExportOdsTest.php +++ b/tests/unit/Plugins/Export/ExportOdsTest.php @@ -7,7 +7,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Dbal\ConnectionType; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportOds; @@ -55,7 +54,7 @@ class ExportOdsTest extends AbstractTestCase DatabaseInterface::$instance = $dbi; OutputHandler::$asFile = true; $relation = new Relation($dbi); - $this->object = new ExportOds($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportOds($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportOdtTest.php b/tests/unit/Plugins/Export/ExportOdtTest.php index 49c668e552..76adf29f23 100644 --- a/tests/unit/Plugins/Export/ExportOdtTest.php +++ b/tests/unit/Plugins/Export/ExportOdtTest.php @@ -10,7 +10,6 @@ use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\Dbal\ConnectionType; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Identifiers\TableName; @@ -73,7 +72,7 @@ class ExportOdtTest extends AbstractTestCase ExportPlugin::$singleTable = false; Config::getInstance()->selectedServer['DisableIS'] = true; $relation = new Relation($this->dbi); - $this->object = new ExportOdt($relation, new Export($this->dbi), new Transformations($this->dbi, $relation)); + $this->object = new ExportOdt($relation, new OutputHandler(), new Transformations($this->dbi, $relation)); } /** @@ -571,7 +570,7 @@ class ExportOdtTest extends AbstractTestCase $relation = new Relation($this->dbi); $this->object = $this->getMockBuilder(ExportOdt::class) ->onlyMethods(['formatOneColumnDefinition']) - ->setConstructorArgs([$relation, new Export($this->dbi), new Transformations($this->dbi, $relation)]) + ->setConstructorArgs([$relation, new OutputHandler(), new Transformations($this->dbi, $relation)]) ->getMock(); // case 1 diff --git a/tests/unit/Plugins/Export/ExportPdfTest.php b/tests/unit/Plugins/Export/ExportPdfTest.php index 2641ce7143..9efbdf47de 100644 --- a/tests/unit/Plugins/Export/ExportPdfTest.php +++ b/tests/unit/Plugins/Export/ExportPdfTest.php @@ -6,7 +6,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportPdf; @@ -42,7 +41,7 @@ class ExportPdfTest extends AbstractTestCase DatabaseInterface::$instance = $dbi; OutputHandler::$asFile = true; $relation = new Relation($dbi); - $this->object = new ExportPdf($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportPdf($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportPhparrayTest.php b/tests/unit/Plugins/Export/ExportPhparrayTest.php index 974dda4c72..671854ad49 100644 --- a/tests/unit/Plugins/Export/ExportPhparrayTest.php +++ b/tests/unit/Plugins/Export/ExportPhparrayTest.php @@ -7,7 +7,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Plugins\Export\ExportPhparray; use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup; @@ -44,7 +43,7 @@ class ExportPhparrayTest extends AbstractTestCase Current::$table = ''; Current::$lang = 'en'; $relation = new Relation($dbi); - $this->object = new ExportPhparray($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportPhparray($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportSqlTest.php b/tests/unit/Plugins/Export/ExportSqlTest.php index 35bdf6d17b..01e1767245 100644 --- a/tests/unit/Plugins/Export/ExportSqlTest.php +++ b/tests/unit/Plugins/Export/ExportSqlTest.php @@ -12,7 +12,6 @@ use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\ConnectionType; use PhpMyAdmin\Dbal\DatabaseInterface; use PhpMyAdmin\Exceptions\ExportException; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportSql; @@ -73,7 +72,7 @@ class ExportSqlTest extends AbstractTestCase ExportPlugin::$singleTable = false; $relation = new Relation($dbi); - $this->object = new ExportSql($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportSql($relation, new OutputHandler(), new Transformations($dbi, $relation)); $this->object->useSqlBackquotes(false); } @@ -883,7 +882,7 @@ class ExportSqlTest extends AbstractTestCase DatabaseInterface::$instance = $dbi; $relation = new Relation($dbi); - $this->object = new ExportSql($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportSql($relation, new OutputHandler(), new Transformations($dbi, $relation)); $this->object->useSqlBackquotes(false); $request = ServerRequestFactory::create()->createServerRequest('POST', 'https://example.com/') diff --git a/tests/unit/Plugins/Export/ExportTexytextTest.php b/tests/unit/Plugins/Export/ExportTexytextTest.php index d480c20741..a9b4452baa 100644 --- a/tests/unit/Plugins/Export/ExportTexytextTest.php +++ b/tests/unit/Plugins/Export/ExportTexytextTest.php @@ -11,7 +11,6 @@ use PhpMyAdmin\ConfigStorage\RelationParameters; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\ConnectionType; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Identifiers\TableName; @@ -69,7 +68,7 @@ class ExportTexytextTest extends AbstractTestCase $relation = new Relation($this->dbi); $this->object = new ExportTexytext( $relation, - new Export($this->dbi), + new OutputHandler(), new Transformations($this->dbi, $relation), ); } @@ -261,7 +260,7 @@ class ExportTexytextTest extends AbstractTestCase $relation = new Relation($this->dbi); $this->object = $this->getMockBuilder(ExportTexytext::class) ->onlyMethods(['formatOneColumnDefinition']) - ->setConstructorArgs([$relation, new Export($this->dbi), new Transformations($this->dbi, $relation)]) + ->setConstructorArgs([$relation, new OutputHandler(), new Transformations($this->dbi, $relation)]) ->getMock(); // case 1 diff --git a/tests/unit/Plugins/Export/ExportXmlTest.php b/tests/unit/Plugins/Export/ExportXmlTest.php index e2de0ff5db..e7ae76342e 100644 --- a/tests/unit/Plugins/Export/ExportXmlTest.php +++ b/tests/unit/Plugins/Export/ExportXmlTest.php @@ -8,7 +8,6 @@ use PhpMyAdmin\Config; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Http\Factory\ServerRequestFactory; use PhpMyAdmin\Plugins\Export\ExportXml; @@ -50,7 +49,7 @@ class ExportXmlTest extends AbstractTestCase Current::$database = 'db'; Config::getInstance()->selectedServer['DisableIS'] = true; $relation = new Relation($dbi); - $this->object = new ExportXml($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportXml($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/Plugins/Export/ExportYamlTest.php b/tests/unit/Plugins/Export/ExportYamlTest.php index cf0256701d..e0623776a9 100644 --- a/tests/unit/Plugins/Export/ExportYamlTest.php +++ b/tests/unit/Plugins/Export/ExportYamlTest.php @@ -7,7 +7,6 @@ namespace PhpMyAdmin\Tests\Plugins\Export; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Current; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Plugins\Export\ExportYaml; use PhpMyAdmin\Properties\Options\Groups\OptionsPropertyMainGroup; @@ -44,7 +43,7 @@ class ExportYamlTest extends AbstractTestCase Current::$table = ''; Current::$lang = 'en'; $relation = new Relation($dbi); - $this->object = new ExportYaml($relation, new Export($dbi), new Transformations($dbi, $relation)); + $this->object = new ExportYaml($relation, new OutputHandler(), new Transformations($dbi, $relation)); } /** diff --git a/tests/unit/PluginsTest.php b/tests/unit/PluginsTest.php index 452782d696..6076ba453d 100644 --- a/tests/unit/PluginsTest.php +++ b/tests/unit/PluginsTest.php @@ -7,7 +7,7 @@ namespace PhpMyAdmin\Tests; use PhpMyAdmin\Config; use PhpMyAdmin\ConfigStorage\Relation; use PhpMyAdmin\Dbal\DatabaseInterface; -use PhpMyAdmin\Export\Export; +use PhpMyAdmin\Export\OutputHandler; use PhpMyAdmin\Import\ImportSettings; use PhpMyAdmin\Plugins; use PhpMyAdmin\Plugins\ExportPlugin; @@ -105,12 +105,12 @@ class PluginsTest extends AbstractTestCase $dbi = DatabaseInterface::getInstance(); $relation = new Relation($dbi); $transformations = new Transformations($dbi, $relation); - $export = new Export($dbi); + $outputHandler = new OutputHandler(); $exportList = [ - new Plugins\Export\ExportJson($relation, $export, $transformations), - new Plugins\Export\ExportOds($relation, $export, $transformations), - new Plugins\Export\ExportSql($relation, $export, $transformations), - new Plugins\Export\ExportXml($relation, $export, $transformations), + new Plugins\Export\ExportJson($relation, $outputHandler, $transformations), + new Plugins\Export\ExportOds($relation, $outputHandler, $transformations), + new Plugins\Export\ExportSql($relation, $outputHandler, $transformations), + new Plugins\Export\ExportXml($relation, $outputHandler, $transformations), ]; $actual = Plugins::getChoice($exportList, 'xml'); $expected = [