1
0
mirror of https://github.com/phpmyadmin/phpmyadmin.git synced 2026-10-23 18:29:15 +03:00

Merge branch 'QA_5_2'

Signed-off-by: Maurício Meneghini Fauth <mauricio@mfauth.com.br>
This commit is contained in:
Maurício Meneghini Fauth
2026-08-13 09:57:18 -03:00
12 changed files with 103 additions and 18 deletions

View File

@@ -88,4 +88,9 @@ jobs:
- name: Analyse files with Psalm
# Allow the previous check to fail but not abort
if: always()
run: composer psalm -- --shepherd
run: |
if [ ${{ github.repository }} == 'phpmyadmin/phpmyadmin' ]; then
composer psalm -- --shepherd
else
composer psalm
fi

View File

@@ -109,8 +109,9 @@ jobs:
run: composer run phpunit -- --testsuite unit --display-all-issues
- name: Send coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: unit-${{ matrix.php-version }}-${{ matrix.os }}
name: phpunit-${{ matrix.php-version }}-${{ matrix.os }}
@@ -168,8 +169,9 @@ jobs:
run: composer run phpunit -- --testsuite unit --display-all-issues
- name: Send coverage
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ${{ matrix.extension }}-extension
name: php-${{ matrix.php-version }}-${{ matrix.extension }}-enabled

View File

@@ -671,6 +671,7 @@ done
if [ $do_daily -eq 1 ] ; then
cat > "$kit_prefix".json << EOT
{
"version": "$version",
"date": "$(date --iso-8601=seconds)",
"commit": "$git_head"
}

View File

