Use DbTableExists in WrapperController
Signed-off-by: Kamil Tekiela <tekiela246@gmail.com>
This commit is contained in:
parent
f849cc5b17
commit
5ef643c3ff
@ -1576,6 +1576,7 @@ return [
|
||||
'$transformations' => '@transformations',
|
||||
'$relation' => '@relation',
|
||||
'$dbi' => '@dbi',
|
||||
'$dbTableExists' => '@' . DbTableExists::class,
|
||||
],
|
||||
],
|
||||
UserPasswordController::class => [
|
||||
|
||||
@ -8,6 +8,7 @@ use PhpMyAdmin\ConfigStorage\Relation;
|
||||
use PhpMyAdmin\Controllers\AbstractController;
|
||||
use PhpMyAdmin\Core;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\DbTableExists;
|
||||
use PhpMyAdmin\Http\ServerRequest;
|
||||
use PhpMyAdmin\Identifiers\DatabaseName;
|
||||
use PhpMyAdmin\Identifiers\InvalidIdentifier;
|
||||
@ -42,6 +43,7 @@ class WrapperController extends AbstractController
|
||||
private Transformations $transformations,
|
||||
private Relation $relation,
|
||||
private DatabaseInterface $dbi,
|
||||
private DbTableExists $dbTableExists,
|
||||
) {
|
||||
parent::__construct($response, $template);
|
||||
}
|
||||
@ -61,13 +63,8 @@ class WrapperController extends AbstractController
|
||||
return;
|
||||
}
|
||||
|
||||
$hasTable = (bool) $this->dbi->getCache()->getCachedTableContent([$db->getName(), $table->getName()]);
|
||||
if (! $hasTable) {
|
||||
$result = $this->dbi->tryQuery('SHOW TABLES LIKE ' . $this->dbi->quoteString($table->getName()) . ';');
|
||||
$hasTable = $result !== false && $result->numRows() > 0;
|
||||
if (! $hasTable) {
|
||||
return;
|
||||
}
|
||||
if (! $this->dbTableExists->hasTable($db, $table)) {
|
||||
return;
|
||||
}
|
||||
|
||||
$query = $this->getQuery($table, $request->getParam('where_clause'), $request->getParam('where_clause_sign'));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user