Remove the output_kanji_conversion global variable
Replaces it with Export::$outputKanjiConversion static property. Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.net>
This commit is contained in:
parent
b3df04bcf8
commit
ae305d6202
@ -7635,7 +7635,7 @@ parameters:
|
||||
-
|
||||
message: '#^Only booleans are allowed in an if condition, mixed given\.$#'
|
||||
identifier: if.condNotBoolean
|
||||
count: 2
|
||||
count: 1
|
||||
path: src/Export/Export.php
|
||||
|
||||
-
|
||||
|
||||
@ -53,7 +53,6 @@
|
||||
memory_limit: int,
|
||||
old_tz: string,
|
||||
onfly_compression: bool,
|
||||
output_kanji_conversion: bool,
|
||||
plugin_scripts: string[],
|
||||
pma_auth_server: string,
|
||||
querytime: float|int
|
||||
|
||||
@ -51,7 +51,6 @@ final class ExportController implements InvocableController
|
||||
{
|
||||
$GLOBALS['compression'] ??= null;
|
||||
$GLOBALS['file_handle'] ??= null;
|
||||
$GLOBALS['output_kanji_conversion'] ??= null;
|
||||
$GLOBALS['single_table'] ??= null;
|
||||
$GLOBALS['save_filename'] ??= null;
|
||||
$GLOBALS['table_select'] ??= null;
|
||||
@ -201,7 +200,7 @@ final class ExportController implements InvocableController
|
||||
// We send fake headers to avoid browser timeout when buffering
|
||||
$GLOBALS['time_start'] = time();
|
||||
|
||||
$GLOBALS['output_kanji_conversion'] = Encoding::canConvertKanji();
|
||||
Export::$outputKanjiConversion = Encoding::canConvertKanji();
|
||||
|
||||
// Do we need to convert charset?
|
||||
Export::$outputCharsetConversion = Export::$asFile
|
||||
|
||||
@ -77,6 +77,7 @@ class Export
|
||||
public static bool $asFile = false;
|
||||
public static bool $saveOnServer = false;
|
||||
public static bool $outputCharsetConversion = false;
|
||||
public static bool $outputKanjiConversion = false;
|
||||
public static bool $bufferNeeded = false;
|
||||
|
||||
public function __construct(private DatabaseInterface $dbi)
|
||||
@ -140,7 +141,7 @@ class Export
|
||||
$GLOBALS['save_filename'] ??= null;
|
||||
|
||||
// Kanji encoding convert feature
|
||||
if ($GLOBALS['output_kanji_conversion']) {
|
||||
if (self::$outputKanjiConversion) {
|
||||
$line = Encoding::kanjiStrConv($line, $GLOBALS['knjenc'], $GLOBALS['xkana'] ?? '');
|
||||
}
|
||||
|
||||
|
||||
@ -98,7 +98,7 @@ class ExportTest extends AbstractTestCase
|
||||
|
||||
public function testExportDatabase(): void
|
||||
{
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Config::getInstance()->selectedServer['DisableIS'] = false;
|
||||
@ -155,7 +155,7 @@ SQL;
|
||||
|
||||
public function testExportServer(): void
|
||||
{
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
$config = Config::getInstance();
|
||||
|
||||
@ -167,7 +167,7 @@ class ExportCodegenTest extends AbstractTestCase
|
||||
|
||||
public function testExportData(): void
|
||||
{
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -258,7 +258,7 @@ class ExportCsvTest extends AbstractTestCase
|
||||
public function testExportData(): void
|
||||
{
|
||||
// case 1
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
@ -274,7 +274,7 @@ class ExportCsvTest extends AbstractTestCase
|
||||
ob_get_clean();
|
||||
|
||||
// case 2
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -219,7 +219,7 @@ class ExportExcelTest extends AbstractTestCase
|
||||
public function testExportData(): void
|
||||
{
|
||||
// case 1
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
@ -235,7 +235,7 @@ class ExportExcelTest extends AbstractTestCase
|
||||
ob_get_clean();
|
||||
|
||||
// case 2
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -62,7 +62,7 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
new Export($this->dbi),
|
||||
new Transformations(),
|
||||
);
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
@ -292,7 +292,7 @@ class ExportHtmlwordTest extends AbstractTestCase
|
||||
public function testExportData(): void
|
||||
{
|
||||
// case 1
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -35,7 +35,7 @@ class ExportJsonTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -48,7 +48,7 @@ class ExportLatexTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -43,7 +43,7 @@ class ExportMediawikiTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -52,7 +52,7 @@ class ExportOdsTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -67,7 +67,7 @@ class ExportOdtTest extends AbstractTestCase
|
||||
$this->dummyDbi = $this->createDbiDummy();
|
||||
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
|
||||
DatabaseInterface::$instance = $this->dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -38,7 +38,7 @@ class ExportPdfTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -38,7 +38,7 @@ class ExportPhparrayTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$outputCharsetConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = true;
|
||||
|
||||
@ -67,7 +67,7 @@ class ExportSqlTest extends AbstractTestCase
|
||||
Current::$table = '';
|
||||
Current::$lang = 'en';
|
||||
Config::getInstance()->selectedServer['DisableIS'] = true;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
@ -59,7 +59,7 @@ class ExportTexytextTest extends AbstractTestCase
|
||||
$this->dummyDbi = $this->createDbiDummy();
|
||||
$this->dbi = $this->createDatabaseInterface($this->dummyDbi);
|
||||
DatabaseInterface::$instance = $this->dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
@ -43,7 +43,7 @@ class ExportXmlTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
@ -38,7 +38,7 @@ class ExportYamlTest extends AbstractTestCase
|
||||
|
||||
$dbi = $this->createDatabaseInterface();
|
||||
DatabaseInterface::$instance = $dbi;
|
||||
$GLOBALS['output_kanji_conversion'] = false;
|
||||
Export::$outputKanjiConversion = false;
|
||||
Export::$bufferNeeded = false;
|
||||
Export::$asFile = false;
|
||||
Export::$saveOnServer = false;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user