@@ -247,7 +247,7 @@ CREATE TABLE IF NOT EXISTS `pma__userconfig` (
CREATE TABLE IF NOT EXISTS `pma__users` (
`username` varchar(64) NOT NULL,
`usergroup` varchar(64) NOT NULL,
PRIMARY KEY (`username`,`usergroup`)
PRIMARY KEY (`username`)
)
COMMENT='Users and their assignments to user groups'
DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;

View File

@@ -2511,6 +2511,10 @@ class ExportSql extends ExportPlugin
private function getTableStatus(string $db, string $table): string
{
if (! $this->doDates) {
return '';
}
$newCrlf = "\n";
$schemaCreate = '';
@@ -2521,7 +2525,7 @@ class ExportSql extends ExportPlugin
if ($result !== false && $result->numRows() > 0) {
$tmpres = $result->fetchAssoc();
if ($this->doDates && ! empty($tmpres['Create_time'])) {
if (! empty($tmpres['Create_time'])) {
$schemaCreate .= $this->exportComment(
__('Creation:') . ' '
. Util::localisedDate(new DateTimeImmutable($tmpres['Create_time'])),
@@ -2529,7 +2533,7 @@ class ExportSql extends ExportPlugin
$newCrlf = $this->exportComment() . "\n";
}
if ($this->doDates && ! empty($tmpres['Update_time'])) {
if (! empty($tmpres['Update_time'])) {
$schemaCreate .= $this->exportComment(
__('Last update:') . ' '
. Util::localisedDate(new DateTimeImmutable($tmpres['Update_time'])),
@@ -2537,7 +2541,7 @@ class ExportSql extends ExportPlugin
$newCrlf = $this->exportComment() . "\n";
}
if ($this->doDates && ! empty($tmpres['Check_time'])) {
if (! empty($tmpres['Check_time'])) {
$schemaCreate .= $this->exportComment(
__('Last check:') . ' '
. Util::localisedDate(new DateTimeImmutable($tmpres['Check_time'])),

View File

@@ -287,6 +287,7 @@ class Types
'MULTIPOLYGON' => __('A collection of polygons'),
'GEOMETRYCOLLECTION' => __('A collection of geometry objects of any type'),
'JSON' => __('Stores and enables efficient access to data in JSON (JavaScript Object Notation) documents'),
'INET4' => __('Intended for storage of IPv4 addresses'),
'INET6' => __('Intended for storage of IPv6 addresses, as well as IPv4 '
. 'addresses assuming conventional mapping of IPv4 addresses '
. 'into IPv6 addresses'),
@@ -340,6 +341,7 @@ class Types
'LONGBLOB',
'ENUM',
'SET',
'INET4',
'INET6'
=> TypeClass::Char,
'GEOMETRY',
@@ -653,6 +655,10 @@ class Types
];
if ($isMariaDB && $serverVersion >= 100500) {
$stringTypes[] = '-';
if ($serverVersion >= 101000) {
$stringTypes[] = 'INET4';
}
$stringTypes[] = 'INET6';
}

View File

@@ -488,7 +488,7 @@ class RelationTest extends AbstractTestCase
. ' Table structure for table `pma__users` '
. '-- CREATE TABLE IF NOT EXISTS `pma__users` ( '
. '`username` varchar(64) NOT NULL, `usergroup` varchar(64) NOT NULL,'
. ' PRIMARY KEY (`username`,`usergroup`) )'
. ' PRIMARY KEY (`username`) )'
. ' COMMENT=\'Users and their assignments to user groups\''
. ' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;',
true,
@@ -767,7 +767,7 @@ class RelationTest extends AbstractTestCase
. ' Table structure for table `pma__users` '
. '-- CREATE TABLE IF NOT EXISTS `pma__users` ( '
. '`username` varchar(64) NOT NULL, `usergroup` varchar(64) NOT NULL,'
. ' PRIMARY KEY (`username`,`usergroup`) )'
. ' PRIMARY KEY (`username`) )'
. ' COMMENT=\'Users and their assignments to user groups\''
. ' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;',
true,
@@ -1275,7 +1275,7 @@ class RelationTest extends AbstractTestCase
'CREATE TABLE IF NOT EXISTS `pma__users` (',
' `username` varchar(64) NOT NULL,',
' `usergroup` varchar(64) NOT NULL,',
' PRIMARY KEY (`username`,`usergroup`)',
' PRIMARY KEY (`username`)',
')',
' COMMENT=\'Users and their assignments to user groups\'',
' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;',

View File

@@ -92,7 +92,7 @@ final class CheckRelationsControllerTest extends AbstractTestCase
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__table_uiprefs` -- CREATE TABLE IF NOT EXISTS `pma__table_uiprefs` ( `username` varchar(64) NOT NULL, `db_name` varchar(64) NOT NULL, `table_name` varchar(64) NOT NULL, `prefs` text NOT NULL, `last_update` timestamp NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, PRIMARY KEY (`username`,`db_name`,`table_name`) ) COMMENT='Tables'' UI preferences' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__tracking` -- CREATE TABLE IF NOT EXISTS `pma__tracking` ( `db_name` varchar(64) NOT NULL, `table_name` varchar(64) NOT NULL, `version` int(10) unsigned NOT NULL, `date_created` datetime NOT NULL, `date_updated` datetime NOT NULL, `schema_snapshot` text NOT NULL, `schema_sql` text, `data_sql` longtext, `tracking` set('UPDATE','REPLACE','INSERT','DELETE','TRUNCATE','CREATE DATABASE','ALTER DATABASE','DROP DATABASE','CREATE TABLE','ALTER TABLE','RENAME TABLE','DROP TABLE','CREATE INDEX','DROP INDEX','CREATE VIEW','ALTER VIEW','DROP VIEW') default NULL, `tracking_active` int(1) unsigned NOT NULL default '1', PRIMARY KEY (`db_name`,`table_name`,`version`) ) COMMENT='Database changes tracking for phpMyAdmin' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__userconfig` -- CREATE TABLE IF NOT EXISTS `pma__userconfig` ( `username` varchar(64) NOT NULL, `timevalue` timestamp NOT NULL default CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP, `config_data` text NOT NULL, PRIMARY KEY (`username`) ) COMMENT='User preferences storage for phpMyAdmin' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__users` -- CREATE TABLE IF NOT EXISTS `pma__users` ( `username` varchar(64) NOT NULL, `usergroup` varchar(64) NOT NULL, PRIMARY KEY (`username`,`usergroup`) ) COMMENT='Users and their assignments to user groups' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__users` -- CREATE TABLE IF NOT EXISTS `pma__users` ( `username` varchar(64) NOT NULL, `usergroup` varchar(64) NOT NULL, PRIMARY KEY (`username`) ) COMMENT='Users and their assignments to user groups' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__usergroups` -- CREATE TABLE IF NOT EXISTS `pma__usergroups` ( `usergroup` varchar(64) NOT NULL, `tab` varchar(64) NOT NULL, `allowed` enum('Y','N') NOT NULL DEFAULT 'N', PRIMARY KEY (`usergroup`,`tab`,`allowed`) ) COMMENT='User groups with configured menu items' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__navigationhiding` -- CREATE TABLE IF NOT EXISTS `pma__navigationhiding` ( `username` varchar(64) NOT NULL, `item_name` varchar(64) NOT NULL, `item_type` varchar(64) NOT NULL, `db_name` varchar(64) NOT NULL, `table_name` varchar(64) NOT NULL, PRIMARY KEY (`username`,`item_name`,`item_type`,`db_name`,`table_name`) ) COMMENT='Hidden items of navigation tree' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);
$dbiDummy->addResult("-- -------------------------------------------------------- -- -- Table structure for table `pma__savedsearches` -- CREATE TABLE IF NOT EXISTS `pma__savedsearches` ( `id` int(5) unsigned NOT NULL auto_increment, `username` varchar(64) NOT NULL default '', `db_name` varchar(64) NOT NULL default '', `search_name` varchar(64) NOT NULL default '', `search_data` text NOT NULL, PRIMARY KEY (`id`), UNIQUE KEY `u_savedsearches_username_dbname` (`username`,`db_name`,`search_name`) ) COMMENT='Saved searches' DEFAULT CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;", true);

View File

@@ -158,7 +158,6 @@ final class ExportControllerTest extends AbstractTestCase
--
-- Table structure for table `test_table`
--
CREATE TABLE `test_table` (
`id` int(11) NOT NULL,
`name` varchar(20) NOT NULL,
@@ -331,7 +330,6 @@ final class ExportControllerTest extends AbstractTestCase
--
-- Table structure for table `test_table`
--
CREATE TABLE `test_table` (
`id` int(11) NOT NULL,
`name` varchar(20) NOT NULL,
@@ -478,7 +476,6 @@ final class ExportControllerTest extends AbstractTestCase
--
-- Table structure for table `test_table`
--
CREATE TABLE `test_table` (
`id` int(11) NOT NULL,
`name` varchar(20) NOT NULL,
@@ -644,7 +641,6 @@ final class ExportControllerTest extends AbstractTestCase
--
-- Table structure for table `test_table`
--
CREATE TABLE `test_table` (
`id` int(11) NOT NULL,
`name` varchar(20) NOT NULL,

View File

@@ -252,6 +252,11 @@ class ColumnsDefinitionTest extends AbstractTestCase
false,
['DefaultType' => 'NONE', 'DefaultValue' => ''],
],
'when Default is empty string' => [
'',
false,
['DefaultType' => 'USER_DEFINED', 'DefaultValue' => ''],
],
'when Default is CURRENT_TIMESTAMP' => [
'CURRENT_TIMESTAMP',
false,

View File

@@ -178,11 +178,9 @@ class TrackerTest extends AbstractTestCase
->with('pma_test', 'pma_tbl')
->willReturn($getIndexesResult);
$showTableStatusQuery = 'SHOW TABLE STATUS FROM `pma_test` WHERE Name = \'pma_tbl\'';
$useStatement = 'USE `pma_test`';
$showCreateTableQuery = 'SHOW CREATE TABLE `pma_test`.`pma_tbl`';
$dbi->expects(self::exactly(3))->method('tryQuery')->willReturnMap([
[$showTableStatusQuery, ConnectionType::User, false, true, $resultStub],
$dbi->expects(self::exactly(2))->method('tryQuery')->willReturnMap([
[$useStatement, ConnectionType::User, false, true, $resultStub],
[$showCreateTableQuery, ConnectionType::User, false, true, $resultStub],
]);

View File

@@ -855,6 +855,74 @@ final class TypesByDatabaseVersionTest extends AbstractTestCase
'UUID' => ['UUID'],
],
],
'mariadb 10.10.0 - support INET4, INET6, JSON and UUID' => [
'10.10.0-MariaDB',
[
0 => 'INT',
1 => 'VARCHAR',
2 => 'TEXT',
3 => 'DATE',
4 => 'UUID',
'Numeric' => [
'TINYINT',
'SMALLINT',
'MEDIUMINT',
'INT',
'BIGINT',
'-',
'DECIMAL',
'FLOAT',
'DOUBLE',
'REAL',
'-',
'BIT',
'BOOLEAN',
'SERIAL',
],
'Date and time' => [
'DATE',
'DATETIME',
'TIMESTAMP',
'TIME',
'YEAR',
],
'String' => [
'CHAR',
'VARCHAR',
'-',
'TINYTEXT',
'TEXT',
'MEDIUMTEXT',
'LONGTEXT',
'-',
'BINARY',
'VARBINARY',
'-',
'TINYBLOB',
'BLOB',
'MEDIUMBLOB',
'LONGBLOB',
'-',
'ENUM',
'SET',
'-',
'INET4',
'INET6',
],
'Spatial' => [
'GEOMETRY',
'POINT',
'LINESTRING',
'POLYGON',
'MULTIPOINT',
'MULTILINESTRING',
'MULTIPOLYGON',
'GEOMETRYCOLLECTION',
],
'JSON' => ['JSON'],
'UUID' => ['UUID'],
],
],
];
}
}