Extract getTables() method from Triggers::getEditorForm()
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
This commit is contained in:
parent
0d4b85552e
commit
ff7fe4bfa0
@ -11,6 +11,7 @@ use PhpMyAdmin\Query\Generator as QueryGenerator;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Util;
|
||||
use Webmozart\Assert\Assert;
|
||||
|
||||
use function __;
|
||||
use function array_column;
|
||||
@ -299,10 +300,7 @@ class Triggers
|
||||
*/
|
||||
public function getEditorForm(string $db, string $table, string $mode, array $item): string
|
||||
{
|
||||
$query = 'SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`TABLES` ';
|
||||
$query .= 'WHERE `TABLE_SCHEMA`=\'' . $this->dbi->escapeString($db) . '\' ';
|
||||
$query .= 'AND `TABLE_TYPE` IN (\'BASE TABLE\', \'SYSTEM VERSIONED\')';
|
||||
$tables = $this->dbi->fetchResult($query);
|
||||
$tables = $this->getTables($db);
|
||||
|
||||
return $this->template->render('triggers/editor_form', [
|
||||
'db' => $db,
|
||||
@ -553,4 +551,19 @@ class Triggers
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
/** @return list<non-empty-string> */
|
||||
private function getTables(string $db): array
|
||||
{
|
||||
$query = sprintf(
|
||||
'SELECT `TABLE_NAME` FROM `INFORMATION_SCHEMA`.`TABLES` WHERE `TABLE_SCHEMA`=%s'
|
||||
. " AND `TABLE_TYPE` IN ('BASE TABLE', 'SYSTEM VERSIONED')",
|
||||
$this->dbi->quoteString($db),
|
||||
);
|
||||
$tables = $this->dbi->fetchResult($query);
|
||||
Assert::allStringNotEmpty($tables);
|
||||
Assert::isList($tables);
|
||||
|
||||
return $tables;
|
||||
}
|
||||
}
|
||||
|
||||
@ -12869,9 +12869,6 @@
|
||||
</PossiblyUnusedReturnValue>
|
||||
</file>
|
||||
<file src="libraries/classes/Triggers/Triggers.php">
|
||||
<DeprecatedMethod>
|
||||
<code>escapeString</code>
|
||||
</DeprecatedMethod>
|
||||
<InvalidArrayOffset>
|
||||
<code><![CDATA[$GLOBALS['errors']]]></code>
|
||||
<code><![CDATA[$GLOBALS['errors']]]></code>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user