Remove the buffer_needed global variable
Replaces it with Export::$bufferNeeded static property. Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
716c4bb9d3
commit
b3df04bcf8
@ -7635,7 +7635,7 @@ parameters:
|
||||
-
|
||||
message: '#^Only booleans are allowed in an if condition, mixed given\.$#'
|
||||
identifier: if.condNotBoolean
|
||||
count: 3
|
||||
count: 2
|
||||
path: src/Export/Export.php
|
||||
|
||||
-
|
||||
|
||||
@ -39,7 +39,6 @@
|
||||
|
||||
<globals>
|
||||
<var name="GLOBALS" type="array{
|
||||
buffer_needed: bool,
|
||||
cached_affected_rows: int|numeric-string,
|
||||
charset: string,
|
||||
complete_query: string,
|
||||
|
||||
@ -50,7 +50,6 @@ final class ExportController implements InvocableController
|
||||
public function __invoke(ServerRequest $request): Response
|
||||
{
|
||||
$GLOBALS['compression'] ??= null;
|
||||
$GLOBALS['buffer_needed'] ??= null;
|
||||
$GLOBALS['file_handle'] ??= null;
|
||||
$GLOBALS['output_kanji_conversion'] ??= null;
|
||||
$GLOBALS['single_table'] ??= null;
|
||||
@ -120,7 +119,7 @@ final class ExportController implements InvocableController
|
||||
*/
|
||||
$GLOBALS['compression'] = '';
|
||||
Export::$saveOnServer = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
$GLOBALS['save_filename'] = '';
|
||||
$GLOBALS['file_handle'] = '';
|
||||
$filename = '';
|
||||
@ -139,7 +138,7 @@ final class ExportController implements InvocableController
|
||||
|
||||
if (in_array($compressionParam, $compressionMethods, true)) {
|
||||
$GLOBALS['compression'] = $compressionParam;
|
||||
$GLOBALS['buffer_needed'] = true;
|
||||
Export::$bufferNeeded = true;
|
||||
}
|
||||
|
||||
if (($isQuickExport && $quickExportOnServer) || (! $isQuickExport && $onServerParam)) {
|
||||
|
||||
@ -77,6 +77,7 @@ class Export
|
||||
public static bool $asFile = false;
|
||||
public static bool $saveOnServer = false;
|
||||
public static bool $outputCharsetConversion = false;
|
||||
public static bool $bufferNeeded = false;
|
||||
|
||||
public function __construct(private DatabaseInterface $dbi)
|
||||
{
|
||||
@ -144,7 +145,7 @@ class Export
|
||||
}
|
||||
|
||||
// If we have to buffer data, we will perform everything at once at the end
|
||||
if ($GLOBALS['buffer_needed']) {
|
||||
if (self::$bufferNeeded) {
|
||||
$this->dumpBuffer .= $line;
|
||||
if ($GLOBALS['onfly_compression']) {
|
||||
$this->dumpBufferLength += strlen($line);
|
||||
|
||||
@ -99,7 +99,7 @@ class ExportTest extends AbstractTestCase
|
||||
public function testExportDatabase(): void
|
||||
{
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Config::getInstance()->selectedServer['DisableIS'] = false;
|
||||
|
||||
@ -156,7 +156,7 @@ SQL;
|
||||
public function testExportServer(): void
|
||||
{
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
$config = Config::getInstance();
|
||||
$config->selectedServer['DisableIS'] = false;
|
||||
|
||||
@ -169,7 +169,7 @@ class ExportCodegenTest extends AbstractTestCase
|
||||
{
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
|
||||
@ -260,7 +260,7 @@ class ExportCsvTest extends AbstractTestCase
|
||||
// case 1
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = true;
|
||||
$GLOBALS['file_handle'] = null;
|
||||
@ -276,7 +276,7 @@ class ExportCsvTest extends AbstractTestCase
|
||||
// case 2
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
|
||||
@ -221,7 +221,7 @@ class ExportExcelTest extends AbstractTestCase
|
||||
// case 1
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = true;
|
||||
$GLOBALS['file_handle'] = null;
|
||||
@ -237,7 +237,7 @@ class ExportExcelTest extends AbstractTestCase
|
||||
// case 2
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
|
||||
@ -64,7 +64,7 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
);
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
Current::$database = '';
|
||||
@ -294,7 +294,7 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
// case 1
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
|
||||
@ -37,7 +37,7 @@ class ExportJsonTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
$this->object = new ExportJson(
|
||||
|
||||
@ -50,7 +50,7 @@ class ExportLatexTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
ExportPlugin::$exportType = ExportType::Table;
|
||||
|
||||
@ -45,7 +45,7 @@ class ExportMediawikiTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
Current::$database = '';
|
||||
|
||||
@ -54,7 +54,7 @@ class ExportOdsTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
$this->object = new ExportOds(
|
||||
|
||||
@ -69,7 +69,7 @@ class ExportOdtTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $this->dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
ExportPlugin::$exportType = ExportType::Table;
|
||||
|
||||
@ -40,7 +40,7 @@ class ExportPdfTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
$this->object = new ExportPdf(
|
||||
|
||||
@ -40,7 +40,7 @@ class ExportPhparrayTest extends AbstractTestCase
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
Export::$saveOnServer = false;
|
||||
Current::$database = '';
|
||||
|
||||
@ -68,7 +68,7 @@ class ExportSqlTest extends AbstractTestCase
|
||||
Current::$lang = 'en';
|
||||
Config::getInstance()->selectedServer['DisableIS'] = true;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
ExportPlugin::$exportType = ExportType::Table;
|
||||
|
||||
@ -60,7 +60,7 @@ class ExportTexytextTest extends AbstractTestCase
|
||||
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
|
||||
DatabaseInterface::$instance = $this->dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
ExportPlugin::$exportType = ExportType::Table;
|
||||
|
||||
@ -44,7 +44,7 @@ class ExportXmlTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
ExportPlugin::$exportType = ExportType::Table;
|
||||
|
||||
@ -39,7 +39,7 @@ class ExportYamlTest extends AbstractTestCase
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
$GLOBALS['buffer_needed'] = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
Current::$database = '';
|
||||
|
||||
Loading…
Reference in New Issue
Block a user