mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-06-25 03:08:51 +02:00
Show database name and database connection user in system infos
This commit is contained in:
parent
6eb40c6a41
commit
256926be94
4 changed files with 38 additions and 1 deletions
|
@ -87,6 +87,8 @@ class ToolsController extends AbstractController
|
||||||
'db_type' => $DBInfoHelper->getDatabaseType() ?? 'Unknown',
|
'db_type' => $DBInfoHelper->getDatabaseType() ?? 'Unknown',
|
||||||
'db_version' => $DBInfoHelper->getDatabaseVersion() ?? 'Unknown',
|
'db_version' => $DBInfoHelper->getDatabaseVersion() ?? 'Unknown',
|
||||||
'db_size' => $DBInfoHelper->getDatabaseSize(),
|
'db_size' => $DBInfoHelper->getDatabaseSize(),
|
||||||
|
'db_name' => $DBInfoHelper->getDatabaseName() ?? 'Unknown',
|
||||||
|
'db_user' => $DBInfoHelper->getDatabaseUsername() ?? 'Unknown',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,5 +100,32 @@ class DBInfoHelper
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the database.
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function getDatabaseName(): ?string
|
||||||
|
{
|
||||||
|
return $this->connection->getDatabase() ?? null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the name of the database user.
|
||||||
|
* @return string|null
|
||||||
|
*/
|
||||||
|
public function getDatabaseUsername(): ?string
|
||||||
|
{
|
||||||
|
if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
|
||||||
|
try {
|
||||||
|
return $this->connection->fetchOne('SELECT USER()');
|
||||||
|
} catch (\Doctrine\DBAL\Exception $e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
|
||||||
|
return 'sqlite';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
|
@ -13,5 +13,13 @@
|
||||||
<td>Database Size</td>
|
<td>Database Size</td>
|
||||||
<td>{{ db_size != null ? db_size | format_bytes : 'Unknown' }}</td>
|
<td>{{ db_size != null ? db_size | format_bytes : 'Unknown' }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Database Name</td>
|
||||||
|
<td>{{ db_name }}</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>Database User</td>
|
||||||
|
<td>{{ db_user }}</td>
|
||||||
|
</tr>
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
|
@ -14,7 +14,7 @@
|
||||||
<td>{{ helper.boolean_badge(php_opcache_enabled) }}</td>
|
<td>{{ helper.boolean_badge(php_opcache_enabled) }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>Maximum upload sizee (upload_max_filesize / post_max_size)</td>
|
<td>Maximum upload size (upload_max_filesize / post_max_size)</td>
|
||||||
<td>{{ php_upload_max_filesize }} / {{ php_post_max_size }}</td>
|
<td>{{ php_upload_max_filesize }} / {{ php_post_max_size }}</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue