diff --git a/config/permissions.yaml b/config/permissions.yaml
index ac90ab1d..b13eefb4 100644
--- a/config/permissions.yaml
+++ b/config/permissions.yaml
@@ -206,6 +206,8 @@ perms: # Here comes a list with all Permission names (they have a perm_[name] co
delete_logs:
label: "perm.delete_logs"
alsoSet: 'show_logs'
+ server_infos:
+ label: "perm.server_infos"
attachments:
label: "perm.part.attachments"
diff --git a/src/Controller/ToolsController.php b/src/Controller/ToolsController.php
index a7a95db6..70783f1c 100644
--- a/src/Controller/ToolsController.php
+++ b/src/Controller/ToolsController.php
@@ -2,6 +2,9 @@
namespace App\Controller;
+use App\Services\GitVersionInfo;
+use App\Services\Misc\DBInfoHelper;
+use Doctrine\ORM\EntityManagerInterface;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\Routing\Annotation\Route;
@@ -20,4 +23,47 @@ class ToolsController extends AbstractController
return $this->render('Tools/ReelCalculator/main.html.twig');
}
+
+ /**
+ * @Route("/server_infos", name="tools_server_infos")
+ */
+ public function systemInfos(GitVersionInfo $versionInfo, DBInfoHelper $DBInfoHelper): Response
+ {
+ $this->denyAccessUnlessGranted('@system.server_infos');
+
+ return $this->render('Tools/ServerInfos/main.html.twig', [
+ //Part-DB section
+ 'git_branch' => $versionInfo->getGitBranchName(),
+ 'git_commit' => $versionInfo->getGitCommitHash(),
+ 'default_locale' => $this->getParameter('partdb.locale'),
+ 'default_timezone' => $this->getParameter('partdb.timezone'),
+ 'default_currency' => $this->getParameter('partdb.default_currency'),
+ 'default_theme' => $this->getParameter('partdb.global_theme'),
+ 'enabled_locales' => $this->getParameter('partdb.locale_menu'),
+ 'demo_mode' => $this->getParameter('partdb.demo_mode'),
+ 'gpdr_compliance' => $this->getParameter('partdb.gpdr_compliance'),
+ 'use_gravatar' => $this->getParameter('partdb.users.use_gravatar'),
+ 'email_password_reset' => $this->getParameter('partdb.users.email_pw_reset'),
+ 'enviroment' => $this->getParameter('kernel.environment'),
+ 'is_debug' => $this->getParameter('kernel.debug'),
+ 'email_sender' => $this->getParameter('partdb.mail.sender_email'),
+ 'email_sender_name' => $this->getParameter('partdb.mail.sender_name'),
+ 'allow_attachments_downloads' => $this->getParameter('partdb.attachments.allow_downloads'),
+ 'detailed_error_pages' => $this->getParameter('partdb.error_pages.show_help'),
+ 'error_page_admin_email' => $this->getParameter('partdb.error_pages.admin_email'),
+
+ //PHP section
+ 'php_version' => PHP_VERSION,
+ 'php_uname' => php_uname('a'),
+ 'php_sapi' => PHP_SAPI,
+ 'php_extensions' => array_merge(get_loaded_extensions(), get_loaded_extensions(true)),
+ 'php_opcache_enabled' => ini_get('opcache.enable'),
+ 'php_upload_max_filesize' => ini_get('upload_max_filesize'),
+ 'php_post_max_size' => ini_get('post_max_size'),
+
+ //DB section
+ 'db_type' => $DBInfoHelper->getDatabaseType() ?? 'Unknown',
+ 'db_version' => $DBInfoHelper->getDatabaseVersion() ?? 'Unknown',
+ ]);
+ }
}
diff --git a/src/Services/Misc/DBInfoHelper.php b/src/Services/Misc/DBInfoHelper.php
new file mode 100644
index 00000000..9180111c
--- /dev/null
+++ b/src/Services/Misc/DBInfoHelper.php
@@ -0,0 +1,58 @@
+entityManager = $entityManager;
+ $this->connection = $entityManager->getConnection();
+ }
+
+ /**
+ * Returns the database type of the used database.
+ * @return string|null Returns 'mysql' for MySQL/MariaDB and 'sqlite' for SQLite. Returns null if unknown type
+ */
+ public function getDatabaseType(): ?string
+ {
+ if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
+ return 'mysql';
+ }
+
+ if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
+ return 'sqlite';
+ }
+
+ return null;
+ }
+
+ /**
+ * Returns the database version of the used database.
+ * @return string|null
+ * @throws \Doctrine\DBAL\Exception
+ */
+ public function getDatabaseVersion(): ?string
+ {
+ if ($this->connection->getDatabasePlatform() instanceof AbstractMySQLPlatform) {
+ return $this->connection->fetchOne('SELECT VERSION()');
+ }
+
+ if ($this->connection->getDatabasePlatform() instanceof SqlitePlatform) {
+ return $this->connection->fetchOne('SELECT sqlite_version()');
+ }
+
+ return null;
+ }
+}
\ No newline at end of file
diff --git a/src/Services/Trees/ToolsTreeBuilder.php b/src/Services/Trees/ToolsTreeBuilder.php
index 85591f20..74fd5d74 100644
--- a/src/Services/Trees/ToolsTreeBuilder.php
+++ b/src/Services/Trees/ToolsTreeBuilder.php
@@ -291,6 +291,13 @@ class ToolsTreeBuilder
))->setIcon('fa-fw fa-treeview fa-solid fa-binoculars');
}
+ if ($this->security->isGranted('@system.server_infos')) {
+ $nodes[] = (new TreeViewNode(
+ $this->translator->trans('tools.server_infos.title'),
+ $this->urlGenerator->generate('tools_server_infos')
+ ))->setIcon('fa-fw fa-treeview fa-solid fa-database');
+ }
+
return $nodes;
}
}
diff --git a/templates/Tools/ServerInfos/_db.html.twig b/templates/Tools/ServerInfos/_db.html.twig
new file mode 100644
index 00000000..7b7f1d99
--- /dev/null
+++ b/templates/Tools/ServerInfos/_db.html.twig
@@ -0,0 +1,13 @@
+{% import "helper.twig" as helper %}
+
+
+ {% include "Tools/ServerInfos/_partdb.html.twig" %}
+
+
+ {% include "Tools/ServerInfos/_php.html.twig" %}
+
+
+ {% include "Tools/ServerInfos/_db.html.twig" %}
+
+
+
+