Remove PhpMyAdmin\Twig\PluginsExtension class
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
41386f8cca
commit
7a4536d4d6
@ -107,6 +107,11 @@ final class ImportController extends AbstractController
|
||||
'db' => $db,
|
||||
];
|
||||
|
||||
$choice = Plugins::getChoice('Import', 'format', $importList);
|
||||
$options = Plugins::getOptions('Import', $importList);
|
||||
$skipQueriesDefault = Plugins::getDefault('Import', 'skip_queries');
|
||||
$isAllowInterruptChecked = Plugins::checkboxCheck('Import', 'allow_interrupt');
|
||||
|
||||
$this->render('database/import/index', [
|
||||
'page_settings_error_html' => $pageSettingsErrorHtml,
|
||||
'page_settings_html' => $pageSettingsHtml,
|
||||
@ -116,7 +121,10 @@ final class ImportController extends AbstractController
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'max_upload_size' => $GLOBALS['config']->get('max_upload_size'),
|
||||
'import_list' => $importList,
|
||||
'choice' => $choice,
|
||||
'options' => $options,
|
||||
'skip_queries_default' => $skipQueriesDefault,
|
||||
'is_allow_interrupt_checked' => $isAllowInterruptChecked,
|
||||
'local_import_file' => $localImportFile,
|
||||
'is_upload' => $GLOBALS['config']->get('enable_upload'),
|
||||
'upload_dir' => $cfg['UploadDir'] ?? null,
|
||||
|
||||
@ -91,6 +91,11 @@ final class ImportController extends AbstractController
|
||||
'import_type' => 'server',
|
||||
];
|
||||
|
||||
$choice = Plugins::getChoice('Import', 'format', $importList);
|
||||
$options = Plugins::getOptions('Import', $importList);
|
||||
$skipQueriesDefault = Plugins::getDefault('Import', 'skip_queries');
|
||||
$isAllowInterruptChecked = Plugins::checkboxCheck('Import', 'allow_interrupt');
|
||||
|
||||
$this->render('server/import/index', [
|
||||
'page_settings_error_html' => $pageSettingsErrorHtml,
|
||||
'page_settings_html' => $pageSettingsHtml,
|
||||
@ -100,7 +105,10 @@ final class ImportController extends AbstractController
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'max_upload_size' => $GLOBALS['config']->get('max_upload_size'),
|
||||
'import_list' => $importList,
|
||||
'choice' => $choice,
|
||||
'options' => $options,
|
||||
'skip_queries_default' => $skipQueriesDefault,
|
||||
'is_allow_interrupt_checked' => $isAllowInterruptChecked,
|
||||
'local_import_file' => $localImportFile,
|
||||
'is_upload' => $GLOBALS['config']->get('enable_upload'),
|
||||
'upload_dir' => $cfg['UploadDir'] ?? null,
|
||||
|
||||
@ -101,6 +101,11 @@ final class ImportController extends AbstractController
|
||||
'table' => $table,
|
||||
];
|
||||
|
||||
$choice = Plugins::getChoice('Import', 'format', $importList);
|
||||
$options = Plugins::getOptions('Import', $importList);
|
||||
$skipQueriesDefault = Plugins::getDefault('Import', 'skip_queries');
|
||||
$isAllowInterruptChecked = Plugins::checkboxCheck('Import', 'allow_interrupt');
|
||||
|
||||
$this->render('table/import/index', [
|
||||
'page_settings_error_html' => $pageSettingsErrorHtml,
|
||||
'page_settings_html' => $pageSettingsHtml,
|
||||
@ -110,7 +115,10 @@ final class ImportController extends AbstractController
|
||||
'db' => $db,
|
||||
'table' => $table,
|
||||
'max_upload_size' => $GLOBALS['config']->get('max_upload_size'),
|
||||
'import_list' => $importList,
|
||||
'choice' => $choice,
|
||||
'options' => $options,
|
||||
'skip_queries_default' => $skipQueriesDefault,
|
||||
'is_allow_interrupt_checked' => $isAllowInterruptChecked,
|
||||
'local_import_file' => $localImportFile,
|
||||
'is_upload' => $GLOBALS['config']->get('enable_upload'),
|
||||
'upload_dir' => $cfg['UploadDir'] ?? null,
|
||||
|
||||
@ -137,10 +137,14 @@ class Designer
|
||||
)->getDisplay();
|
||||
}
|
||||
|
||||
$choice = Plugins::getChoice('Schema', 'export_type', $export_list, 'format');
|
||||
$options = Plugins::getOptions('Schema', $export_list);
|
||||
|
||||
return $this->template->render('database/designer/schema_export', [
|
||||
'db' => $db,
|
||||
'page' => $page,
|
||||
'export_list' => $export_list,
|
||||
'choice' => $choice,
|
||||
'options' => $options,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
@ -10,7 +10,6 @@ use PhpMyAdmin\Twig\Extensions\Node\TransNode;
|
||||
use PhpMyAdmin\Twig\FlashMessagesExtension;
|
||||
use PhpMyAdmin\Twig\I18nExtension;
|
||||
use PhpMyAdmin\Twig\MessageExtension;
|
||||
use PhpMyAdmin\Twig\PluginsExtension;
|
||||
use PhpMyAdmin\Twig\RelationExtension;
|
||||
use PhpMyAdmin\Twig\SanitizeExtension;
|
||||
use PhpMyAdmin\Twig\TableExtension;
|
||||
@ -98,7 +97,6 @@ class Template
|
||||
$twig->addExtension(new FlashMessagesExtension());
|
||||
$twig->addExtension(new I18nExtension());
|
||||
$twig->addExtension(new MessageExtension());
|
||||
$twig->addExtension(new PluginsExtension());
|
||||
$twig->addExtension(new RelationExtension());
|
||||
$twig->addExtension(new SanitizeExtension());
|
||||
$twig->addExtension(new TableExtension());
|
||||
|
||||
@ -1,43 +0,0 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Twig;
|
||||
|
||||
use PhpMyAdmin\Plugins;
|
||||
use Twig\Extension\AbstractExtension;
|
||||
use Twig\TwigFunction;
|
||||
|
||||
class PluginsExtension extends AbstractExtension
|
||||
{
|
||||
/**
|
||||
* Returns a list of functions to add to the existing list.
|
||||
*
|
||||
* @return TwigFunction[]
|
||||
*/
|
||||
public function getFunctions()
|
||||
{
|
||||
return [
|
||||
new TwigFunction(
|
||||
'checkbox_check',
|
||||
[Plugins::class, 'checkboxCheck'],
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_choice',
|
||||
[Plugins::class, 'getChoice'],
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_default_plugin',
|
||||
[Plugins::class, 'getDefault'],
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
new TwigFunction(
|
||||
'get_options',
|
||||
[Plugins::class, 'getOptions'],
|
||||
['is_safe' => ['html']]
|
||||
),
|
||||
];
|
||||
}
|
||||
}
|
||||
@ -95,6 +95,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/Database/DesignerController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$list of static method PhpMyAdmin\\\\Plugins\\:\\:getOptions\\(\\) expects array\\<PhpMyAdmin\\\\Plugins\\\\ExportPlugin\\>, array\\<PhpMyAdmin\\\\Plugins\\\\ImportPlugin\\> given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/Database/ImportController.php
|
||||
|
||||
-
|
||||
message: "#^Negated boolean expression is always true\\.$#"
|
||||
count: 6
|
||||
@ -150,6 +155,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/Server/CollationsController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$list of static method PhpMyAdmin\\\\Plugins\\:\\:getOptions\\(\\) expects array\\<PhpMyAdmin\\\\Plugins\\\\ExportPlugin\\>, array\\<PhpMyAdmin\\\\Plugins\\\\ImportPlugin\\> given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/Server/ImportController.php
|
||||
|
||||
-
|
||||
message: "#^Offset 1 does not exist on array\\|null\\.$#"
|
||||
count: 3
|
||||
@ -165,6 +175,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/Table/ChangeController.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$list of static method PhpMyAdmin\\\\Plugins\\:\\:getOptions\\(\\) expects array\\<PhpMyAdmin\\\\Plugins\\\\ExportPlugin\\>, array\\<PhpMyAdmin\\\\Plugins\\\\ImportPlugin\\> given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Controllers/Table/ImportController.php
|
||||
|
||||
-
|
||||
message: "#^Comparison operation \"\\>\" between int\\<1, max\\> and 0 is always true\\.$#"
|
||||
count: 1
|
||||
@ -185,6 +200,11 @@ parameters:
|
||||
count: 1
|
||||
path: libraries/classes/Core.php
|
||||
|
||||
-
|
||||
message: "#^Parameter \\#2 \\$list of static method PhpMyAdmin\\\\Plugins\\:\\:getOptions\\(\\) expects array\\<PhpMyAdmin\\\\Plugins\\\\ExportPlugin\\>, array\\<PhpMyAdmin\\\\Plugins\\\\SchemaPlugin\\> given\\.$#"
|
||||
count: 1
|
||||
path: libraries/classes/Database/Designer.php
|
||||
|
||||
-
|
||||
message: "#^Offset 'DCN' does not exist on array\\('C_NAME' \\=\\> array\\<int, string\\>, \\?'DCN' \\=\\> array\\<int, string\\>&nonEmpty, \\?'DTN' \\=\\> array\\<int, non\\-empty\\-string\\>&nonEmpty, \\?'SCN' \\=\\> array\\<int, string\\>&nonEmpty, \\?'STN' \\=\\> array\\<int, non\\-empty\\-string\\>&nonEmpty\\)\\.$#"
|
||||
count: 1
|
||||
|
||||
@ -1332,6 +1332,9 @@
|
||||
</TypeDoesNotContainNull>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/Database/ImportController.php">
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$importList</code>
|
||||
</InvalidArgument>
|
||||
<MixedArgument occurrences="2">
|
||||
<code>$db</code>
|
||||
<code>$sub_part ?? ''</code>
|
||||
@ -2548,6 +2551,9 @@
|
||||
</MixedAssignment>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/Server/ImportController.php">
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$importList</code>
|
||||
</InvalidArgument>
|
||||
<MixedArrayAccess occurrences="2">
|
||||
<code>$_SESSION[$SESSION_KEY]['handler']</code>
|
||||
<code>$_SESSION[$SESSION_KEY]['handler']</code>
|
||||
@ -3375,6 +3381,9 @@
|
||||
</RedundantCast>
|
||||
</file>
|
||||
<file src="libraries/classes/Controllers/Table/ImportController.php">
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$importList</code>
|
||||
</InvalidArgument>
|
||||
<MixedArgumentTypeCoercion occurrences="1">
|
||||
<code>$urlParams</code>
|
||||
</MixedArgumentTypeCoercion>
|
||||
@ -4874,6 +4883,9 @@
|
||||
</PossiblyNullPropertyAssignmentValue>
|
||||
</file>
|
||||
<file src="libraries/classes/Database/Designer.php">
|
||||
<InvalidArgument occurrences="1">
|
||||
<code>$export_list</code>
|
||||
</InvalidArgument>
|
||||
<MixedArgument occurrences="21">
|
||||
<code>$page_rs</code>
|
||||
<code>$tabColumn[$tableName]['COLUMN_ID']</code>
|
||||
|
||||
@ -2,8 +2,8 @@
|
||||
<fieldset class="pma-fieldset">
|
||||
{{ get_hidden_inputs(db) }}
|
||||
<label>{% trans 'Select Export Relational Type' %}</label>
|
||||
{{ get_choice('Schema', 'export_type', export_list, 'format') }}
|
||||
{{ choice|raw }}
|
||||
<input type="hidden" name="page_number" value="{{ page }}">
|
||||
{{ get_options('Schema', export_list) }}
|
||||
{{ options|raw }}
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
@ -158,8 +158,7 @@
|
||||
{% endif %}
|
||||
|
||||
<div class="formelementrow">
|
||||
<input type="checkbox" name="allow_interrupt" value="yes" id="checkbox_allow_interrupt"
|
||||
{{ checkbox_check('Import', 'allow_interrupt') }}>
|
||||
<input type="checkbox" name="allow_interrupt" value="yes" id="checkbox_allow_interrupt"{{ is_allow_interrupt_checked|raw }}>
|
||||
<label for="checkbox_allow_interrupt">
|
||||
{% trans 'Allow the interruption of an import in case the script detects it is close to the PHP timeout limit. <em>(This might be a good way to import large files, however it can break transactions.)</em>' %}
|
||||
</label>
|
||||
@ -171,7 +170,7 @@
|
||||
{% trans 'Skip this number of queries (for SQL) starting from the first one:' %}
|
||||
</label>
|
||||
<input type="number" name="skip_queries" value="
|
||||
{{- get_default_plugin('Import', 'skip_queries') -}}
|
||||
{{- skip_queries_default|raw -}}
|
||||
" id="text_skip_queries" min="0">
|
||||
</div>
|
||||
{% else %}
|
||||
@ -179,7 +178,7 @@
|
||||
do not show the Skip dialog to avoid the risk of someone
|
||||
entering a value here that would interfere with "skip" #}
|
||||
<input type="hidden" name="skip_queries" value="
|
||||
{{- get_default_plugin('Import', 'skip_queries') -}}
|
||||
{{- skip_queries_default|raw -}}
|
||||
" id="text_skip_queries">
|
||||
{% endif %}
|
||||
</div>
|
||||
@ -195,7 +194,7 @@
|
||||
|
||||
<div class="importoptions">
|
||||
<h3>{% trans 'Format:' %}</h3>
|
||||
{{ get_choice('Import', 'format', import_list) }}
|
||||
{{ choice|raw }}
|
||||
<div id="import_notification"></div>
|
||||
</div>
|
||||
|
||||
@ -204,7 +203,7 @@
|
||||
<p class="no_js_msg" id="scroll_to_options_msg">
|
||||
{% trans 'Scroll down to fill in the options for the selected format and ignore the options for other formats.' %}
|
||||
</p>
|
||||
{{ get_options('Import', import_list) }}
|
||||
{{ options|raw }}
|
||||
</div>
|
||||
<div class="clearfloat"></div>
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user