Skip to content

Commit

Permalink
docs: add changelog
Browse files Browse the repository at this point in the history
  • Loading branch information
kenjis committed Sep 25, 2023
1 parent ef35fd9 commit c2829d9
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 0 deletions.
18 changes: 18 additions & 0 deletions system/Commands/Database/ShowTableInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@ public function run(array $params)
$this->db = Database::connect();
$this->DBPrefix = $this->db->getPrefix();

$this->showDBConfig();

$tables = $this->db->listTables();

if (array_key_exists('desc', $params)) {
Expand Down Expand Up @@ -145,6 +147,22 @@ public function run(array $params)
$this->showDataOfTable($tableName, $limitRows, $limitFieldValue);
}

private function showDBConfig(): void
{
$data = [[
'hostname' => $this->db->hostname,
'database' => $this->db->database,
'username' => $this->db->username,

Check failure on line 155 in system/Commands/Database/ShowTableInfo.php

View workflow job for this annotation

GitHub Actions / Psalm Analysis

InaccessibleProperty

system/Commands/Database/ShowTableInfo.php:155:27: InaccessibleProperty: Cannot access protected property CodeIgniter\Database\BaseConnection::$username from context CodeIgniter\Commands\Database\ShowTableInfo (see https://psalm.dev/054)

Check failure on line 155 in system/Commands/Database/ShowTableInfo.php

View workflow job for this annotation

GitHub Actions / PHP Static Analysis

Access to protected property CodeIgniter\Database\BaseConnection::$username.
'DBDriver' => $this->db->DBDriver,
'DBPrefix' => $this->DBPrefix,
'port' => $this->db->port,
]];
CLI::table(
$data, ['hostname', 'database', 'username', 'DBDriver', 'DBPrefix', 'port']
);

}

private function removeDBPrefix(): void
{
$this->db->setPrefix('');
Expand Down
12 changes: 12 additions & 0 deletions tests/system/Commands/Database/ShowTableInfoTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -183,4 +183,16 @@ public function testDbTableAllOptions(): void
EOL;
$this->assertStringContainsString($expected, $result);
}

public function testDbTableWithInvalidDbConfig(): void
{
$config = config(Database::class);
$config->tests['database'] = 'invalid database name';

command('db:table --show');

$result = $this->getNormalizedResult();

dd($result);
}
}
3 changes: 3 additions & 0 deletions user_guide_src/source/changelogs/v4.4.2.rst
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,9 @@ Deprecations
Bugs Fixed
**********

- **Spark:** Fixed a bug that caused spark to not display exceptions or to display
backtrace in json when an exception occurred.

See the repo's
`CHANGELOG.md <https://github.com/codeigniter4/CodeIgniter4/blob/develop/CHANGELOG.md>`_
for a complete list of bugs fixed.

0 comments on commit c2829d9

Please sign in to comment.