From 50250bd9959ee736e072cade087b4e1b804162ef Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 22:25:08 +0200 Subject: [PATCH 01/27] [BUGFIX] Improve clarity and robustness of InfoBox texts Revised connection and uptime messages for improved readability and accuracy. Enhanced connection percentage calculation by adding safeguards to prevent division by zero. Simplified phrasing for per-user connection limits. --- .../InfoBox/Information/ConnectionInfoBox.php | 22 ++++++++++--------- .../Information/ServerVersionInfoBox.php | 2 +- Classes/InfoBox/Information/UptimeInfoBox.php | 12 +++++----- 3 files changed, 19 insertions(+), 17 deletions(-) diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index 19bcfb3..c7de439 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -34,10 +34,10 @@ class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListI public function renderBody(): string { - return 'Have an eye on your servers connections. ' - . 'It is a first indicator how much your server has to do. ' - . 'If the percentage usage of max simultaneous connections is high you should consider ' - . 'to increase the value for max_connections'; + return 'Keep an eye on your server\'s connections. ' + . 'It is a first indicator of how much work your server has to do. ' + . 'If the percentage usage of max simultaneous connections is high, you should consider ' + . 'optimizing your queries, checking connection lifetimes, or increasing the max_connections value (if privileges allow).'; } private function getAverage(int $value, int $uptime): string @@ -72,8 +72,9 @@ public function getUnorderedList(): \SplQueue value: $this->getStatusValues()['Max_used_connections'], )); - if (isset($this->getVariables()['max_connections'])) { - $percent = 100 / (int)$this->getVariables()['max_connections'] * (int)$this->getStatusValues()['Max_used_connections']; + $maxConnections = (int)($this->getVariables()['max_connections'] ?? 0); + if ($maxConnections > 0) { + $percent = 100 / $maxConnections * (int)$this->getStatusValues()['Max_used_connections']; $unorderedList->enqueue(new ListElement( title: 'Max used simultaneous connections in percent', value: number_format($percent, 2, ',', '.') . '%', @@ -99,7 +100,7 @@ public function getUnorderedList(): \SplQueue if ((int)$this->getVariables()['max_user_connections'] === 0) { $unorderedList->enqueue(new ListElement( title: 'Max allowed user connections (max_user_connections)', - value: 'No limit. Using value from max_connections', + value: 'No per-user limit (applies global max_connections limit)', )); } else { $unorderedList->enqueue(new ListElement( @@ -116,11 +117,12 @@ public function getState(): StateEnumeration { $state = StateEnumeration::STATE_NOTICE; + $maxConnections = (int)($this->getVariables()['max_connections'] ?? 0); if ( - isset($this->getStatusValues()['Max_used_connections']) - && isset($this->getVariables()['max_connections']) + $maxConnections > 0 + && isset($this->getStatusValues()['Max_used_connections']) ) { - $percent = 100 / (int)$this->getVariables()['max_connections'] * (int)$this->getStatusValues()['Max_used_connections']; + $percent = 100 / $maxConnections * (int)$this->getStatusValues()['Max_used_connections']; if ($percent > 90) { $state = StateEnumeration::STATE_ERROR; } elseif ($percent > 70) { diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index f52eb32..6df35ab 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -32,7 +32,7 @@ class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedLi public function renderBody(): string { - return 'Following server information have been found:'; + return 'The following server information was found:'; } /** diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index e31317f..752628f 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -32,10 +32,10 @@ class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInter public function renderBody(): string { - return '"Uptime" shows time since server start or last restart. ' - . 'As a server admin you can FLUSH STATUS to reset various status variables. ' - . 'This is good for temporary debugging, but breaks analysis of server over full time.' - . 'If "Uptime_since_flush_status" is lower than "Uptime" an admin has reset the status variables.'; + return '"Uptime" shows the time since the server was started or restarted. ' + . 'Database administrators can execute "FLUSH STATUS" to reset various status variables. ' + . 'While useful for temporary debugging, resetting the status variables interrupts long-term profiling analysis. ' + . 'If "Uptime_since_flush_status" is lower than "Uptime", the status variables have been reset since the server started.'; } private function convertSecondsToDays(int $seconds): string @@ -64,12 +64,12 @@ public function getUnorderedList(): \SplQueue if (isset($this->getStatusValues()['Uptime_since_flush_status'])) { $unorderedList->enqueue(new ListElement( - title: 'Uptime since last flush', + title: 'Uptime since status variables reset', value: $this->getStatusValues()['Uptime_since_flush_status'] . ' seconds', )); $unorderedList->enqueue(new ListElement( - title: 'Uptime since last flush in days', + title: 'Uptime since status variables reset in days', value: $this->convertSecondsToDays((int)$this->getStatusValues()['Uptime_since_flush_status']) . ' days', )); } From a3ac797f1236ec22a06235d8f67f8d677e5ba3dc Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:29:05 +0200 Subject: [PATCH 02/27] [TASK] Refactor InfoBox system to use constructor injection Inject the StatusValues and Variables models directly via dependency injection factory services instead of fetching them from database repositories in runtime code. Move constructor injection to the AbstractInfoBox base class so all individual InfoBoxes inherit it. Decouple controllers and the page rendering by introducing a new RenderInfoBoxFactory and removing the obsolete Page model. --- Classes/Controller/InnoDBController.php | 10 ++- Classes/Controller/MiscController.php | 10 ++- Classes/Controller/QueryCacheController.php | 10 ++- Classes/Controller/StatusController.php | 10 ++- Classes/Controller/TableCacheController.php | 10 ++- Classes/Controller/ThreadCacheController.php | 10 ++- Classes/InfoBox/AbstractInfoBox.php | 17 +++++ .../InfoBox/Information/ConnectionInfoBox.php | 2 - .../Information/ServerVersionInfoBox.php | 2 - Classes/InfoBox/Information/UptimeInfoBox.php | 2 - .../InfoBox/InnoDb/HitRatioBySFInfoBox.php | 2 - Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 2 - .../InnoDb/InnoDbBufferLoadInfoBox.php | 2 - Classes/InfoBox/InnoDb/InstancesInfoBox.php | 2 - Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 2 - Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 2 - .../InfoBox/Misc/AbortedConnectsInfoBox.php | 2 - Classes/InfoBox/Misc/BackLogInfoBox.php | 2 - Classes/InfoBox/Misc/BinaryLogInfoBox.php | 2 - .../InfoBox/Misc/MaxAllowedPacketInfoBox.php | 2 - .../Misc/StandaloneReplicationInfoBox.php | 2 - Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 2 - Classes/InfoBox/Misc/TempTablesInfoBox.php | 2 - .../QueryCache/AverageQuerySizeInfoBox.php | 2 - .../QueryCache/AverageUsedBlocksInfoBox.php | 2 - .../QueryCache/FragmentationRatioInfoBox.php | 2 - .../InfoBox/QueryCache/HitRatioInfoBox.php | 2 - .../InfoBox/QueryCache/InsertRatioInfoBox.php | 2 - .../InfoBox/QueryCache/PruneRatioInfoBox.php | 2 - .../QueryCacheSizeTooHighInfoBox.php | 2 - .../QueryCache/QueryCacheStatusInfoBox.php | 2 - Classes/InfoBox/RenderInfoBoxFactory.php | 49 ++++++++++++ .../OpenedTableDefinitionsInfoBox.php | 2 - .../TableCache/OpenedTablesInfoBox.php | 2 - .../InfoBox/ThreadCache/HitRatioInfoBox.php | 2 - Classes/Menu/Page.php | 74 ------------------- .../GetStatusValuesAndVariablesTrait.php | 47 ------------ Configuration/Services.yaml | 45 ++++------- 38 files changed, 123 insertions(+), 223 deletions(-) create mode 100644 Classes/InfoBox/RenderInfoBoxFactory.php delete mode 100644 Classes/Menu/Page.php delete mode 100644 Classes/Traits/GetStatusValuesAndVariablesTrait.php diff --git a/Classes/Controller/InnoDBController.php b/Classes/Controller/InnoDBController.php index 3285d5b..b378f04 100644 --- a/Classes/Controller/InnoDBController.php +++ b/Classes/Controller/InnoDBController.php @@ -12,14 +12,15 @@ namespace StefanFroemken\Mysqlreport\Controller; use Psr\Http\Message\ResponseInterface; -use StefanFroemken\Mysqlreport\Menu\Page; +use StefanFroemken\Mysqlreport\InfoBox\RenderInfoBoxFactory; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class InnoDBController extends ActionController { public function __construct( - private readonly Page $page, + private readonly iterable $infoBoxes, + private readonly RenderInfoBoxFactory $renderInfoBoxFactory, private readonly ModuleTemplateFactory $moduleTemplateFactory, ) {} @@ -31,7 +32,10 @@ public function indexAction(): ResponseInterface 'MySQL Report - InnoDB', ); - $moduleTemplate->assign('renderedInfoBoxes', $this->page->getRenderedInfoBoxes()); + $moduleTemplate->assign( + 'renderedInfoBoxes', + $this->renderInfoBoxFactory->render($this->infoBoxes) + ); return $moduleTemplate->renderResponse('InnoDB/Index'); } diff --git a/Classes/Controller/MiscController.php b/Classes/Controller/MiscController.php index f6e5ea6..bb692ee 100644 --- a/Classes/Controller/MiscController.php +++ b/Classes/Controller/MiscController.php @@ -12,14 +12,15 @@ namespace StefanFroemken\Mysqlreport\Controller; use Psr\Http\Message\ResponseInterface; -use StefanFroemken\Mysqlreport\Menu\Page; +use StefanFroemken\Mysqlreport\InfoBox\RenderInfoBoxFactory; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class MiscController extends ActionController { public function __construct( - private readonly Page $page, + private readonly iterable $infoBoxes, + private readonly RenderInfoBoxFactory $renderInfoBoxFactory, private readonly ModuleTemplateFactory $moduleTemplateFactory, ) {} @@ -31,7 +32,10 @@ public function indexAction(): ResponseInterface 'MySQL Report - Misc', ); - $moduleTemplate->assign('renderedInfoBoxes', $this->page->getRenderedInfoBoxes()); + $moduleTemplate->assign( + 'renderedInfoBoxes', + $this->renderInfoBoxFactory->render($this->infoBoxes) + ); return $moduleTemplate->renderResponse('Misc/Index'); } diff --git a/Classes/Controller/QueryCacheController.php b/Classes/Controller/QueryCacheController.php index 30fd729..183a1d7 100644 --- a/Classes/Controller/QueryCacheController.php +++ b/Classes/Controller/QueryCacheController.php @@ -12,14 +12,15 @@ namespace StefanFroemken\Mysqlreport\Controller; use Psr\Http\Message\ResponseInterface; -use StefanFroemken\Mysqlreport\Menu\Page; +use StefanFroemken\Mysqlreport\InfoBox\RenderInfoBoxFactory; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class QueryCacheController extends ActionController { public function __construct( - private readonly Page $page, + private readonly iterable $infoBoxes, + private readonly RenderInfoBoxFactory $renderInfoBoxFactory, private readonly ModuleTemplateFactory $moduleTemplateFactory, ) {} @@ -31,7 +32,10 @@ public function indexAction(): ResponseInterface 'MySQL Report - Query Cache', ); - $moduleTemplate->assign('renderedInfoBoxes', $this->page->getRenderedInfoBoxes()); + $moduleTemplate->assign( + 'renderedInfoBoxes', + $this->renderInfoBoxFactory->render($this->infoBoxes) + ); return $moduleTemplate->renderResponse('QueryCache/Index'); } diff --git a/Classes/Controller/StatusController.php b/Classes/Controller/StatusController.php index 8ef6bbc..de19c4d 100644 --- a/Classes/Controller/StatusController.php +++ b/Classes/Controller/StatusController.php @@ -12,14 +12,15 @@ namespace StefanFroemken\Mysqlreport\Controller; use Psr\Http\Message\ResponseInterface; -use StefanFroemken\Mysqlreport\Menu\Page; +use StefanFroemken\Mysqlreport\InfoBox\RenderInfoBoxFactory; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class StatusController extends ActionController { public function __construct( - private readonly Page $page, + private readonly iterable $infoBoxes, + private readonly RenderInfoBoxFactory $renderInfoBoxFactory, private readonly ModuleTemplateFactory $moduleTemplateFactory, ) {} @@ -31,7 +32,10 @@ public function indexAction(): ResponseInterface 'MySQL Report - Status', ); - $moduleTemplate->assign('renderedInfoBoxes', $this->page->getRenderedInfoBoxes()); + $moduleTemplate->assign( + 'renderedInfoBoxes', + $this->renderInfoBoxFactory->render($this->infoBoxes) + ); return $moduleTemplate->renderResponse('Status/Index'); } diff --git a/Classes/Controller/TableCacheController.php b/Classes/Controller/TableCacheController.php index e224752..7572dac 100644 --- a/Classes/Controller/TableCacheController.php +++ b/Classes/Controller/TableCacheController.php @@ -12,14 +12,15 @@ namespace StefanFroemken\Mysqlreport\Controller; use Psr\Http\Message\ResponseInterface; -use StefanFroemken\Mysqlreport\Menu\Page; +use StefanFroemken\Mysqlreport\InfoBox\RenderInfoBoxFactory; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class TableCacheController extends ActionController { public function __construct( - private readonly Page $page, + private readonly iterable $infoBoxes, + private readonly RenderInfoBoxFactory $renderInfoBoxFactory, private readonly ModuleTemplateFactory $moduleTemplateFactory, ) {} @@ -31,7 +32,10 @@ public function indexAction(): ResponseInterface 'MySQL Report - Table Cache', ); - $moduleTemplate->assign('renderedInfoBoxes', $this->page->getRenderedInfoBoxes()); + $moduleTemplate->assign( + 'renderedInfoBoxes', + $this->renderInfoBoxFactory->render($this->infoBoxes) + ); return $moduleTemplate->renderResponse('TableCache/Index'); } diff --git a/Classes/Controller/ThreadCacheController.php b/Classes/Controller/ThreadCacheController.php index 450d05e..722f2da 100644 --- a/Classes/Controller/ThreadCacheController.php +++ b/Classes/Controller/ThreadCacheController.php @@ -12,14 +12,15 @@ namespace StefanFroemken\Mysqlreport\Controller; use Psr\Http\Message\ResponseInterface; -use StefanFroemken\Mysqlreport\Menu\Page; +use StefanFroemken\Mysqlreport\InfoBox\RenderInfoBoxFactory; use TYPO3\CMS\Backend\Template\ModuleTemplateFactory; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; class ThreadCacheController extends ActionController { public function __construct( - private readonly Page $page, + private readonly iterable $infoBoxes, + private readonly RenderInfoBoxFactory $renderInfoBoxFactory, private readonly ModuleTemplateFactory $moduleTemplateFactory, ) {} @@ -31,7 +32,10 @@ public function indexAction(): ResponseInterface 'MySQL Report - Thread Cache', ); - $moduleTemplate->assign('renderedInfoBoxes', $this->page->getRenderedInfoBoxes()); + $moduleTemplate->assign( + 'renderedInfoBoxes', + $this->renderInfoBoxFactory->render($this->infoBoxes) + ); return $moduleTemplate->renderResponse('ThreadCache/Index'); } diff --git a/Classes/InfoBox/AbstractInfoBox.php b/Classes/InfoBox/AbstractInfoBox.php index de9d523..d39aeae 100644 --- a/Classes/InfoBox/AbstractInfoBox.php +++ b/Classes/InfoBox/AbstractInfoBox.php @@ -11,6 +11,8 @@ namespace StefanFroemken\Mysqlreport\InfoBox; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; use TYPO3\CMS\Core\View\ViewInterface; /** @@ -20,8 +22,23 @@ abstract class AbstractInfoBox { protected const TITLE = ''; + public function __construct( + protected readonly StatusValues $statusValues, + protected readonly Variables $variables, + ) {} + abstract public function renderBody(): string; + protected function getStatusValues(): StatusValues + { + return $this->statusValues; + } + + protected function getVariables(): Variables + { + return $this->variables; + } + public function updateView(ViewInterface $view): ?ViewInterface { if (($body = $this->renderBody()) === '') { diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index c7de439..6e5280a 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -16,7 +16,6 @@ use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -28,7 +27,6 @@ )] class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Connections'; diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index 6df35ab..f48971e 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Server Information'; diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index 752628f..489323b 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Uptime'; diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index c51fbab..4167925 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class HitRatioBySFInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Hit Ratio by SF'; diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index d8488c7..861bb4a 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Hit Ratio'; diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 584e3ef..f9c4076 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -27,7 +26,6 @@ )] class InnoDbBufferLoadInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'InnoDB Buffer Load'; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index c7c482d..6daad48 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -25,7 +24,6 @@ )] class InstancesInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Instances'; diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index fae9558..09509df 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -25,7 +24,6 @@ )] class LogFileSizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Log File Size'; diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index b7b4582..3b24953 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -25,7 +24,6 @@ )] class WriteRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Write Ratio'; diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index d7e676f..82f35b1 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -24,7 +23,6 @@ )] class AbortedConnectsInfoBox extends AbstractInfoBox { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Aborted Connects'; diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index 38105f5..d85479b 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; use TYPO3\CMS\Core\Utility\CommandUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -25,7 +24,6 @@ )] class BackLogInfoBox extends AbstractInfoBox { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Back Log'; diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index dd4f636..46bf310 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -23,7 +22,6 @@ )] class BinaryLogInfoBox extends AbstractInfoBox { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Binary Log'; diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index 96b6776..2181fe1 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class MaxAllowedPacketInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Max Packet Size'; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index a748d08..55b64ca 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -23,7 +22,6 @@ )] class StandaloneReplicationInfoBox extends AbstractInfoBox { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Standalone or Replication'; diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index efc57e2..b9b5533 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -23,7 +22,6 @@ )] class SyncBinaryLogInfoBox extends AbstractInfoBox { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Sync Binary Log'; diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 8c21800..344e2f5 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class TempTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Temporary Tables'; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index d076a3f..f5c7f3b 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class AverageQuerySizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Average Query Size'; diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index be9905d..4dcda8d 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class AverageUsedBlocksInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Average Used Blocks'; diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 79a941e..7b5e0ea 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class FragmentationRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Fragmentation Ratio'; diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index 6690108..173cbbd 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -27,7 +26,6 @@ )] class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Hit Ratio'; diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index 52b1e04..082309f 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -27,7 +26,6 @@ )] class InsertRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Insert Ratio'; diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index a479145..688207e 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -27,7 +26,6 @@ )] class PruneRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Prune Ratio'; diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index bc596df..7d03b94 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -26,7 +25,6 @@ )] class QueryCacheSizeTooHighInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Query Cache too high'; diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index bdf0d2d..555a75e 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -15,7 +15,6 @@ use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -27,7 +26,6 @@ )] class QueryCacheStatusInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Query Cache Status'; diff --git a/Classes/InfoBox/RenderInfoBoxFactory.php b/Classes/InfoBox/RenderInfoBoxFactory.php new file mode 100644 index 0000000..c7b5432 --- /dev/null +++ b/Classes/InfoBox/RenderInfoBoxFactory.php @@ -0,0 +1,49 @@ + $infoBoxes + */ + public function render(iterable $infoBoxes): string + { + $renderedInfoBoxes = ''; + foreach ($infoBoxes as $infoBox) { + if ($view = $infoBox->updateView($this->getViewForInfoBox())) { + $renderedInfoBoxes .= $view->render(); + } + } + + return $renderedInfoBoxes; + } + + private function getViewForInfoBox(): ViewInterface + { + $viewFactoryData = new ViewFactoryData( + templatePathAndFilename: self::TEMPLATE_FILE, + ); + + return $this->viewFactory->create($viewFactoryData); + } +} diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index f30fa70..9401096 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -16,7 +16,6 @@ use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -30,7 +29,6 @@ )] class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Opened Table Definitions'; diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index c667365..35a7a90 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -16,7 +16,6 @@ use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -30,7 +29,6 @@ )] class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Opened Tables'; diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index 253a224..a934518 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -14,7 +14,6 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; -use StefanFroemken\Mysqlreport\Traits\GetStatusValuesAndVariablesTrait; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -25,7 +24,6 @@ )] class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - use GetStatusValuesAndVariablesTrait; protected const TITLE = 'Hit Ratio'; diff --git a/Classes/Menu/Page.php b/Classes/Menu/Page.php deleted file mode 100644 index b8431e6..0000000 --- a/Classes/Menu/Page.php +++ /dev/null @@ -1,74 +0,0 @@ - $infoBoxes - */ - public function __construct( - private iterable $infoBoxes, - private ViewFactoryInterface $viewFactory, - ) {} - - public function getRenderedInfoBoxes(): string - { - $renderedInfoBoxes = ''; - foreach ($this->infoBoxes as $infoBox) { - if ($view = $infoBox->updateView($this->getViewForInfoBox())) { - $renderedInfoBoxes .= $view->render(); - } - } - - return $renderedInfoBoxes; - } - - private function getViewForInfoBox(): ViewInterface - { - $viewFactoryData = new ViewFactoryData( - templatePathAndFilename: self::TEMPLATE_FILE, - ); - - return $this->viewFactory->create($viewFactoryData); - } -} diff --git a/Classes/Traits/GetStatusValuesAndVariablesTrait.php b/Classes/Traits/GetStatusValuesAndVariablesTrait.php deleted file mode 100644 index 289553a..0000000 --- a/Classes/Traits/GetStatusValuesAndVariablesTrait.php +++ /dev/null @@ -1,47 +0,0 @@ -statusRepository = $statusRepository; - } - - public function injectVariablesRepository(VariablesRepository $variablesRepository): void - { - $this->variablesRepository = $variablesRepository; - } - - private function getStatusValues(): StatusValues - { - return $this->statusRepository->findAll(); - } - - private function getVariables(): Variables - { - return $this->variablesRepository->findAll(); - } -} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 6e7d78b..bfdbb9e 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -9,6 +9,9 @@ services: autowire: true autoconfigure: true public: false + bind: + StefanFroemken\Mysqlreport\Domain\Model\StatusValues: '@mysqlreport.status' + StefanFroemken\Mysqlreport\Domain\Model\Variables: '@mysqlreport.variables' StefanFroemken\Mysqlreport\: resource: '../Classes/*' @@ -16,29 +19,13 @@ services: - '../Classes/Domain/Model/*' - '../Classes/InfoBox/ListElement.php' - mysqlreport.page.information: - class: StefanFroemken\Mysqlreport\Menu\Page - arguments: [!tagged_iterator { tag: 'mysqlreport.infobox.status' }] + mysqlreport.status: + class: StefanFroemken\Mysqlreport\Domain\Model\StatusValues + factory: ['@StefanFroemken\Mysqlreport\Domain\Repository\StatusRepository', 'findAll'] - mysqlreport.page.innodb: - class: StefanFroemken\Mysqlreport\Menu\Page - arguments: [!tagged_iterator { tag: 'mysqlreport.infobox.innodb' }] - - mysqlreport.page.misc: - class: StefanFroemken\Mysqlreport\Menu\Page - arguments: [!tagged_iterator { tag: 'mysqlreport.infobox.misc' }] - - mysqlreport.page.query_cache: - class: StefanFroemken\Mysqlreport\Menu\Page - arguments: [!tagged_iterator { tag: 'mysqlreport.infobox.query_cache' }] - - mysqlreport.page.table_cache: - class: StefanFroemken\Mysqlreport\Menu\Page - arguments: [!tagged_iterator { tag: 'mysqlreport.infobox.table_cache' }] - - mysqlreport.page.thread_cache: - class: StefanFroemken\Mysqlreport\Menu\Page - arguments: [!tagged_iterator { tag: 'mysqlreport.infobox.thread_cache' }] + mysqlreport.variables: + class: StefanFroemken\Mysqlreport\Domain\Model\Variables + factory: ['@StefanFroemken\Mysqlreport\Domain\Repository\VariablesRepository', 'findAll'] # Will be called via GeneralUtility::makeInstance in LoggerWithQueryTimeMiddleware and LoggerWithQueryTimeConnection StefanFroemken\Mysqlreport\Configuration\ExtConf: @@ -46,27 +33,27 @@ services: StefanFroemken\Mysqlreport\Controller\InnoDBController: arguments: - $page: '@mysqlreport.page.innodb' + $infoBoxes: !tagged_iterator { tag: 'mysqlreport.infobox.innodb' } StefanFroemken\Mysqlreport\Controller\MiscController: arguments: - $page: '@mysqlreport.page.misc' + $infoBoxes: !tagged_iterator { tag: 'mysqlreport.infobox.misc' } StefanFroemken\Mysqlreport\Controller\QueryCacheController: arguments: - $page: '@mysqlreport.page.query_cache' + $infoBoxes: !tagged_iterator { tag: 'mysqlreport.infobox.query_cache' } StefanFroemken\Mysqlreport\Controller\StatusController: arguments: - $page: '@mysqlreport.page.information' + $infoBoxes: !tagged_iterator { tag: 'mysqlreport.infobox.status' } StefanFroemken\Mysqlreport\Controller\TableCacheController: arguments: - $page: '@mysqlreport.page.table_cache' + $infoBoxes: !tagged_iterator { tag: 'mysqlreport.infobox.table_cache' } StefanFroemken\Mysqlreport\Controller\ThreadCacheController: arguments: - $page: '@mysqlreport.page.thread_cache' + $infoBoxes: !tagged_iterator { tag: 'mysqlreport.infobox.thread_cache' } # Will be called via GeneralUtility::makeInstance in ConnectionPool StefanFroemken\Mysqlreport\Doctrine\Middleware\LoggerWithQueryTimeMiddleware: @@ -97,8 +84,6 @@ services: StefanFroemken\Mysqlreport\Controller\ProfileController: public: true - StefanFroemken\Mysqlreport\Controller\QueryController: - public: true # Will be called via GeneralUtility::makeInstance in LoggerWithQueryTimeConnection StefanFroemken\Mysqlreport\Domain\Repository\QueryInformationRepository: From 240f0f34eac90e3e298b3d6e8b71127d14b83ebd Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:31:29 +0200 Subject: [PATCH 03/27] [TASK] Declare InfoBox classes as readonly Declare the AbstractInfoBox base class and all its 27 subclasses as readonly classes. Remove the obsolete getStatusValues and getVariables getter methods from the base class, and replace all respective method calls in the subclasses with direct property access. --- Classes/InfoBox/AbstractInfoBox.php | 16 ++------ .../InfoBox/Information/ConnectionInfoBox.php | 38 +++++++++---------- .../Information/ServerVersionInfoBox.php | 18 ++++----- Classes/InfoBox/Information/UptimeInfoBox.php | 14 +++---- .../InfoBox/InnoDb/HitRatioBySFInfoBox.php | 12 +++--- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 10 ++--- .../InnoDb/InnoDbBufferLoadInfoBox.php | 8 ++-- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 10 ++--- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 16 ++++---- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 12 +++--- .../InfoBox/Misc/AbortedConnectsInfoBox.php | 6 +-- Classes/InfoBox/Misc/BackLogInfoBox.php | 6 +-- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 8 ++-- .../InfoBox/Misc/MaxAllowedPacketInfoBox.php | 6 +-- .../Misc/StandaloneReplicationInfoBox.php | 6 +-- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 6 +-- Classes/InfoBox/Misc/TempTablesInfoBox.php | 32 ++++++++-------- .../QueryCache/AverageQuerySizeInfoBox.php | 18 ++++----- .../QueryCache/AverageUsedBlocksInfoBox.php | 12 +++--- .../QueryCache/FragmentationRatioInfoBox.php | 10 ++--- .../InfoBox/QueryCache/HitRatioInfoBox.php | 10 ++--- .../InfoBox/QueryCache/InsertRatioInfoBox.php | 10 ++--- .../InfoBox/QueryCache/PruneRatioInfoBox.php | 10 ++--- .../QueryCacheSizeTooHighInfoBox.php | 8 ++-- .../QueryCache/QueryCacheStatusInfoBox.php | 6 +-- .../OpenedTableDefinitionsInfoBox.php | 12 +++--- .../TableCache/OpenedTablesInfoBox.php | 18 ++++----- .../InfoBox/ThreadCache/HitRatioInfoBox.php | 12 +++--- 28 files changed, 170 insertions(+), 180 deletions(-) diff --git a/Classes/InfoBox/AbstractInfoBox.php b/Classes/InfoBox/AbstractInfoBox.php index d39aeae..dd44f53 100644 --- a/Classes/InfoBox/AbstractInfoBox.php +++ b/Classes/InfoBox/AbstractInfoBox.php @@ -18,27 +18,17 @@ /** * Model with properties for panels you can see in BE module */ -abstract class AbstractInfoBox +abstract readonly class AbstractInfoBox { protected const TITLE = ''; public function __construct( - protected readonly StatusValues $statusValues, - protected readonly Variables $variables, + protected StatusValues $statusValues, + protected Variables $variables, ) {} abstract public function renderBody(): string; - protected function getStatusValues(): StatusValues - { - return $this->statusValues; - } - - protected function getVariables(): Variables - { - return $this->variables; - } - public function updateView(ViewInterface $view): ?ViewInterface { if (($body = $this->renderBody()) === '') { diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index 6e5280a..5f0f17e 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -25,7 +25,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 30], )] -class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +readonly class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { protected const TITLE = 'Connections'; @@ -50,29 +50,29 @@ public function getUnorderedList(): \SplQueue { $unorderedList = new \SplQueue(); - if (isset($this->getStatusValues()['Connections'])) { + if (isset($this->statusValues['Connections'])) { $unorderedList->enqueue(new ListElement( title: 'Connections in total (Connections)', - value: $this->getStatusValues()['Connections'], + value: $this->statusValues['Connections'], )); $unorderedList->enqueue(new ListElement( title: 'Average connections each second', value: $this->getAverage( - (int)$this->getStatusValues()['Connections'], - (int)$this->getStatusValues()['Uptime'], + (int)$this->statusValues['Connections'], + (int)$this->statusValues['Uptime'], ), )); } - if (isset($this->getStatusValues()['Max_used_connections'])) { + if (isset($this->statusValues['Max_used_connections'])) { $unorderedList->enqueue(new ListElement( title: 'Max used simultaneous connections (Max_used_connections)', - value: $this->getStatusValues()['Max_used_connections'], + value: $this->statusValues['Max_used_connections'], )); - $maxConnections = (int)($this->getVariables()['max_connections'] ?? 0); + $maxConnections = (int)($this->variables['max_connections'] ?? 0); if ($maxConnections > 0) { - $percent = 100 / $maxConnections * (int)$this->getStatusValues()['Max_used_connections']; + $percent = 100 / $maxConnections * (int)$this->statusValues['Max_used_connections']; $unorderedList->enqueue(new ListElement( title: 'Max used simultaneous connections in percent', value: number_format($percent, 2, ',', '.') . '%', @@ -80,22 +80,22 @@ public function getUnorderedList(): \SplQueue } } - if (isset($this->getVariables()['max_connections'])) { + if (isset($this->variables['max_connections'])) { $unorderedList->enqueue(new ListElement( title: 'Max allowed simultaneous connections (max_connections)', - value: $this->getVariables()['max_connections'], + value: $this->variables['max_connections'], )); } - if (isset($this->getVariables()['extra_max_connections'])) { + if (isset($this->variables['extra_max_connections'])) { $unorderedList->enqueue(new ListElement( title: 'Extra connections (extra_max_connections)', - value: $this->getVariables()['extra_max_connections'], + value: $this->variables['extra_max_connections'], )); } - if (isset($this->getVariables()['max_user_connections'])) { - if ((int)$this->getVariables()['max_user_connections'] === 0) { + if (isset($this->variables['max_user_connections'])) { + if ((int)$this->variables['max_user_connections'] === 0) { $unorderedList->enqueue(new ListElement( title: 'Max allowed user connections (max_user_connections)', value: 'No per-user limit (applies global max_connections limit)', @@ -103,7 +103,7 @@ public function getUnorderedList(): \SplQueue } else { $unorderedList->enqueue(new ListElement( title: 'Max allowed user connections (max_user_connections)', - value: $this->getVariables()['max_user_connections'], + value: $this->variables['max_user_connections'], )); } } @@ -115,12 +115,12 @@ public function getState(): StateEnumeration { $state = StateEnumeration::STATE_NOTICE; - $maxConnections = (int)($this->getVariables()['max_connections'] ?? 0); + $maxConnections = (int)($this->variables['max_connections'] ?? 0); if ( $maxConnections > 0 - && isset($this->getStatusValues()['Max_used_connections']) + && isset($this->statusValues['Max_used_connections']) ) { - $percent = 100 / $maxConnections * (int)$this->getStatusValues()['Max_used_connections']; + $percent = 100 / $maxConnections * (int)$this->statusValues['Max_used_connections']; if ($percent > 90) { $state = StateEnumeration::STATE_ERROR; } elseif ($percent > 70) { diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index f48971e..c5035e5 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 90], )] -class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +readonly class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Server Information'; @@ -40,31 +40,31 @@ public function getUnorderedList(): \SplQueue { $unorderedList = new \SplQueue(); - if (isset($this->getVariables()['version'])) { + if (isset($this->variables['version'])) { $unorderedList->enqueue(new ListElement( title: 'Version', - value: $this->getVariables()['version'], + value: $this->variables['version'], )); } - if (isset($this->getVariables()['version_comment'])) { + if (isset($this->variables['version_comment'])) { $unorderedList->enqueue(new ListElement( title: 'Version comment', - value: $this->getVariables()['version_comment'], + value: $this->variables['version_comment'], )); } - if (isset($this->getVariables()['version_compile_machine'])) { + if (isset($this->variables['version_compile_machine'])) { $unorderedList->enqueue(new ListElement( title: 'Version compile machine', - value: $this->getVariables()['version_compile_machine'], + value: $this->variables['version_compile_machine'], )); } - if (isset($this->getVariables()['version_compile_os'])) { + if (isset($this->variables['version_compile_os'])) { $unorderedList->enqueue(new ListElement( title: 'Version compile OS', - value: $this->getVariables()['version_compile_os'], + value: $this->variables['version_compile_os'], )); } diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index 489323b..9ff19a7 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 80], )] -class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +readonly class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Uptime'; @@ -48,27 +48,27 @@ public function getUnorderedList(): \SplQueue { $unorderedList = new \SplQueue(); - if (isset($this->getStatusValues()['Uptime'])) { + if (isset($this->statusValues['Uptime'])) { $unorderedList->enqueue(new ListElement( title: 'Uptime', - value: $this->getStatusValues()['Uptime'] . ' seconds', + value: $this->statusValues['Uptime'] . ' seconds', )); $unorderedList->enqueue(new ListElement( title: 'Uptime in days', - value: $this->convertSecondsToDays((int)$this->getStatusValues()['Uptime']) . ' days', + value: $this->convertSecondsToDays((int)$this->statusValues['Uptime']) . ' days', )); } - if (isset($this->getStatusValues()['Uptime_since_flush_status'])) { + if (isset($this->statusValues['Uptime_since_flush_status'])) { $unorderedList->enqueue(new ListElement( title: 'Uptime since status variables reset', - value: $this->getStatusValues()['Uptime_since_flush_status'] . ' seconds', + value: $this->statusValues['Uptime_since_flush_status'] . ' seconds', )); $unorderedList->enqueue(new ListElement( title: 'Uptime since status variables reset in days', - value: $this->convertSecondsToDays((int)$this->getStatusValues()['Uptime_since_flush_status']) . ' days', + value: $this->convertSecondsToDays((int)$this->statusValues['Uptime_since_flush_status']) . ' days', )); } diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 4167925..98c10d6 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 40], )] -class HitRatioBySFInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class HitRatioBySFInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio by SF'; @@ -32,9 +32,9 @@ public function renderBody(): string { if ( !isset( - $this->getStatusValues()['Innodb_page_size'], - $this->getStatusValues()['Innodb_buffer_pool_reads'], - $this->getStatusValues()['Innodb_buffer_pool_read_requests'], + $this->statusValues['Innodb_page_size'], + $this->statusValues['Innodb_buffer_pool_reads'], + $this->statusValues['Innodb_buffer_pool_read_requests'], ) ) { return ''; @@ -58,7 +58,7 @@ public function renderBody(): string */ protected function getHitRatioBySF(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $niceToHave = $status['Innodb_buffer_pool_reads'] * 1000; $hitRatio = 100 / $niceToHave * $status['Innodb_buffer_pool_read_requests']; @@ -68,7 +68,7 @@ protected function getHitRatioBySF(): float public function getState(): StateEnumeration { - $status = $this->getStatusValues(); + $status = $this->statusValues; // We always want a factor of 1/1000. $niceToHave = $status['Innodb_buffer_pool_reads'] * 1000; diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index 861bb4a..f954d55 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 50], )] -class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio'; @@ -32,9 +32,9 @@ public function renderBody(): string { if ( !isset( - $this->getStatusValues()['Innodb_page_size'], - $this->getStatusValues()['Innodb_buffer_pool_read_requests'], - $this->getStatusValues()['Innodb_buffer_pool_reads'], + $this->statusValues['Innodb_page_size'], + $this->statusValues['Innodb_buffer_pool_read_requests'], + $this->statusValues['Innodb_buffer_pool_reads'], ) ) { return ''; @@ -59,7 +59,7 @@ public function renderBody(): string */ protected function getHitRatio(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $hitRatio = ($status['Innodb_buffer_pool_read_requests'] / ($status['Innodb_buffer_pool_read_requests'] + $status['Innodb_buffer_pool_reads'])) * 100; diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index f9c4076..60e00ad 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -24,14 +24,14 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 90], )] -class InnoDbBufferLoadInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +readonly class InnoDbBufferLoadInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'InnoDB Buffer Load'; public function renderBody(): string { - if (!isset($this->getStatusValues()['Innodb_page_size'])) { + if (!isset($this->statusValues['Innodb_page_size'])) { return ''; } @@ -42,7 +42,7 @@ public function renderBody(): string return sprintf( implode(' ', $content), - $this->getStatusValues()['Innodb_page_size'], + $this->statusValues['Innodb_page_size'], ); } @@ -54,7 +54,7 @@ public function renderBody(): string protected function getLoad(): array { $load = []; - $status = $this->getStatusValues(); + $status = $this->statusValues; // in Bytes $total = $status['Innodb_buffer_pool_pages_total'] * $status['Innodb_page_size']; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index 6daad48..c889be9 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -22,18 +22,18 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -class InstancesInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class InstancesInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Instances'; public function renderBody(): string { - if (!isset($this->getStatusValues()['Innodb_page_size'])) { + if (!isset($this->statusValues['Innodb_page_size'])) { return ''; } - if (!isset($this->getVariables()['innodb_buffer_pool_instances'])) { + if (!isset($this->variables['innodb_buffer_pool_instances'])) { return ''; } @@ -54,14 +54,14 @@ public function renderBody(): string protected function getInstances(): int { - $variables = $this->getVariables(); + $variables = $this->variables; return (int)$variables['innodb_buffer_pool_instances']; } public function getState(): StateEnumeration { - $variables = $this->getVariables(); + $variables = $this->variables; $innodbBufferShouldBe = $variables['innodb_buffer_pool_instances'] * (1 * 1024 * 1024 * 1024); // Instances * 1 GB if ( diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index 09509df..0acda58 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -22,7 +22,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -class LogFileSizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class LogFileSizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Log File Size'; @@ -31,10 +31,10 @@ public function renderBody(): string { if ( !isset( - $this->getStatusValues()['Innodb_page_size'], - $this->getVariables()['innodb_log_files_in_group'], + $this->statusValues['Innodb_page_size'], + $this->variables['innodb_log_files_in_group'], ) - || (int)$this->getVariables()['innodb_log_files_in_group'] === 0 + || (int)$this->variables['innodb_log_files_in_group'] === 0 ) { return ''; } @@ -65,7 +65,7 @@ public function renderBody(): string */ protected function getLogFileSize(): array { - $variables = $this->getVariables(); + $variables = $this->variables; return [ 'value' => $variables['innodb_log_file_size'], @@ -75,8 +75,8 @@ protected function getLogFileSize(): array private function getSizeOfEachLogFile(): int { - $variables = $this->getVariables(); - $status = $this->getStatusValues(); + $variables = $this->variables; + $status = $this->statusValues; $bytesWrittenEachSecond = $status['Innodb_os_log_written'] / $status['Uptime']; $bytesWrittenEachHour = $bytesWrittenEachSecond * 60 * 60; @@ -86,7 +86,7 @@ private function getSizeOfEachLogFile(): int public function getState(): StateEnumeration { - $variables = $this->getVariables(); + $variables = $this->variables; $sizeOfEachLogFile = $this->getSizeOfEachLogFile(); if ($sizeOfEachLogFile < 5242880 || $sizeOfEachLogFile < $variables['innodb_log_file_size']) { diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index 3b24953..bcdcebb 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -22,7 +22,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -class WriteRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class WriteRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Write Ratio'; @@ -31,11 +31,11 @@ public function renderBody(): string { if ( !isset( - $this->getStatusValues()['Innodb_page_size'], - $this->getStatusValues()['Innodb_buffer_pool_write_requests'], - $this->getStatusValues()['Innodb_buffer_pool_pages_flushed'], + $this->statusValues['Innodb_page_size'], + $this->statusValues['Innodb_buffer_pool_write_requests'], + $this->statusValues['Innodb_buffer_pool_pages_flushed'], ) - || (int)$this->getStatusValues()['Innodb_buffer_pool_pages_flushed'] === 0 + || (int)$this->statusValues['Innodb_buffer_pool_pages_flushed'] === 0 ) { return ''; } @@ -57,7 +57,7 @@ public function renderBody(): string */ protected function getWriteRatio(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $writeRatio = $status['Innodb_buffer_pool_write_requests'] / $status['Innodb_buffer_pool_pages_flushed']; diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index 82f35b1..0c8f76d 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -21,14 +21,14 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 50], )] -class AbortedConnectsInfoBox extends AbstractInfoBox +readonly class AbortedConnectsInfoBox extends AbstractInfoBox { protected const TITLE = 'Aborted Connects'; public function renderBody(): string { - if (!isset($this->getStatusValues()['Aborted_connects'])) { + if (!isset($this->statusValues['Aborted_connects'])) { return ''; } @@ -39,7 +39,7 @@ public function renderBody(): string return sprintf( implode(' ', $content), - $this->getStatusValues()['Aborted_connects'], + $this->statusValues['Aborted_connects'], ); } } diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index d85479b..6b24320 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -22,14 +22,14 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -class BackLogInfoBox extends AbstractInfoBox +readonly class BackLogInfoBox extends AbstractInfoBox { protected const TITLE = 'Back Log'; public function renderBody(): string { - if (!isset($this->getVariables()['back_log'])) { + if (!isset($this->variables['back_log'])) { return ''; } @@ -44,7 +44,7 @@ public function renderBody(): string return sprintf( implode(' ', $content), - $this->getVariables()['back_log'], + $this->variables['back_log'], $this->getMaxNetworkRequests(), ); } diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index 46bf310..e616214 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -20,7 +20,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -class BinaryLogInfoBox extends AbstractInfoBox +readonly class BinaryLogInfoBox extends AbstractInfoBox { protected const TITLE = 'Binary Log'; @@ -28,10 +28,10 @@ class BinaryLogInfoBox extends AbstractInfoBox public function renderBody(): string { if ( - isset($this->getStatusValues()['Slave_running']) + isset($this->statusValues['Slave_running']) && ( - strtolower($this->getStatusValues()['Slave_running']) === 'off' - || (int)$this->getStatusValues()['Slave_running'] === 0 + strtolower($this->statusValues['Slave_running']) === 'off' + || (int)$this->statusValues['Slave_running'] === 0 ) ) { $content = []; diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index 2181fe1..b340772 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -23,14 +23,14 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 90], )] -class MaxAllowedPacketInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +readonly class MaxAllowedPacketInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Max Packet Size'; public function renderBody(): string { - if (!isset($this->getVariables()['max_allowed_packet'])) { + if (!isset($this->variables['max_allowed_packet'])) { return ''; } @@ -52,7 +52,7 @@ public function getUnorderedList(): \SplQueue $unorderedList->enqueue(new ListElement( title: 'Max allowed packet size in bytes (max_allowed_packet)', - value: $this->getVariables()['max_allowed_packet'], + value: $this->variables['max_allowed_packet'], )); return $unorderedList; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index 55b64ca..b9b6066 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -20,14 +20,14 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -class StandaloneReplicationInfoBox extends AbstractInfoBox +readonly class StandaloneReplicationInfoBox extends AbstractInfoBox { protected const TITLE = 'Standalone or Replication'; public function renderBody(): string { - if (!isset($this->getStatusValues()['Slave_running'])) { + if (!isset($this->statusValues['Slave_running'])) { return ''; } @@ -39,7 +39,7 @@ public function renderBody(): string return sprintf( implode(' ', $content), - $this->getStatusValues()['Slave_running'], + $this->statusValues['Slave_running'], ); } } diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index b9b5533..be9cdb0 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -20,7 +20,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -class SyncBinaryLogInfoBox extends AbstractInfoBox +readonly class SyncBinaryLogInfoBox extends AbstractInfoBox { protected const TITLE = 'Sync Binary Log'; @@ -28,7 +28,7 @@ class SyncBinaryLogInfoBox extends AbstractInfoBox public function renderBody(): string { // Sync_binlog does not exist on MariaDB - if (!isset($this->getStatusValues()['Sync_binlog'])) { + if (!isset($this->statusValues['Sync_binlog'])) { return ''; } @@ -41,7 +41,7 @@ public function renderBody(): string return sprintf( implode(' ', $content), - $this->getStatusValues()['Sync_binlog'] ? 'ON' : 'OFF', + $this->statusValues['Sync_binlog'] ? 'ON' : 'OFF', ); } } diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 344e2f5..27befbd 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 80], )] -class TempTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +readonly class TempTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Temporary Tables'; @@ -47,34 +47,34 @@ public function getUnorderedList(): \SplQueue $unorderedList = new \SplQueue(); if (isset( - $this->getVariables()['tmp_table_size'], - $this->getVariables()['max_heap_table_size'], + $this->variables['tmp_table_size'], + $this->variables['max_heap_table_size'], )) { $unorderedList->enqueue(new ListElement( title: 'Configured max size of temp table while query (tmp_table_size)', - value: $this->getVariables()['tmp_table_size'], + value: $this->variables['tmp_table_size'], )); $unorderedList->enqueue(new ListElement( title: 'Configured max size of in-memory table YOU can create (max_heap_table_size)', - value: $this->getVariables()['max_heap_table_size'], + value: $this->variables['max_heap_table_size'], )); $unorderedList->enqueue(new ListElement( title: 'Real max size. Lowest value of tmp_table_size/max_heap_table_size wins', - value: $this->getVariables()['max_heap_table_size'] < $this->getVariables()['tmp_table_size'] - ? $this->getVariables()['max_heap_table_size'] - : $this->getVariables()['tmp_table_size'], + value: $this->variables['max_heap_table_size'] < $this->variables['tmp_table_size'] + ? $this->variables['max_heap_table_size'] + : $this->variables['tmp_table_size'], )); } - if (isset($this->getStatusValues()['Created_tmp_disk_tables'])) { + if (isset($this->statusValues['Created_tmp_disk_tables'])) { $unorderedList->enqueue(new ListElement( title: 'Created temporary tables on disk since server start', - value: $this->getStatusValues()['Created_tmp_disk_tables'], + value: $this->statusValues['Created_tmp_disk_tables'], )); $unorderedList->enqueue(new ListElement( title: 'Created temporary tables on disk in seconds', value: number_format( - $this->getStatusValues()['Created_tmp_disk_tables'] / $this->getStatusValues()['Uptime'], + $this->statusValues['Created_tmp_disk_tables'] / $this->statusValues['Uptime'], 2, ',', '.', @@ -82,15 +82,15 @@ public function getUnorderedList(): \SplQueue )); } - if (isset($this->getStatusValues()['Created_tmp_tables'])) { + if (isset($this->statusValues['Created_tmp_tables'])) { $unorderedList->enqueue(new ListElement( title: 'Created temporary tables on disk and ram since server start', - value: $this->getStatusValues()['Created_tmp_tables'], + value: $this->statusValues['Created_tmp_tables'], )); $unorderedList->enqueue(new ListElement( title: 'Created temporary tables on disk and ram in seconds', value: number_format( - $this->getStatusValues()['Created_tmp_tables'] / $this->getStatusValues()['Uptime'], + $this->statusValues['Created_tmp_tables'] / $this->statusValues['Uptime'], 2, ',', '.', @@ -101,13 +101,13 @@ public function getUnorderedList(): \SplQueue // If not set, InnoDB is the new default $unorderedList->enqueue(new ListElement( title: 'Storage engine for temp. tables on disk', - value: $this->getVariables()['internal_tmp_disk_storage_engine'] ?? 'InnoDB', + value: $this->variables['internal_tmp_disk_storage_engine'] ?? 'InnoDB', )); // If not set, MEMORY was the old default $unorderedList->enqueue(new ListElement( title: 'Storage engine for temp. tables in ram', - value: $this->getVariables()['internal_tmp_mem_storage_engine'] ?? 'MEMORY', + value: $this->variables['internal_tmp_mem_storage_engine'] ?? 'MEMORY', )); return $unorderedList; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index f5c7f3b..23360e0 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -class AverageQuerySizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class AverageQuerySizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Average Query Size'; @@ -38,9 +38,9 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { if ( - !isset($this->getStatusValues()['Qcache_queries_in_cache']) - || (int)$this->getStatusValues()['Qcache_queries_in_cache'] === 0 - || !$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables()) + !isset($this->statusValues['Qcache_queries_in_cache']) + || (int)$this->statusValues['Qcache_queries_in_cache'] === 0 + || !$this->queryCacheHelper->isQueryCacheEnabled($this->variables) ) { return ''; } @@ -51,13 +51,13 @@ public function renderBody(): string return sprintf( implode(' ', $content), $this->getAvgQuerySize(), - $this->getVariables()['query_cache_min_res_unit'], + $this->variables['query_cache_min_res_unit'], ); } protected function getAvgQuerySize(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $avgQuerySize = 0; if ($status['Qcache_queries_in_cache']) { @@ -69,8 +69,8 @@ protected function getAvgQuerySize(): float protected function getUsedQueryCacheSize(): int { - $status = $this->getStatusValues(); - $variables = $this->getVariables(); + $status = $this->statusValues; + $variables = $this->variables; // ~40KB are reserved by the operating system $queryCacheSize = $variables['query_cache_size'] - (40 * 1024); @@ -80,7 +80,7 @@ protected function getUsedQueryCacheSize(): int public function getState(): StateEnumeration { - $variables = $this->getVariables(); + $variables = $this->variables; $avgQuerySize = $this->getAvgQuerySize(); if ($avgQuerySize > $variables['query_cache_min_res_unit']) { diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 4dcda8d..35aa106 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -class AverageUsedBlocksInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +readonly class AverageUsedBlocksInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Average Used Blocks'; @@ -38,9 +38,9 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { if ( - !isset($this->getStatusValues()['Qcache_queries_in_cache']) - || (int)$this->getStatusValues()['Qcache_queries_in_cache'] === 0 - || !$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables()) + !isset($this->statusValues['Qcache_queries_in_cache']) + || (int)$this->statusValues['Qcache_queries_in_cache'] === 0 + || !$this->queryCacheHelper->isQueryCacheEnabled($this->variables) ) { return ''; } @@ -52,7 +52,7 @@ public function renderBody(): string return sprintf( implode(' ', $content), $this->getAvgUsedBlocks(), - $this->getVariables()['query_cache_limit'], + $this->variables['query_cache_limit'], ); } @@ -65,7 +65,7 @@ public function renderBody(): string */ protected function getAvgUsedBlocks(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $avgUsedBlocks = 0; $usedBlocks = $status['Qcache_total_blocks'] - $status['Qcache_free_blocks']; diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 7b5e0ea..1ad0cdf 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -class FragmentationRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class FragmentationRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Fragmentation Ratio'; @@ -38,9 +38,9 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { if ( - !isset($this->getStatusValues()['Qcache_total_blocks']) - || (int)$this->getStatusValues()['Qcache_total_blocks'] === 0 - || !$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables()) + !isset($this->statusValues['Qcache_total_blocks']) + || (int)$this->statusValues['Qcache_total_blocks'] === 0 + || !$this->queryCacheHelper->isQueryCacheEnabled($this->variables) ) { return ''; } @@ -61,7 +61,7 @@ public function renderBody(): string protected function getFragmentationRatio(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; // total blocks / 2 = maximum fragmentation $fragmentation = ($status['Qcache_free_blocks'] / ($status['Qcache_total_blocks'] / 2)) * 100; diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index 173cbbd..fbc8d4f 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio'; @@ -39,9 +39,9 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { if ( - !isset($this->getStatusValues()['Qcache_hits']) - || (int)$this->getStatusValues()['Qcache_hits'] === 0 - || !$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables()) + !isset($this->statusValues['Qcache_hits']) + || (int)$this->statusValues['Qcache_hits'] === 0 + || !$this->queryCacheHelper->isQueryCacheEnabled($this->variables) ) { return ''; } @@ -59,7 +59,7 @@ public function renderBody(): string protected function getHitRatio(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $hitRatio = ($status['Qcache_hits'] / ($status['Qcache_hits'] + $status['Com_select'])) * 100; diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index 082309f..c3edcda 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -class InsertRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class InsertRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Insert Ratio'; @@ -39,9 +39,9 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { if ( - !isset($this->getStatusValues()['Qcache_hits']) - || (int)$this->getStatusValues()['Qcache_hits'] === 0 - || !$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables()) + !isset($this->statusValues['Qcache_hits']) + || (int)$this->statusValues['Qcache_hits'] === 0 + || !$this->queryCacheHelper->isQueryCacheEnabled($this->variables) ) { return ''; } @@ -61,7 +61,7 @@ public function renderBody(): string protected function getInsertRatio(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $insertRatio = ($status['Qcache_inserts'] / ($status['Qcache_hits'] + $status['Com_select'])) * 100; diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index 688207e..3aaf639 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -class PruneRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class PruneRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Prune Ratio'; @@ -39,9 +39,9 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { if ( - !isset($this->getStatusValues()['Qcache_inserts']) - || (int)$this->getStatusValues()['Qcache_inserts'] === 0 - || !$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables()) + !isset($this->statusValues['Qcache_inserts']) + || (int)$this->statusValues['Qcache_inserts'] === 0 + || !$this->queryCacheHelper->isQueryCacheEnabled($this->variables) ) { return ''; } @@ -69,7 +69,7 @@ public function renderBody(): string protected function getPruneRatio(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $pruneRatio = 0; if ($status['Qcache_inserts']) { diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index 7d03b94..1cc53f3 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -class QueryCacheSizeTooHighInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class QueryCacheSizeTooHighInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Query Cache too high'; @@ -38,13 +38,13 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { if ( - !isset($this->getVariables()['query_cache_size']) - || !$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables()) + !isset($this->variables['query_cache_size']) + || !$this->queryCacheHelper->isQueryCacheEnabled($this->variables) ) { return ''; } - if ($this->getVariables()['query_cache_size'] < 268435456) { + if ($this->variables['query_cache_size'] < 268435456) { return ''; } diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index 555a75e..5bf38a6 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 90], )] -class QueryCacheStatusInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class QueryCacheStatusInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Query Cache Status'; @@ -38,11 +38,11 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void public function renderBody(): string { - if (!$this->queryCacheHelper->isQueryCacheEnabled($this->getVariables())) { + if (!$this->queryCacheHelper->isQueryCacheEnabled($this->variables)) { return 'Query Cache is not activated'; } - if ((int)($this->getVariables()['query_cache_size']) === 0) { + if ((int)($this->variables['query_cache_size']) === 0) { return 'Query Cache is activated, but query_cache_size can not be 0'; } diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index 9401096..e944f9b 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -27,14 +27,14 @@ name: 'mysqlreport.infobox.table_cache', attributes: ['priority' => 80], )] -class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +readonly class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { protected const TITLE = 'Opened Table Definitions'; public function renderBody(): string { - if (!isset($this->getStatusValues()['Opened_table_definitions'])) { + if (!isset($this->statusValues['Opened_table_definitions'])) { return ''; } @@ -47,7 +47,7 @@ public function renderBody(): string */ protected function getOpenedTableDefinitionsEachSecond(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $openedTableDefinitions = $status['Opened_table_definitions'] / $status['Uptime']; @@ -63,17 +63,17 @@ public function getUnorderedList(): \SplQueue $unorderedList->enqueue(new ListElement( title: 'Opened tables since server start (Opened_table_definitions)', - value: $this->getStatusValues()['Opened_table_definitions'], + value: $this->statusValues['Opened_table_definitions'], )); $unorderedList->enqueue(new ListElement( title: 'Open tables in cache (Open_table_definitions)', - value: $this->getStatusValues()['Open_table_definitions'], + value: $this->statusValues['Open_table_definitions'], )); $unorderedList->enqueue(new ListElement( title: 'Max allowed tables in cache (table_definition_cache)', - value: $this->getVariables()['table_definition_cache'], + value: $this->variables['table_definition_cache'], )); $unorderedList->enqueue(new ListElement( diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index 35a7a90..53c3625 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -27,14 +27,14 @@ name: 'mysqlreport.infobox.table_cache', attributes: ['priority' => 90], )] -class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +readonly class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { protected const TITLE = 'Opened Tables'; public function renderBody(): string { - if (!isset($this->getStatusValues()['Opened_tables'])) { + if (!isset($this->statusValues['Opened_tables'])) { return ''; } @@ -50,7 +50,7 @@ public function renderBody(): string */ protected function getOpenedTablesEachSecond(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $openedTables = $status['Opened_tables'] / $status['Uptime']; return round($openedTables, 4); @@ -65,28 +65,28 @@ public function getUnorderedList(): \SplQueue $unorderedList->enqueue(new ListElement( title: 'Opened tables since server start (Opened_tables)', - value: $this->getStatusValues()['Opened_tables'], + value: $this->statusValues['Opened_tables'], )); $unorderedList->enqueue(new ListElement( title: 'Open tables in cache (Open_tables)', - value: $this->getStatusValues()['Open_tables'], + value: $this->statusValues['Open_tables'], )); $unorderedList->enqueue(new ListElement( title: 'Max allowed tables in cache (table_open_cache)', - value: $this->getVariables()['table_open_cache'], + value: $this->variables['table_open_cache'], )); $unorderedList->enqueue(new ListElement( title: 'Max file descriptors the mysqld process can use (open_files_limit)', - value: $this->getVariables()['open_files_limit'], + value: $this->variables['open_files_limit'], )); $unorderedList->enqueue(new ListElement( title: 'Calculated table_open_cache with 5 tables and 2 reserved file descriptors', value: number_format( - $this->getVariables()['max_connections'] * (5 + 2), + $this->variables['max_connections'] * (5 + 2), 0, ',', '.', @@ -96,7 +96,7 @@ public function getUnorderedList(): \SplQueue $unorderedList->enqueue(new ListElement( title: 'Calculated table_open_cache with 8 tables and 3 reserved file descriptors', value: number_format( - $this->getVariables()['max_connections'] * (8 + 3), + $this->variables['max_connections'] * (8 + 3), 0, ',', '.', diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index a934518..db51d5b 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -22,14 +22,14 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.thread_cache', )] -class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio'; public function renderBody(): string { - if (!isset($this->getVariables()['thread_cache_size'])) { + if (!isset($this->variables['thread_cache_size'])) { return ''; } @@ -37,12 +37,12 @@ public function renderBody(): string $content[] = 'As closer to 100%% as better.'; $content[] = "\n\n"; - if ((int)$this->getVariables()['thread_cache_size'] === 0) { + if ((int)$this->variables['thread_cache_size'] === 0) { $content[] = 'Your thread_cache_size (0) is not activated. Please set this value 10.'; - } elseif ($this->getStatusValues()['Threads_connected'] < $this->getVariables()['thread_cache_size']) { + } elseif ($this->statusValues['Threads_connected'] < $this->variables['thread_cache_size']) { $content[] = 'It seems that you are the only person on this MySQL-Server, so this value should be OK.'; } else { - $content[] = 'It seems that your thread_cache_size (' . $this->getVariables()['thread_cache_size'] . ') is too low.'; + $content[] = 'It seems that your thread_cache_size (' . $this->variables['thread_cache_size'] . ') is too low.'; $content[] = 'Please increase this value in 10th steps.'; } @@ -61,7 +61,7 @@ public function renderBody(): string */ protected function getHitRatio(): float { - $status = $this->getStatusValues(); + $status = $this->statusValues; $hitRatio = 100 - (($status['Threads_created'] / $status['Connections']) * 100); From 3def9a5f0c057d5d214be00db35bf283daea8605 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:32:52 +0200 Subject: [PATCH 04/27] [TASK] Declare InfoBox subclasses as final Declare all concrete InfoBox subclasses, the ListElement DTO, and the RenderInfoBoxFactory as final classes. This prevents inheritance and enforces better encapsulation in the InfoBox system. --- Classes/InfoBox/Information/ConnectionInfoBox.php | 2 +- Classes/InfoBox/Information/ServerVersionInfoBox.php | 2 +- Classes/InfoBox/Information/UptimeInfoBox.php | 2 +- Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php | 2 +- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 2 +- Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php | 2 +- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 2 +- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 2 +- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 2 +- Classes/InfoBox/ListElement.php | 2 +- Classes/InfoBox/Misc/AbortedConnectsInfoBox.php | 2 +- Classes/InfoBox/Misc/BackLogInfoBox.php | 2 +- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 2 +- Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php | 2 +- Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php | 2 +- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 2 +- Classes/InfoBox/Misc/TempTablesInfoBox.php | 2 +- Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php | 2 +- Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php | 2 +- Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/HitRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/InsertRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/PruneRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php | 2 +- Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php | 2 +- Classes/InfoBox/RenderInfoBoxFactory.php | 2 +- Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php | 2 +- Classes/InfoBox/TableCache/OpenedTablesInfoBox.php | 2 +- Classes/InfoBox/ThreadCache/HitRatioInfoBox.php | 2 +- 29 files changed, 29 insertions(+), 29 deletions(-) diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index 5f0f17e..3ee0ac8 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -25,7 +25,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 30], )] -readonly class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +final readonly class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { protected const TITLE = 'Connections'; diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index c5035e5..668d53c 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 90], )] -readonly class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Server Information'; diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index 9ff19a7..19ec927 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 80], )] -readonly class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Uptime'; diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 98c10d6..18f2e6b 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 40], )] -readonly class HitRatioBySFInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioBySFInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio by SF'; diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index f954d55..e9fb3b0 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 50], )] -readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio'; diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 60e00ad..86bacf7 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 90], )] -readonly class InnoDbBufferLoadInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class InnoDbBufferLoadInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'InnoDB Buffer Load'; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index c889be9..173ee86 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -22,7 +22,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -readonly class InstancesInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class InstancesInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Instances'; diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index 0acda58..71bda1c 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -22,7 +22,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -readonly class LogFileSizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class LogFileSizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Log File Size'; diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index bcdcebb..dc27f79 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -22,7 +22,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -readonly class WriteRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class WriteRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Write Ratio'; diff --git a/Classes/InfoBox/ListElement.php b/Classes/InfoBox/ListElement.php index 34d7c99..9dec842 100644 --- a/Classes/InfoBox/ListElement.php +++ b/Classes/InfoBox/ListElement.php @@ -11,7 +11,7 @@ namespace StefanFroemken\Mysqlreport\InfoBox; -readonly class ListElement +final readonly class ListElement { public function __construct( public string $title, diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index 0c8f76d..238635c 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -21,7 +21,7 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 50], )] -readonly class AbortedConnectsInfoBox extends AbstractInfoBox +final readonly class AbortedConnectsInfoBox extends AbstractInfoBox { protected const TITLE = 'Aborted Connects'; diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index 6b24320..e6eea58 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -22,7 +22,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -readonly class BackLogInfoBox extends AbstractInfoBox +final readonly class BackLogInfoBox extends AbstractInfoBox { protected const TITLE = 'Back Log'; diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index e616214..c7ef438 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -20,7 +20,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -readonly class BinaryLogInfoBox extends AbstractInfoBox +final readonly class BinaryLogInfoBox extends AbstractInfoBox { protected const TITLE = 'Binary Log'; diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index b340772..2c2ef35 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 90], )] -readonly class MaxAllowedPacketInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class MaxAllowedPacketInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Max Packet Size'; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index b9b6066..1b78f4c 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -20,7 +20,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -readonly class StandaloneReplicationInfoBox extends AbstractInfoBox +final readonly class StandaloneReplicationInfoBox extends AbstractInfoBox { protected const TITLE = 'Standalone or Replication'; diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index be9cdb0..22c1ccd 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -20,7 +20,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -readonly class SyncBinaryLogInfoBox extends AbstractInfoBox +final readonly class SyncBinaryLogInfoBox extends AbstractInfoBox { protected const TITLE = 'Sync Binary Log'; diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 27befbd..126757e 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -23,7 +23,7 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 80], )] -readonly class TempTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class TempTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Temporary Tables'; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index 23360e0..adafac2 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -readonly class AverageQuerySizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class AverageQuerySizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Average Query Size'; diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 35aa106..f50b4f0 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -readonly class AverageUsedBlocksInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class AverageUsedBlocksInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { protected const TITLE = 'Average Used Blocks'; diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 1ad0cdf..40d6f18 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -readonly class FragmentationRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class FragmentationRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Fragmentation Ratio'; diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index fbc8d4f..86793d1 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio'; diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index c3edcda..f22d9d5 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -readonly class InsertRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class InsertRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Insert Ratio'; diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index 3aaf639..31544e8 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -readonly class PruneRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class PruneRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Prune Ratio'; diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index 1cc53f3..a0ef252 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -readonly class QueryCacheSizeTooHighInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class QueryCacheSizeTooHighInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Query Cache too high'; diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index 5bf38a6..a301b0e 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 90], )] -readonly class QueryCacheStatusInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class QueryCacheStatusInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Query Cache Status'; diff --git a/Classes/InfoBox/RenderInfoBoxFactory.php b/Classes/InfoBox/RenderInfoBoxFactory.php index c7b5432..1b58022 100644 --- a/Classes/InfoBox/RenderInfoBoxFactory.php +++ b/Classes/InfoBox/RenderInfoBoxFactory.php @@ -15,7 +15,7 @@ use TYPO3\CMS\Core\View\ViewFactoryInterface; use TYPO3\CMS\Core\View\ViewInterface; -class RenderInfoBoxFactory +final class RenderInfoBoxFactory { private const TEMPLATE_FILE = 'EXT:mysqlreport/Resources/Private/Templates/InfoBox/Default.html'; diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index e944f9b..1469b19 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -27,7 +27,7 @@ name: 'mysqlreport.infobox.table_cache', attributes: ['priority' => 80], )] -readonly class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +final readonly class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { protected const TITLE = 'Opened Table Definitions'; diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index 53c3625..fb7058d 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -27,7 +27,7 @@ name: 'mysqlreport.infobox.table_cache', attributes: ['priority' => 90], )] -readonly class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +final readonly class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { protected const TITLE = 'Opened Tables'; diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index db51d5b..f73a72e 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -22,7 +22,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.thread_cache', )] -readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { protected const TITLE = 'Hit Ratio'; From 9e9d5ee6b75ffc87227d77b51ce54abe447b7658 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:38:41 +0200 Subject: [PATCH 05/27] [TASK] Decouple InfoBox classes from ViewInterface Remove the updateView method and ViewInterface dependencies from AbstractInfoBox. Delegate view variable assignment and rendering to RenderInfoBoxFactory. Additionally, rename the abstract renderBody method to getBody in the base class and all subclasses. --- Classes/InfoBox/AbstractInfoBox.php | 24 ++++--------------- .../InfoBox/Information/ConnectionInfoBox.php | 2 +- .../Information/ServerVersionInfoBox.php | 2 +- Classes/InfoBox/Information/UptimeInfoBox.php | 2 +- .../InfoBox/InnoDb/HitRatioBySFInfoBox.php | 2 +- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 2 +- .../InnoDb/InnoDbBufferLoadInfoBox.php | 2 +- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 2 +- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 2 +- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 2 +- .../InfoBox/Misc/AbortedConnectsInfoBox.php | 2 +- Classes/InfoBox/Misc/BackLogInfoBox.php | 2 +- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 2 +- .../InfoBox/Misc/MaxAllowedPacketInfoBox.php | 2 +- .../Misc/StandaloneReplicationInfoBox.php | 2 +- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 2 +- Classes/InfoBox/Misc/TempTablesInfoBox.php | 2 +- .../QueryCache/AverageQuerySizeInfoBox.php | 2 +- .../QueryCache/AverageUsedBlocksInfoBox.php | 2 +- .../QueryCache/FragmentationRatioInfoBox.php | 2 +- .../InfoBox/QueryCache/HitRatioInfoBox.php | 2 +- .../InfoBox/QueryCache/InsertRatioInfoBox.php | 2 +- .../InfoBox/QueryCache/PruneRatioInfoBox.php | 2 +- .../QueryCacheSizeTooHighInfoBox.php | 2 +- .../QueryCache/QueryCacheStatusInfoBox.php | 2 +- Classes/InfoBox/RenderInfoBoxFactory.php | 19 +++++++++++++-- .../OpenedTableDefinitionsInfoBox.php | 2 +- .../TableCache/OpenedTablesInfoBox.php | 2 +- .../InfoBox/ThreadCache/HitRatioInfoBox.php | 2 +- 29 files changed, 48 insertions(+), 49 deletions(-) diff --git a/Classes/InfoBox/AbstractInfoBox.php b/Classes/InfoBox/AbstractInfoBox.php index dd44f53..ac1a80e 100644 --- a/Classes/InfoBox/AbstractInfoBox.php +++ b/Classes/InfoBox/AbstractInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use TYPO3\CMS\Core\View\ViewInterface; /** * Model with properties for panels you can see in BE module @@ -27,25 +26,10 @@ public function __construct( protected Variables $variables, ) {} - abstract public function renderBody(): string; - - public function updateView(ViewInterface $view): ?ViewInterface + public function getTitle(): string { - if (($body = $this->renderBody()) === '') { - return null; - } - - $view->assign('title', static::TITLE); - $view->assign('body', $body); - - if ($this instanceof InfoBoxUnorderedListInterface) { - $view->assign('unorderedList', $this->getUnorderedList()); - } - - if ($this instanceof InfoBoxStateInterface) { - $view->assign('state', $this->getState()->value); - } - - return $view; + return static::TITLE; } + + abstract public function getBody(): string; } diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index 3ee0ac8..2e743f0 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -30,7 +30,7 @@ protected const TITLE = 'Connections'; - public function renderBody(): string + public function getBody(): string { return 'Keep an eye on your server\'s connections. ' . 'It is a first indicator of how much work your server has to do. ' diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index 668d53c..2fe9fad 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -28,7 +28,7 @@ protected const TITLE = 'Server Information'; - public function renderBody(): string + public function getBody(): string { return 'The following server information was found:'; } diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index 19ec927..b3e57f8 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -28,7 +28,7 @@ protected const TITLE = 'Uptime'; - public function renderBody(): string + public function getBody(): string { return '"Uptime" shows the time since the server was started or restarted. ' . 'Database administrators can execute "FLUSH STATUS" to reset various status variables. ' diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 18f2e6b..9222622 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -28,7 +28,7 @@ protected const TITLE = 'Hit Ratio by SF'; - public function renderBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index e9fb3b0..6bda7d5 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -28,7 +28,7 @@ protected const TITLE = 'Hit Ratio'; - public function renderBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 86bacf7..0710e74 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -29,7 +29,7 @@ protected const TITLE = 'InnoDB Buffer Load'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->statusValues['Innodb_page_size'])) { return ''; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index 173ee86..70269c3 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -27,7 +27,7 @@ protected const TITLE = 'Instances'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->statusValues['Innodb_page_size'])) { return ''; diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index 71bda1c..cc828cd 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -27,7 +27,7 @@ protected const TITLE = 'Log File Size'; - public function renderBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index dc27f79..4c16d91 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -27,7 +27,7 @@ protected const TITLE = 'Write Ratio'; - public function renderBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index 238635c..07f9eed 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -26,7 +26,7 @@ protected const TITLE = 'Aborted Connects'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->statusValues['Aborted_connects'])) { return ''; diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index e6eea58..7b02981 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -27,7 +27,7 @@ protected const TITLE = 'Back Log'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->variables['back_log'])) { return ''; diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index c7ef438..81233dd 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -25,7 +25,7 @@ protected const TITLE = 'Binary Log'; - public function renderBody(): string + public function getBody(): string { if ( isset($this->statusValues['Slave_running']) diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index 2c2ef35..6b0974c 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -28,7 +28,7 @@ protected const TITLE = 'Max Packet Size'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->variables['max_allowed_packet'])) { return ''; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index 1b78f4c..493f003 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -25,7 +25,7 @@ protected const TITLE = 'Standalone or Replication'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->statusValues['Slave_running'])) { return ''; diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index 22c1ccd..a532045 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -25,7 +25,7 @@ protected const TITLE = 'Sync Binary Log'; - public function renderBody(): string + public function getBody(): string { // Sync_binlog does not exist on MariaDB if (!isset($this->statusValues['Sync_binlog'])) { diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 126757e..cbb28cb 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -28,7 +28,7 @@ protected const TITLE = 'Temporary Tables'; - public function renderBody(): string + public function getBody(): string { $content = []; $content[] = 'While JOIN and GROUP BY the server needs a lot of memory to manage the requested data.'; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index adafac2..8830d5c 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -35,7 +35,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if ( !isset($this->statusValues['Qcache_queries_in_cache']) diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index f50b4f0..bd9a5e0 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -35,7 +35,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if ( !isset($this->statusValues['Qcache_queries_in_cache']) diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 40d6f18..a94823c 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -35,7 +35,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if ( !isset($this->statusValues['Qcache_total_blocks']) diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index 86793d1..9fd49e8 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -36,7 +36,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if ( !isset($this->statusValues['Qcache_hits']) diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index f22d9d5..6a316de 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -36,7 +36,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if ( !isset($this->statusValues['Qcache_hits']) diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index 31544e8..9a2449e 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -36,7 +36,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if ( !isset($this->statusValues['Qcache_inserts']) diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index a0ef252..e7f15dd 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -35,7 +35,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if ( !isset($this->variables['query_cache_size']) diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index a301b0e..3db5c2b 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -36,7 +36,7 @@ public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void $this->queryCacheHelper = $queryCacheHelper; } - public function renderBody(): string + public function getBody(): string { if (!$this->queryCacheHelper->isQueryCacheEnabled($this->variables)) { return 'Query Cache is not activated'; diff --git a/Classes/InfoBox/RenderInfoBoxFactory.php b/Classes/InfoBox/RenderInfoBoxFactory.php index 1b58022..bea0315 100644 --- a/Classes/InfoBox/RenderInfoBoxFactory.php +++ b/Classes/InfoBox/RenderInfoBoxFactory.php @@ -30,9 +30,24 @@ public function render(iterable $infoBoxes): string { $renderedInfoBoxes = ''; foreach ($infoBoxes as $infoBox) { - if ($view = $infoBox->updateView($this->getViewForInfoBox())) { - $renderedInfoBoxes .= $view->render(); + $body = $infoBox->getBody(); + if ($body === '') { + continue; } + + $view = $this->getViewForInfoBox(); + $view->assign('title', $infoBox->getTitle()); + $view->assign('body', $body); + + if ($infoBox instanceof InfoBoxUnorderedListInterface) { + $view->assign('unorderedList', $infoBox->getUnorderedList()); + } + + if ($infoBox instanceof InfoBoxStateInterface) { + $view->assign('state', $infoBox->getState()->value); + } + + $renderedInfoBoxes .= $view->render(); } return $renderedInfoBoxes; diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index 1469b19..02c0780 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -32,7 +32,7 @@ protected const TITLE = 'Opened Table Definitions'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->statusValues['Opened_table_definitions'])) { return ''; diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index fb7058d..b14b4b3 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -32,7 +32,7 @@ protected const TITLE = 'Opened Tables'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->statusValues['Opened_tables'])) { return ''; diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index f73a72e..e604c69 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -27,7 +27,7 @@ protected const TITLE = 'Hit Ratio'; - public function renderBody(): string + public function getBody(): string { if (!isset($this->variables['thread_cache_size'])) { return ''; From d1cf322cbea532c05c3e64857f81594a582ce883 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:42:33 +0200 Subject: [PATCH 06/27] [TASK] Introduce InfoBoxInterface to define TITLE Create InfoBoxInterface defining the TITLE constant and getBody. Update AbstractInfoBox to implement this interface and remove its local TITLE constant and getTitle method. Change all InfoBox subclasses to declare TITLE as public. Read the constant dynamically in the factory. --- Classes/InfoBox/AbstractInfoBox.php | 9 +-------- Classes/InfoBox/InfoBoxInterface.php | 19 +++++++++++++++++++ .../InfoBox/Information/ConnectionInfoBox.php | 2 +- .../Information/ServerVersionInfoBox.php | 2 +- Classes/InfoBox/Information/UptimeInfoBox.php | 2 +- .../InfoBox/InnoDb/HitRatioBySFInfoBox.php | 2 +- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 2 +- .../InnoDb/InnoDbBufferLoadInfoBox.php | 2 +- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 2 +- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 2 +- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 2 +- .../InfoBox/Misc/AbortedConnectsInfoBox.php | 2 +- Classes/InfoBox/Misc/BackLogInfoBox.php | 2 +- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 2 +- .../InfoBox/Misc/MaxAllowedPacketInfoBox.php | 2 +- .../Misc/StandaloneReplicationInfoBox.php | 2 +- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 2 +- Classes/InfoBox/Misc/TempTablesInfoBox.php | 2 +- .../QueryCache/AverageQuerySizeInfoBox.php | 2 +- .../QueryCache/AverageUsedBlocksInfoBox.php | 2 +- .../QueryCache/FragmentationRatioInfoBox.php | 2 +- .../InfoBox/QueryCache/HitRatioInfoBox.php | 2 +- .../InfoBox/QueryCache/InsertRatioInfoBox.php | 2 +- .../InfoBox/QueryCache/PruneRatioInfoBox.php | 2 +- .../QueryCacheSizeTooHighInfoBox.php | 2 +- .../QueryCache/QueryCacheStatusInfoBox.php | 2 +- Classes/InfoBox/RenderInfoBoxFactory.php | 4 ++-- .../OpenedTableDefinitionsInfoBox.php | 2 +- .../TableCache/OpenedTablesInfoBox.php | 2 +- .../InfoBox/ThreadCache/HitRatioInfoBox.php | 2 +- 30 files changed, 49 insertions(+), 37 deletions(-) create mode 100644 Classes/InfoBox/InfoBoxInterface.php diff --git a/Classes/InfoBox/AbstractInfoBox.php b/Classes/InfoBox/AbstractInfoBox.php index ac1a80e..a9472c9 100644 --- a/Classes/InfoBox/AbstractInfoBox.php +++ b/Classes/InfoBox/AbstractInfoBox.php @@ -17,19 +17,12 @@ /** * Model with properties for panels you can see in BE module */ -abstract readonly class AbstractInfoBox +abstract readonly class AbstractInfoBox implements InfoBoxInterface { - protected const TITLE = ''; - public function __construct( protected StatusValues $statusValues, protected Variables $variables, ) {} - public function getTitle(): string - { - return static::TITLE; - } - abstract public function getBody(): string; } diff --git a/Classes/InfoBox/InfoBoxInterface.php b/Classes/InfoBox/InfoBoxInterface.php new file mode 100644 index 0000000..47a12cf --- /dev/null +++ b/Classes/InfoBox/InfoBoxInterface.php @@ -0,0 +1,19 @@ + $infoBoxes + * @param iterable $infoBoxes */ public function render(iterable $infoBoxes): string { @@ -36,7 +36,7 @@ public function render(iterable $infoBoxes): string } $view = $this->getViewForInfoBox(); - $view->assign('title', $infoBox->getTitle()); + $view->assign('title', $infoBox::TITLE); $view->assign('body', $body); if ($infoBox instanceof InfoBoxUnorderedListInterface) { diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index 02c0780..5c42163 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -30,7 +30,7 @@ final readonly class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { - protected const TITLE = 'Opened Table Definitions'; + public const TITLE = 'Opened Table Definitions'; public function getBody(): string { diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index b14b4b3..25bcae8 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -30,7 +30,7 @@ final readonly class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { - protected const TITLE = 'Opened Tables'; + public const TITLE = 'Opened Tables'; public function getBody(): string { diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index e604c69..eb7c398 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -25,7 +25,7 @@ final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { - protected const TITLE = 'Hit Ratio'; + public const TITLE = 'Hit Ratio'; public function getBody(): string { From 3e0f9e8eac4e22364695a36e532cf56812963181 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:45:49 +0200 Subject: [PATCH 07/27] [TASK] Remove abstract getBody method from AbstractInfoBox Remove the abstract getBody method declaration from the AbstractInfoBox base class. Since AbstractInfoBox implements InfoBoxInterface and all concrete subclasses implement getBody, the explicit abstract method declaration is redundant. --- Classes/InfoBox/AbstractInfoBox.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Classes/InfoBox/AbstractInfoBox.php b/Classes/InfoBox/AbstractInfoBox.php index a9472c9..c6530ba 100644 --- a/Classes/InfoBox/AbstractInfoBox.php +++ b/Classes/InfoBox/AbstractInfoBox.php @@ -24,5 +24,4 @@ public function __construct( protected Variables $variables, ) {} - abstract public function getBody(): string; } From 2f289483811ddd901b0545fba9ef603bb892f508 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:49:21 +0200 Subject: [PATCH 08/27] [TASK] Move constructor to each individual InfoBox subclass Remove the constructor declaration from AbstractInfoBox. Define a local constructor in each of the 27 InfoBox subclasses to inject StatusValues and Variables models directly. This removes the need to call parent::__construct inside the subclasses. --- Classes/InfoBox/AbstractInfoBox.php | 7 ------- Classes/InfoBox/Information/ConnectionInfoBox.php | 8 ++++++++ Classes/InfoBox/Information/ServerVersionInfoBox.php | 8 ++++++++ Classes/InfoBox/Information/UptimeInfoBox.php | 8 ++++++++ Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php | 8 ++++++++ Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 8 ++++++++ Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php | 8 ++++++++ Classes/InfoBox/InnoDb/InstancesInfoBox.php | 8 ++++++++ Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 8 ++++++++ Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 8 ++++++++ Classes/InfoBox/Misc/AbortedConnectsInfoBox.php | 8 ++++++++ Classes/InfoBox/Misc/BackLogInfoBox.php | 8 ++++++++ Classes/InfoBox/Misc/BinaryLogInfoBox.php | 8 ++++++++ Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php | 8 ++++++++ Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php | 8 ++++++++ Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 8 ++++++++ Classes/InfoBox/Misc/TempTablesInfoBox.php | 8 ++++++++ Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php | 8 ++++++++ Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php | 8 ++++++++ Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php | 8 ++++++++ Classes/InfoBox/QueryCache/HitRatioInfoBox.php | 8 ++++++++ Classes/InfoBox/QueryCache/InsertRatioInfoBox.php | 8 ++++++++ Classes/InfoBox/QueryCache/PruneRatioInfoBox.php | 8 ++++++++ .../InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php | 8 ++++++++ Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php | 8 ++++++++ .../InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php | 8 ++++++++ Classes/InfoBox/TableCache/OpenedTablesInfoBox.php | 8 ++++++++ Classes/InfoBox/ThreadCache/HitRatioInfoBox.php | 8 ++++++++ 28 files changed, 216 insertions(+), 7 deletions(-) diff --git a/Classes/InfoBox/AbstractInfoBox.php b/Classes/InfoBox/AbstractInfoBox.php index c6530ba..13c4884 100644 --- a/Classes/InfoBox/AbstractInfoBox.php +++ b/Classes/InfoBox/AbstractInfoBox.php @@ -11,17 +11,10 @@ namespace StefanFroemken\Mysqlreport\InfoBox; -use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; /** * Model with properties for panels you can see in BE module */ abstract readonly class AbstractInfoBox implements InfoBoxInterface { - public function __construct( - protected StatusValues $statusValues, - protected Variables $variables, - ) {} - } diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index 20b629d..419b885 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Information; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -27,6 +30,11 @@ )] final readonly class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Connections'; diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index 7a7ed4e..27bfad5 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Information; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -25,6 +28,11 @@ )] final readonly class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Server Information'; diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index 75b3c7a..ad14bf7 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Information; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -25,6 +28,11 @@ )] final readonly class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Uptime'; diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 9bdb919..0a36e88 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -25,6 +28,11 @@ )] final readonly class HitRatioBySFInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Hit Ratio by SF'; diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index be85e8f..5315af1 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -25,6 +28,11 @@ )] final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Hit Ratio'; diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 8f0b7c2..decee72 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -26,6 +29,11 @@ )] final readonly class InnoDbBufferLoadInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'InnoDB Buffer Load'; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index 88f4105..50ccfcb 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -24,6 +27,11 @@ )] final readonly class InstancesInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Instances'; diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index 9d4c6f1..281d195 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -24,6 +27,11 @@ )] final readonly class LogFileSizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Log File Size'; diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index ef7419a..3fa493b 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -24,6 +27,11 @@ )] final readonly class WriteRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Write Ratio'; diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index 74100a1..f462054 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -23,6 +26,11 @@ )] final readonly class AbortedConnectsInfoBox extends AbstractInfoBox { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Aborted Connects'; diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index 5d57697..0c18518 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; use TYPO3\CMS\Core\Utility\CommandUtility; @@ -24,6 +27,11 @@ )] final readonly class BackLogInfoBox extends AbstractInfoBox { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Back Log'; diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index 42472b0..2ba5696 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -22,6 +25,11 @@ )] final readonly class BinaryLogInfoBox extends AbstractInfoBox { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Binary Log'; diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index 0235555..bcdd854 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -25,6 +28,11 @@ )] final readonly class MaxAllowedPacketInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Max Packet Size'; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index 5ad17bd..b2ab5d1 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -22,6 +25,11 @@ )] final readonly class StandaloneReplicationInfoBox extends AbstractInfoBox { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Standalone or Replication'; diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index e588e92..0de9fe4 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -22,6 +25,11 @@ )] final readonly class SyncBinaryLogInfoBox extends AbstractInfoBox { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Sync Binary Log'; diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 9a4f373..5c9d719 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -25,6 +28,11 @@ )] final readonly class TempTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Temporary Tables'; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index a115292..e93179b 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; @@ -25,6 +28,11 @@ )] final readonly class AverageQuerySizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Average Query Size'; diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 5174133..8620b63 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; @@ -25,6 +28,11 @@ )] final readonly class AverageUsedBlocksInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Average Used Blocks'; diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index a1d32da..27ba0eb 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; @@ -25,6 +28,11 @@ )] final readonly class FragmentationRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Fragmentation Ratio'; diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index 17ef3d8..bb26cb1 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; @@ -26,6 +29,11 @@ )] final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Hit Ratio'; diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index 38b3a40..2d797a0 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; @@ -26,6 +29,11 @@ )] final readonly class InsertRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Insert Ratio'; diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index 1610e20..d17bdce 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; @@ -26,6 +29,11 @@ )] final readonly class PruneRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Prune Ratio'; diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index 5855fc4..5c98f13 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; @@ -25,6 +28,11 @@ )] final readonly class QueryCacheSizeTooHighInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Query Cache too high'; diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index 0e45b99..6b4f739 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; @@ -26,6 +29,11 @@ )] final readonly class QueryCacheStatusInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Query Cache Status'; diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index 5c42163..de3c780 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\TableCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -29,6 +32,11 @@ )] final readonly class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Opened Table Definitions'; diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index 25bcae8..d6f3d56 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\TableCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -29,6 +32,11 @@ )] final readonly class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Opened Tables'; diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index eb7c398..60209b4 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -11,6 +11,9 @@ namespace StefanFroemken\Mysqlreport\InfoBox\ThreadCache; +use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; +use StefanFroemken\Mysqlreport\Domain\Model\Variables; + use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -24,6 +27,11 @@ )] final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface { + public function __construct( + private StatusValues $statusValues, + private Variables $variables, + ) {} + public const TITLE = 'Hit Ratio'; From 7a93cc8817e41cd1aa69570d4897a07fb01c46ab Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:51:05 +0200 Subject: [PATCH 09/27] [TASK] Delete AbstractInfoBox class Remove the AbstractInfoBox base class completely from the project. Change all 27 InfoBox subclasses to directly implement the InfoBoxInterface instead of inheriting from AbstractInfoBox. --- Classes/InfoBox/AbstractInfoBox.php | 20 ------------------- .../InfoBox/Information/ConnectionInfoBox.php | 4 ++-- .../Information/ServerVersionInfoBox.php | 4 ++-- Classes/InfoBox/Information/UptimeInfoBox.php | 4 ++-- .../InfoBox/InnoDb/HitRatioBySFInfoBox.php | 4 ++-- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 4 ++-- .../InnoDb/InnoDbBufferLoadInfoBox.php | 4 ++-- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 4 ++-- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 4 ++-- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 4 ++-- .../InfoBox/Misc/AbortedConnectsInfoBox.php | 4 ++-- Classes/InfoBox/Misc/BackLogInfoBox.php | 4 ++-- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 4 ++-- .../InfoBox/Misc/MaxAllowedPacketInfoBox.php | 4 ++-- .../Misc/StandaloneReplicationInfoBox.php | 4 ++-- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 4 ++-- Classes/InfoBox/Misc/TempTablesInfoBox.php | 4 ++-- .../QueryCache/AverageQuerySizeInfoBox.php | 4 ++-- .../QueryCache/AverageUsedBlocksInfoBox.php | 4 ++-- .../QueryCache/FragmentationRatioInfoBox.php | 4 ++-- .../InfoBox/QueryCache/HitRatioInfoBox.php | 4 ++-- .../InfoBox/QueryCache/InsertRatioInfoBox.php | 4 ++-- .../InfoBox/QueryCache/PruneRatioInfoBox.php | 4 ++-- .../QueryCacheSizeTooHighInfoBox.php | 4 ++-- .../QueryCache/QueryCacheStatusInfoBox.php | 4 ++-- .../OpenedTableDefinitionsInfoBox.php | 4 ++-- .../TableCache/OpenedTablesInfoBox.php | 4 ++-- .../InfoBox/ThreadCache/HitRatioInfoBox.php | 4 ++-- 28 files changed, 54 insertions(+), 74 deletions(-) delete mode 100644 Classes/InfoBox/AbstractInfoBox.php diff --git a/Classes/InfoBox/AbstractInfoBox.php b/Classes/InfoBox/AbstractInfoBox.php deleted file mode 100644 index 13c4884..0000000 --- a/Classes/InfoBox/AbstractInfoBox.php +++ /dev/null @@ -1,20 +0,0 @@ - 30], )] -final readonly class ConnectionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +final readonly class ConnectionInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index 27bfad5..68ebe3e 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 90], )] -final readonly class ServerVersionInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class ServerVersionInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index ad14bf7..9b9cd23 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ name: 'mysqlreport.infobox.status', attributes: ['priority' => 80], )] -final readonly class UptimeInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class UptimeInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 0a36e88..67ca9ed 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 40], )] -final readonly class HitRatioBySFInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioBySFInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index 5315af1..544c66d 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 50], )] -final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index decee72..85daba6 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -27,7 +27,7 @@ name: 'mysqlreport.infobox.innodb', attributes: ['priority' => 90], )] -final readonly class InnoDbBufferLoadInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class InnoDbBufferLoadInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index 50ccfcb..8e7b245 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -25,7 +25,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -final readonly class InstancesInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class InstancesInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index 281d195..93ba57f 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -25,7 +25,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -final readonly class LogFileSizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class LogFileSizeInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index 3fa493b..6e4ffc9 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -25,7 +25,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.innodb', )] -final readonly class WriteRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class WriteRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index f462054..c4d6b6b 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -24,7 +24,7 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 50], )] -final readonly class AbortedConnectsInfoBox extends AbstractInfoBox +final readonly class AbortedConnectsInfoBox implements InfoBoxInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index 0c18518..80f49b5 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; use TYPO3\CMS\Core\Utility\CommandUtility; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -25,7 +25,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -final readonly class BackLogInfoBox extends AbstractInfoBox +final readonly class BackLogInfoBox implements InfoBoxInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index 2ba5696..62c6f25 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -final readonly class BinaryLogInfoBox extends AbstractInfoBox +final readonly class BinaryLogInfoBox implements InfoBoxInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index bcdd854..28ea2df 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 90], )] -final readonly class MaxAllowedPacketInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class MaxAllowedPacketInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index b2ab5d1..37a0152 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -final readonly class StandaloneReplicationInfoBox extends AbstractInfoBox +final readonly class StandaloneReplicationInfoBox implements InfoBoxInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index 0de9fe4..6eafb61 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; /** @@ -23,7 +23,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.misc', )] -final readonly class SyncBinaryLogInfoBox extends AbstractInfoBox +final readonly class SyncBinaryLogInfoBox implements InfoBoxInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 5c9d719..b6dbb72 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -14,7 +14,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ name: 'mysqlreport.infobox.misc', attributes: ['priority' => 80], )] -final readonly class TempTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class TempTablesInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index e93179b..ab7ec15 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -16,7 +16,7 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -final readonly class AverageQuerySizeInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class AverageQuerySizeInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 8620b63..51abb78 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -final readonly class AverageUsedBlocksInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface +final readonly class AverageUsedBlocksInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 27ba0eb..48a6959 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -16,7 +16,7 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -final readonly class FragmentationRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class FragmentationRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index bb26cb1..8e730c3 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -16,7 +16,7 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -27,7 +27,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index 2d797a0..b8e0faa 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -16,7 +16,7 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -27,7 +27,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -final readonly class InsertRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class InsertRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index d17bdce..207f420 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -16,7 +16,7 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -27,7 +27,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 80], )] -final readonly class PruneRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class PruneRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index 5c98f13..941d165 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -16,7 +16,7 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -26,7 +26,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.query_cache', )] -final readonly class QueryCacheSizeTooHighInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class QueryCacheSizeTooHighInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index 6b4f739..f769de0 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -16,7 +16,7 @@ use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -27,7 +27,7 @@ name: 'mysqlreport.infobox.query_cache', attributes: ['priority' => 90], )] -final readonly class QueryCacheStatusInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class QueryCacheStatusInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index de3c780..173a282 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -30,7 +30,7 @@ name: 'mysqlreport.infobox.table_cache', attributes: ['priority' => 80], )] -final readonly class OpenedTableDefinitionsInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +final readonly class OpenedTableDefinitionsInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index d6f3d56..d8907db 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -30,7 +30,7 @@ name: 'mysqlreport.infobox.table_cache', attributes: ['priority' => 90], )] -final readonly class OpenedTablesInfoBox extends AbstractInfoBox implements InfoBoxUnorderedListInterface, InfoBoxStateInterface +final readonly class OpenedTablesInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index 60209b4..f3aab45 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -15,7 +15,7 @@ use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; -use StefanFroemken\Mysqlreport\InfoBox\AbstractInfoBox; +use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -25,7 +25,7 @@ #[AutoconfigureTag( name: 'mysqlreport.infobox.thread_cache', )] -final readonly class HitRatioInfoBox extends AbstractInfoBox implements InfoBoxStateInterface +final readonly class HitRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { public function __construct( private StatusValues $statusValues, From f15f36a029455dfaacac6958e4a70aa25f836e52 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:53:17 +0200 Subject: [PATCH 10/27] [TASK] Reorder members in InfoBox subclasses Reorder the constants and constructor declarations inside all 27 InfoBox subclasses to follow standard member order guidelines: traits, constants, constructor, then methods. --- Classes/InfoBox/Information/ConnectionInfoBox.php | 7 +++---- Classes/InfoBox/Information/ServerVersionInfoBox.php | 7 +++---- Classes/InfoBox/Information/UptimeInfoBox.php | 7 +++---- Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php | 7 +++---- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 7 +++---- Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php | 7 +++---- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 7 +++---- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 7 +++---- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 7 +++---- Classes/InfoBox/Misc/AbortedConnectsInfoBox.php | 7 +++---- Classes/InfoBox/Misc/BackLogInfoBox.php | 7 +++---- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 7 +++---- Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php | 7 +++---- Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php | 7 +++---- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 7 +++---- Classes/InfoBox/Misc/TempTablesInfoBox.php | 7 +++---- Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php | 7 +++---- Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php | 7 +++---- Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php | 7 +++---- Classes/InfoBox/QueryCache/HitRatioInfoBox.php | 7 +++---- Classes/InfoBox/QueryCache/InsertRatioInfoBox.php | 7 +++---- Classes/InfoBox/QueryCache/PruneRatioInfoBox.php | 7 +++---- .../InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php | 7 +++---- Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php | 7 +++---- .../InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php | 7 +++---- Classes/InfoBox/TableCache/OpenedTablesInfoBox.php | 7 +++---- Classes/InfoBox/ThreadCache/HitRatioInfoBox.php | 7 +++---- 27 files changed, 81 insertions(+), 108 deletions(-) diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index c146a4a..4157ff8 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -30,15 +30,14 @@ )] final readonly class ConnectionInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface, InfoBoxStateInterface { + public const TITLE = 'Connections'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Connections'; - - public function getBody(): string +public function getBody(): string { return 'Keep an eye on your server\'s connections. ' . 'It is a first indicator of how much work your server has to do. ' diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index 68ebe3e..58a6c7a 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class ServerVersionInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { + public const TITLE = 'Server Information'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Server Information'; - - public function getBody(): string +public function getBody(): string { return 'The following server information was found:'; } diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index 9b9cd23..ea3ebd9 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class UptimeInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { + public const TITLE = 'Uptime'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Uptime'; - - public function getBody(): string +public function getBody(): string { return '"Uptime" shows the time since the server was started or restarted. ' . 'Database administrators can execute "FLUSH STATUS" to reset various status variables. ' diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 67ca9ed..11946e4 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class HitRatioBySFInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Hit Ratio by SF'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Hit Ratio by SF'; - - public function getBody(): string +public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index 544c66d..217c471 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class HitRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Hit Ratio'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Hit Ratio'; - - public function getBody(): string +public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 85daba6..3c48d53 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -29,15 +29,14 @@ )] final readonly class InnoDbBufferLoadInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { + public const TITLE = 'InnoDB Buffer Load'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'InnoDB Buffer Load'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->statusValues['Innodb_page_size'])) { return ''; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index 8e7b245..189ebb2 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -27,15 +27,14 @@ )] final readonly class InstancesInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Instances'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Instances'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->statusValues['Innodb_page_size'])) { return ''; diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index 93ba57f..e4b39ce 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -27,15 +27,14 @@ )] final readonly class LogFileSizeInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Log File Size'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Log File Size'; - - public function getBody(): string +public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index 6e4ffc9..4b679fd 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -27,15 +27,14 @@ )] final readonly class WriteRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Write Ratio'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Write Ratio'; - - public function getBody(): string +public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index c4d6b6b..8487942 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -26,15 +26,14 @@ )] final readonly class AbortedConnectsInfoBox implements InfoBoxInterface { + public const TITLE = 'Aborted Connects'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Aborted Connects'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->statusValues['Aborted_connects'])) { return ''; diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index 80f49b5..63d00d2 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -27,15 +27,14 @@ )] final readonly class BackLogInfoBox implements InfoBoxInterface { + public const TITLE = 'Back Log'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Back Log'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->variables['back_log'])) { return ''; diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index 62c6f25..34e1eee 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -25,15 +25,14 @@ )] final readonly class BinaryLogInfoBox implements InfoBoxInterface { + public const TITLE = 'Binary Log'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Binary Log'; - - public function getBody(): string +public function getBody(): string { if ( isset($this->statusValues['Slave_running']) diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index 28ea2df..4fbd512 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class MaxAllowedPacketInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { + public const TITLE = 'Max Packet Size'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Max Packet Size'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->variables['max_allowed_packet'])) { return ''; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index 37a0152..ce751e3 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -25,15 +25,14 @@ )] final readonly class StandaloneReplicationInfoBox implements InfoBoxInterface { + public const TITLE = 'Standalone or Replication'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Standalone or Replication'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->statusValues['Slave_running'])) { return ''; diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index 6eafb61..d96f545 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -25,15 +25,14 @@ )] final readonly class SyncBinaryLogInfoBox implements InfoBoxInterface { + public const TITLE = 'Sync Binary Log'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Sync Binary Log'; - - public function getBody(): string +public function getBody(): string { // Sync_binlog does not exist on MariaDB if (!isset($this->statusValues['Sync_binlog'])) { diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index b6dbb72..5afeffa 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class TempTablesInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { + public const TITLE = 'Temporary Tables'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Temporary Tables'; - - public function getBody(): string +public function getBody(): string { $content = []; $content[] = 'While JOIN and GROUP BY the server needs a lot of memory to manage the requested data.'; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index ab7ec15..26db99a 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class AverageQuerySizeInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Average Query Size'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Average Query Size'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 51abb78..49fdf8a 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class AverageUsedBlocksInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface { + public const TITLE = 'Average Used Blocks'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Average Used Blocks'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 48a6959..11cdec0 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class FragmentationRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Fragmentation Ratio'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Fragmentation Ratio'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index 8e730c3..5260c7c 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -29,15 +29,14 @@ )] final readonly class HitRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Hit Ratio'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Hit Ratio'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index b8e0faa..5718ec2 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -29,15 +29,14 @@ )] final readonly class InsertRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Insert Ratio'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Insert Ratio'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index 207f420..bc58ee8 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -29,15 +29,14 @@ )] final readonly class PruneRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Prune Ratio'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Prune Ratio'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index 941d165..8fb790b 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -28,15 +28,14 @@ )] final readonly class QueryCacheSizeTooHighInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Query Cache too high'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Query Cache too high'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index f769de0..a64d2cd 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -29,15 +29,14 @@ )] final readonly class QueryCacheStatusInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Query Cache Status'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Query Cache Status'; - - private QueryCacheHelper $queryCacheHelper; +private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index 173a282..df7785e 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -32,15 +32,14 @@ )] final readonly class OpenedTableDefinitionsInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface, InfoBoxStateInterface { + public const TITLE = 'Opened Table Definitions'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Opened Table Definitions'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->statusValues['Opened_table_definitions'])) { return ''; diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index d8907db..e42af4f 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -32,15 +32,14 @@ )] final readonly class OpenedTablesInfoBox implements InfoBoxInterface, InfoBoxUnorderedListInterface, InfoBoxStateInterface { + public const TITLE = 'Opened Tables'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Opened Tables'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->statusValues['Opened_tables'])) { return ''; diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index f3aab45..6688c7c 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -27,15 +27,14 @@ )] final readonly class HitRatioInfoBox implements InfoBoxInterface, InfoBoxStateInterface { + public const TITLE = 'Hit Ratio'; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - - public const TITLE = 'Hit Ratio'; - - public function getBody(): string +public function getBody(): string { if (!isset($this->variables['thread_cache_size'])) { return ''; From 009d43bf17be97c4ff6924cd1a449a0278634f98 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:55:09 +0200 Subject: [PATCH 11/27] [TASK] Apply TYPO3 Coding Guidelines (CGL) Run php-cs-fixer using the project's CGL configuration file to format all modified controllers, InfoBox classes, and interface files to comply with the TYPO3 coding guidelines. --- Classes/Controller/InnoDBController.php | 2 +- Classes/Controller/MiscController.php | 2 +- Classes/Controller/QueryCacheController.php | 2 +- Classes/Controller/StatusController.php | 2 +- Classes/Controller/TableCacheController.php | 2 +- Classes/Controller/ThreadCacheController.php | 2 +- Classes/InfoBox/Information/ConnectionInfoBox.php | 2 +- Classes/InfoBox/Information/ServerVersionInfoBox.php | 2 +- Classes/InfoBox/Information/UptimeInfoBox.php | 2 +- Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php | 2 +- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 2 +- Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php | 2 +- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 2 +- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 2 +- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 2 +- Classes/InfoBox/Misc/AbortedConnectsInfoBox.php | 2 +- Classes/InfoBox/Misc/BackLogInfoBox.php | 2 +- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 2 +- Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php | 2 +- Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php | 2 +- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 2 +- Classes/InfoBox/Misc/TempTablesInfoBox.php | 2 +- Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php | 2 +- Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php | 2 +- Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/HitRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/InsertRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/PruneRatioInfoBox.php | 2 +- Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php | 2 +- Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php | 2 +- Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php | 2 +- Classes/InfoBox/TableCache/OpenedTablesInfoBox.php | 2 +- Classes/InfoBox/ThreadCache/HitRatioInfoBox.php | 2 +- 33 files changed, 33 insertions(+), 33 deletions(-) diff --git a/Classes/Controller/InnoDBController.php b/Classes/Controller/InnoDBController.php index b378f04..636026d 100644 --- a/Classes/Controller/InnoDBController.php +++ b/Classes/Controller/InnoDBController.php @@ -34,7 +34,7 @@ public function indexAction(): ResponseInterface $moduleTemplate->assign( 'renderedInfoBoxes', - $this->renderInfoBoxFactory->render($this->infoBoxes) + $this->renderInfoBoxFactory->render($this->infoBoxes), ); return $moduleTemplate->renderResponse('InnoDB/Index'); diff --git a/Classes/Controller/MiscController.php b/Classes/Controller/MiscController.php index bb692ee..fc1874f 100644 --- a/Classes/Controller/MiscController.php +++ b/Classes/Controller/MiscController.php @@ -34,7 +34,7 @@ public function indexAction(): ResponseInterface $moduleTemplate->assign( 'renderedInfoBoxes', - $this->renderInfoBoxFactory->render($this->infoBoxes) + $this->renderInfoBoxFactory->render($this->infoBoxes), ); return $moduleTemplate->renderResponse('Misc/Index'); diff --git a/Classes/Controller/QueryCacheController.php b/Classes/Controller/QueryCacheController.php index 183a1d7..4bd5c16 100644 --- a/Classes/Controller/QueryCacheController.php +++ b/Classes/Controller/QueryCacheController.php @@ -34,7 +34,7 @@ public function indexAction(): ResponseInterface $moduleTemplate->assign( 'renderedInfoBoxes', - $this->renderInfoBoxFactory->render($this->infoBoxes) + $this->renderInfoBoxFactory->render($this->infoBoxes), ); return $moduleTemplate->renderResponse('QueryCache/Index'); diff --git a/Classes/Controller/StatusController.php b/Classes/Controller/StatusController.php index de19c4d..5f43a77 100644 --- a/Classes/Controller/StatusController.php +++ b/Classes/Controller/StatusController.php @@ -34,7 +34,7 @@ public function indexAction(): ResponseInterface $moduleTemplate->assign( 'renderedInfoBoxes', - $this->renderInfoBoxFactory->render($this->infoBoxes) + $this->renderInfoBoxFactory->render($this->infoBoxes), ); return $moduleTemplate->renderResponse('Status/Index'); diff --git a/Classes/Controller/TableCacheController.php b/Classes/Controller/TableCacheController.php index 7572dac..e66ea94 100644 --- a/Classes/Controller/TableCacheController.php +++ b/Classes/Controller/TableCacheController.php @@ -34,7 +34,7 @@ public function indexAction(): ResponseInterface $moduleTemplate->assign( 'renderedInfoBoxes', - $this->renderInfoBoxFactory->render($this->infoBoxes) + $this->renderInfoBoxFactory->render($this->infoBoxes), ); return $moduleTemplate->renderResponse('TableCache/Index'); diff --git a/Classes/Controller/ThreadCacheController.php b/Classes/Controller/ThreadCacheController.php index 722f2da..e04fb6b 100644 --- a/Classes/Controller/ThreadCacheController.php +++ b/Classes/Controller/ThreadCacheController.php @@ -34,7 +34,7 @@ public function indexAction(): ResponseInterface $moduleTemplate->assign( 'renderedInfoBoxes', - $this->renderInfoBoxFactory->render($this->infoBoxes) + $this->renderInfoBoxFactory->render($this->infoBoxes), ); return $moduleTemplate->renderResponse('ThreadCache/Index'); diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index 4157ff8..7c511be 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -37,7 +37,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { return 'Keep an eye on your server\'s connections. ' . 'It is a first indicator of how much work your server has to do. ' diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index 58a6c7a..f009e05 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { return 'The following server information was found:'; } diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index ea3ebd9..45627cf 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { return '"Uptime" shows the time since the server was started or restarted. ' . 'Database administrators can execute "FLUSH STATUS" to reset various status variables. ' diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 11946e4..c72e21f 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index 217c471..8818e97 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 3c48d53..8c118b1 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -36,7 +36,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->statusValues['Innodb_page_size'])) { return ''; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index 189ebb2..bddcf17 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -34,7 +34,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->statusValues['Innodb_page_size'])) { return ''; diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index e4b39ce..8bac1bd 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -34,7 +34,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index 4b679fd..8083116 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -34,7 +34,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if ( !isset( diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index 8487942..380a999 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -33,7 +33,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->statusValues['Aborted_connects'])) { return ''; diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index 63d00d2..bb3eeaf 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -34,7 +34,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->variables['back_log'])) { return ''; diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index 34e1eee..c6cb2eb 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -32,7 +32,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if ( isset($this->statusValues['Slave_running']) diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index 4fbd512..96d4eb1 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->variables['max_allowed_packet'])) { return ''; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index ce751e3..a2d446e 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -32,7 +32,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->statusValues['Slave_running'])) { return ''; diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index d96f545..1fea5ca 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -32,7 +32,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { // Sync_binlog does not exist on MariaDB if (!isset($this->statusValues['Sync_binlog'])) { diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 5afeffa..4f70f98 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { $content = []; $content[] = 'While JOIN and GROUP BY the server needs a lot of memory to manage the requested data.'; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index 26db99a..bf75162 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 49fdf8a..24350bd 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 11cdec0..4ece219 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index 5260c7c..b2cf602 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -36,7 +36,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index 5718ec2..c2c4c19 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -36,7 +36,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index bc58ee8..1aaabaa 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -36,7 +36,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index 8fb790b..2ef7878 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -35,7 +35,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index a64d2cd..4763af5 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -36,7 +36,7 @@ public function __construct( private Variables $variables, ) {} -private QueryCacheHelper $queryCacheHelper; + private QueryCacheHelper $queryCacheHelper; public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index df7785e..beccc2c 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -39,7 +39,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->statusValues['Opened_table_definitions'])) { return ''; diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index e42af4f..b3fd086 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -39,7 +39,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->statusValues['Opened_tables'])) { return ''; diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index 6688c7c..567e937 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -34,7 +34,7 @@ public function __construct( private Variables $variables, ) {} -public function getBody(): string + public function getBody(): string { if (!isset($this->variables['thread_cache_size'])) { return ''; From 2a3f3efb6e97b6c1e9c74fed1bb28df5e3443bea Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:58:21 +0200 Subject: [PATCH 12/27] [TASK] Rename GitHub workflow configuration file Rename the typo3_13.yml workflow configuration to ci.yml in the GitHub workflow directory to reflect general continuous integration tasks. --- .github/workflows/{typo3_13.yml => ci.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{typo3_13.yml => ci.yml} (100%) diff --git a/.github/workflows/typo3_13.yml b/.github/workflows/ci.yml similarity index 100% rename from .github/workflows/typo3_13.yml rename to .github/workflows/ci.yml From e052c93f353e6d1eff0daecb666e8f66d9622bab Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Fri, 12 Jun 2026 23:59:56 +0200 Subject: [PATCH 13/27] [DOCS] Update InfoBoxSystem specification for stateless architecture Update the InfoBoxSystem.md specification file to describe the new stateless architecture. Describe the InfoBoxInterface, the removal of AbstractInfoBox, constructor DI autowiring, and RenderInfoBoxFactory. --- .Specs/InfoBoxSystem.md | 45 +++++++++++++++++++---------------------- 1 file changed, 21 insertions(+), 24 deletions(-) diff --git a/.Specs/InfoBoxSystem.md b/.Specs/InfoBoxSystem.md index 1d93b81..37c7bf7 100644 --- a/.Specs/InfoBoxSystem.md +++ b/.Specs/InfoBoxSystem.md @@ -4,44 +4,41 @@ This document specifies the internal "InfoBox" rendering system. It is a reusabl ## Overview -The system is designed to decouple data fetching and rendering from the controllers. Instead of a controller fetching all data and passing it to a monolithic Fluid template, the responsibility is distributed among several smaller, specialized `InfoBox` classes. +The system is designed to decouple database data fetching and rendering from the controllers. Instead of a controller fetching all data and passing it to a monolithic Fluid template, the responsibility is distributed among several smaller, specialized `InfoBox` classes. The core components of this system are: -1. **`Page` Service**: A DTO that acts as a container for a collection of InfoBoxes for a specific topic (e.g., "InnoDB"). -2. **`AbstractInfoBox`**: A base class that defines the contract for all InfoBox objects. -3. **Concrete InfoBox Implementations**: Specific classes (e.g., `UptimeInfoBox`) that extend `AbstractInfoBox` and contain the logic to fetch and prepare data for a single panel. -4. **Service Tagging**: The Symfony Dependency Injection container uses tags to collect all relevant InfoBox implementations and inject them into the correct `Page` service. +1. **`InfoBoxInterface`**: The interface (`Classes/InfoBox/InfoBoxInterface.php`) defining the contract for all InfoBoxes. It requires a `TITLE` constant and a `getBody(): string` method. +2. **Concrete InfoBox Implementations**: Specific `final readonly` classes (e.g., `UptimeInfoBox`) that implement `InfoBoxInterface` (and optional interfaces like `InfoBoxUnorderedListInterface` or `InfoBoxStateInterface`) and contain the logic to calculate and format data. +3. **`RenderInfoBoxFactory`**: A stateless rendering service (`Classes/InfoBox/RenderInfoBoxFactory.php`) that maps the structured InfoBox properties to a Fluid view and generates the final HTML output. +4. **Service Tagging**: InfoBox implementations are tagged with their respective topic tags (e.g., `mysqlreport.infobox.status`) using the PHP attribute `#[AutoconfigureTag]`. +5. **Constructor Autowiring**: The DI container instantiates the models `StatusValues` and `Variables` using repositories and caches them. They are autowired directly to the InfoBox constructors via the global `bind` configuration in `Services.yaml`. ## Component Analysis -### 1. `Page` Service (`Classes/Menu/Page.php`) +### 1. `InfoBoxInterface` (`Classes/InfoBox/InfoBoxInterface.php`) -- A `readonly` DTO that receives an iterable of `AbstractInfoBox` objects via its constructor. -- The `getRenderedInfoBoxes()` method iterates through all its InfoBoxes. -- For each InfoBox, it calls the `updateView()` method, which returns a configured `ViewInterface` object. -- It then calls `render()` on that view and concatenates the resulting HTML strings. -- The final, combined HTML of all InfoBoxes is returned to the controller. +- Defines the contract: + - `public const TITLE = '';` + - `public function getBody(): string;` -### 2. `AbstractInfoBox` (`Classes/InfoBox/AbstractInfoBox.php`) +### 2. `RenderInfoBoxFactory` (`Classes/InfoBox/RenderInfoBoxFactory.php`) -- Defines the basic structure of an InfoBox, including methods for rendering a title, body, and footer. -- Crucially, it contains the `updateView()` method, where the concrete class assigns its fetched data to the view. -- Many InfoBoxes use the `GetStatusValuesAndVariablesTrait` to easily access the `StatusRepository` and `VariablesRepository`. +- Takes the `ViewFactoryInterface` in the constructor. +- The `render(iterable $infoBoxes): string` method iterates over the InfoBoxes, extracts their structured data, assigns them to a Fluid view, and compiles the final HTML. +- It keeps the InfoBox classes completely independent of the view layer (fully headless-ready). ### 3. Service Configuration (`Configuration/Services.yaml`) This is where the system is wired together. -- **InfoBox Tagging**: Concrete InfoBox classes are automatically tagged using the `#[AutoconfigureTag]` PHP attribute. For example, an InfoBox for the "Status" page will have `#[AutoconfigureTag('mysqlreport.infobox.status')]`. -- **`Page` Service Definition**: For each sub-module that uses this pattern, a dedicated `Page` service is defined. -- **`!tagged_iterator`**: The `arguments` of the `Page` service use the `!tagged_iterator` directive to collect all services with a specific tag. For example, the `mysqlreport.page.information` service receives all InfoBoxes tagged with `mysqlreport.infobox.status`. -- **Controller Injection**: The corresponding controller (e.g., `StatusController`) then gets the correctly configured `Page` service injected. +- **Factories**: `StatusValues` and `Variables` are registered as factory services calling the `findAll` repository methods. +- **Autowiring Bindings**: The types are globally bound to the factory services under `_defaults.bind`. +- **Direct Controller Injection**: The controller (e.g., `StatusController`) is configured to receive the tagged iterator of InfoBoxes directly via `!tagged_iterator`. ## Workflow Example (`StatusController`) -1. `StatusController` has `@mysqlreport.page.information` injected as `$this->page`. -2. The `indexAction` calls `$this->page->getRenderedInfoBoxes()`. -3. The `Page` object iterates through all InfoBoxes tagged with `mysqlreport.infobox.status` (e.g., `UptimeInfoBox`, `ConnectionInfoBox`). -4. Each InfoBox fetches its data (e.g., from `StatusRepository`), prepares it, and renders its own small HTML partial (`Resources/Private/Templates/InfoBox/Default.html`). -5. The controller receives a single string of pre-rendered HTML and assigns it to the main module template (`Resources/Private/Templates/Status/Index.html`). +1. `StatusController` has `iterable $infoBoxes` (tagged with `mysqlreport.infobox.status`) and the `RenderInfoBoxFactory` injected via constructor autowiring. +2. The `indexAction` calls `$this->renderInfoBoxFactory->render($this->infoBoxes)`. +3. Inside the factory, each InfoBox's `TITLE` constant and `getBody()` content are extracted and assigned to `Resources/Private/Templates/InfoBox/Default.html`. +4. The controller receives a single string of pre-rendered HTML and assigns it to the main module template (`Resources/Private/Templates/Status/Index.html`). From 84a7a7597544cb5b4a164445e11cadd4573989e4 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:05:17 +0200 Subject: [PATCH 14/27] [TASK] Add TYPO3 v14 metadata to composer.json --- composer.json | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 9352923..5d29b69 100644 --- a/composer.json +++ b/composer.json @@ -1,6 +1,6 @@ { "name": "stefanfroemken/mysqlreport", - "description": "Analyze and profile your TYPO3 databases queries", + "description": "MySQL Report - Analyze and profile your TYPO3 database queries", "license": "GPL-2.0-or-later", "type": "typo3-cms-extension", "keywords": [ @@ -71,7 +71,11 @@ }, "extra": { "typo3/cms": { + "Package": { + "providesPackages": {} + }, "extension-key": "mysqlreport", + "version": "5.1.0", "web-dir": ".Build/web" } } From 38442e94c9eee602032a3a12767d6c15856fa563 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:09:30 +0200 Subject: [PATCH 15/27] [TASK] Add Rector configuration --- Build/rector/rector.php | 66 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 Build/rector/rector.php diff --git a/Build/rector/rector.php b/Build/rector/rector.php new file mode 100644 index 0000000..83e8d80 --- /dev/null +++ b/Build/rector/rector.php @@ -0,0 +1,66 @@ +withPaths([ + __DIR__ . '/../../Classes', + __DIR__ . '/../../Configuration', + __DIR__ . '/../../Tests', + ]) + ->withPreparedSets( + deadCode: true, + codeQuality: true, + typeDeclarations: true, + privatization: true, + instanceOf: true, + earlyReturn: true, + ) + ->withPhpSets(php82: true) + ->withPhpVersion(PhpVersion::PHP_82) + ->withSets([ + Typo3SetList::CODE_QUALITY, + Typo3SetList::GENERAL, + Typo3LevelSetList::UP_TO_TYPO3_14, + ]) + ->withPHPStanConfigs([Typo3Option::PHPSTAN_FOR_RECTOR_PATH]) + ->withConfiguredRule(ExtEmConfRector::class, [ + ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '14.1.0-14.99.99', + ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [], + ]) + ->withConfiguredRule(EncapsedStringsToSprintfRector::class, [ + 'always' => true, + // force sprintf even for simple cases + ]) + ->withImportNames(importShortClasses: false, removeUnusedImports: true) + ->withSkip([ + NullToStrictStringFuncCallArgRector::class, + SafeDeclareStrictTypesRector::class => [ + '*ext_emconf.php', + ], + // Avoid stripping class types from mock properties to keep IDE autocomplete working in functional tests + TypedPropertyFromCreateMockAssignRector::class => [ + '*/Tests/Functional/*', + ], + '*Build/*', + '*Resources/*', + '*Model/*', + ]); From b34c1f5bfbebbe2d64ab7a0b8a745c7572a1da0d Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:11:47 +0200 Subject: [PATCH 16/27] [TASK] Update TYPO3 version constraint in Rector configuration to LTS --- Build/rector/rector.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Build/rector/rector.php b/Build/rector/rector.php index 83e8d80..7c983bc 100644 --- a/Build/rector/rector.php +++ b/Build/rector/rector.php @@ -43,7 +43,7 @@ ]) ->withPHPStanConfigs([Typo3Option::PHPSTAN_FOR_RECTOR_PATH]) ->withConfiguredRule(ExtEmConfRector::class, [ - ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '14.1.0-14.99.99', + ExtEmConfRector::TYPO3_VERSION_CONSTRAINT => '14.3.0-14.3.99', ExtEmConfRector::ADDITIONAL_VALUES_TO_BE_REMOVED => [], ]) ->withConfiguredRule(EncapsedStringsToSprintfRector::class, [ From d75e6436d41a990b56370b33903d647a5ab0c3a6 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:17:24 +0200 Subject: [PATCH 17/27] [TASK] Introduce new CGL configuration and script --- Build/Scripts/runTests.sh | 55 ++++------ Build/cgl/.php-cs-fixer.dist.php | 81 -------------- Build/cgl/config.php | 183 +++++++++++++++++++++++++++++++ 3 files changed, 205 insertions(+), 114 deletions(-) delete mode 100644 Build/cgl/.php-cs-fixer.dist.php create mode 100644 Build/cgl/config.php diff --git a/Build/Scripts/runTests.sh b/Build/Scripts/runTests.sh index 5fe43e6..5cac7c6 100755 --- a/Build/Scripts/runTests.sh +++ b/Build/Scripts/runTests.sh @@ -60,8 +60,8 @@ handleDbmsOptions() { echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 exit 1 fi - [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.11" - if ! [[ ${DBMS_VERSION} =~ ^(10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then + [ -z "${DBMS_VERSION}" ] && DBMS_VERSION="10.5" + if ! [[ ${DBMS_VERSION} =~ ^(10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then echo "Invalid combination -d ${DBMS} -i ${DBMS_VERSION}" >&2 echo >&2 echo "Use \".Build/Scripts/runTests.sh -h\" to display help and valid options" >&2 @@ -125,7 +125,7 @@ handleDbmsOptions() { loadHelp() { # Load help text into $HELP read -r -d '' HELP < + -p <8.1|8.2|8.3> Specifies the PHP minor version to be used - - 8.2: (default) use PHP 8.2 + - 8.1: use PHP 8.1 + - 8.2: use PHP 8.2 - 8.3: use PHP 8.3 -x @@ -256,7 +257,7 @@ DBMS_VERSION="" PHP_VERSION="8.2" PHP_XDEBUG_ON=0 PHP_XDEBUG_PORT=9003 -CGLCHECK_DRY_RUN=0 +DRY_RUN=0 CI_PARAMS="${CI_PARAMS:-}" DOCS_PARAMS="${DOCS_PARAMS:=--pull always}" CONTAINER_BIN="" @@ -290,7 +291,7 @@ while getopts "a:b:d:i:s:p:xy:nhu" OPT; do ;; p) PHP_VERSION=${OPTARG} - if ! [[ ${PHP_VERSION} =~ ^(8.2|8.3)$ ]]; then + if ! [[ ${PHP_VERSION} =~ ^(8.1|8.2|8.3|8.4)$ ]]; then INVALID_OPTIONS+=("p ${OPTARG}") fi ;; @@ -301,7 +302,7 @@ while getopts "a:b:d:i:s:p:xy:nhu" OPT; do PHP_XDEBUG_PORT=${OPTARG} ;; n) - CGLCHECK_DRY_RUN=1 + DRY_RUN=1 ;; h) loadHelp @@ -384,7 +385,7 @@ IMAGE_DOCS="ghcr.io/typo3-documentation/render-guides:latest" shift $((OPTIND - 1)) SUFFIX=$(echo $RANDOM) -NETWORK="t3docsexamples-${SUFFIX}" +NETWORK="t3mysqlreport-${SUFFIX}" ${CONTAINER_BIN} network create ${NETWORK} >/dev/null if [ ${CONTAINER_BIN} = "docker" ]; then @@ -409,11 +410,11 @@ fi # Suite execution case ${TEST_SUITE} in cgl) - if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then - COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --dry-run --diff --config=Build/cgl/.php-cs-fixer.dist.php --using-cache=no ." - else - COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v --config=Build/cgl/.php-cs-fixer.dist.php --using-cache=no ." + DRY_RUN_OPTIONS='' + if [ "${DRY_RUN}" -eq 1 ]; then + DRY_RUN_OPTIONS='--dry-run --diff' fi + COMMAND="php -dxdebug.mode=off .Build/bin/php-cs-fixer fix -v ${DRY_RUN_OPTIONS} --config=Build/cgl/config.php --using-cache=no" ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name cgl-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c "${COMMAND}" SUITE_EXIT_CODE=$? ;; @@ -433,7 +434,7 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? ;; composerNormalize) - if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then + if [ "${DRY_RUN}" -eq 1 ]; then COMMAND=(composer normalize -n) else COMMAND=(composer normalize) @@ -442,7 +443,7 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? ;; composerUpdate) - rm -rf .Build/bin/ .Build/typo3 .Build/vendor .Build/Web ./composer.lock + rm -rf .Build/bin .Build/typo3 .Build/vendor ./composer.lock cp ${ROOT_DIR}/composer.json ${ROOT_DIR}/composer.json.orig if [ -f "${ROOT_DIR}/composer.json.testing" ]; then cp ${ROOT_DIR}/composer.json ${ROOT_DIR}/composer.json.orig @@ -453,18 +454,6 @@ case ${TEST_SUITE} in cp ${ROOT_DIR}/composer.json ${ROOT_DIR}/composer.json.testing mv ${ROOT_DIR}/composer.json.orig ${ROOT_DIR}/composer.json ;; - composerUpdateRector) - rm -rf Build/rector/.Build/bin/ Build/rector/.Build/vendor Build/rector/composer.lock - cp ${ROOT_DIR}/Build/rector/composer.json ${ROOT_DIR}/Build/rector/composer.json.orig - if [ -f "${ROOT_DIR}/Build/rector/composer.json.testing" ]; then - cp ${ROOT_DIR}/Build/rector/composer.json ${ROOT_DIR}/Build/rector/composer.json.orig - fi - COMMAND=(composer require --working-dir=${ROOT_DIR}/Build/rector --no-ansi --no-interaction --no-progress) - ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-install-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}" - SUITE_EXIT_CODE=$? - cp ${ROOT_DIR}/Build/rector/composer.json ${ROOT_DIR}/Build/rector/composer.json.testing - mv ${ROOT_DIR}/Build/rector/composer.json.orig ${ROOT_DIR}/Build/rector/composer.json - ;; composerValidate) COMMAND=(composer validate "$@") ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name composer-command-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}" @@ -522,12 +511,12 @@ case ${TEST_SUITE} in SUITE_EXIT_CODE=$? ;; rector) - if [ "${CGLCHECK_DRY_RUN}" -eq 1 ]; then - COMMAND=(php -dxdebug.mode=off Build/rector/.Build/bin/rector -n --config=Build/rector/rector.php --clear-cache "$@") - else - COMMAND=(php -dxdebug.mode=off Build/rector/.Build/bin/rector --config=Build/rector/rector.php --clear-cache "$@") + DRY_RUN_OPTIONS='' + if [ "${DRY_RUN}" -eq 1 ]; then + DRY_RUN_OPTIONS='--dry-run' fi - ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name rector-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} "${COMMAND[@]}" + COMMAND="php -dxdebug.mode=off .Build/bin/rector process ${DRY_RUN_OPTIONS} --config=Build/rector/rector.php --no-progress-bar --ansi" + ${CONTAINER_BIN} run ${CONTAINER_COMMON_PARAMS} --name rector-${SUFFIX} -e COMPOSER_CACHE_DIR=.Build/.cache/composer -e COMPOSER_ROOT_VERSION=${COMPOSER_ROOT_VERSION} ${IMAGE_PHP} /bin/sh -c "${COMMAND}" SUITE_EXIT_CODE=$? ;; renderDocumentation) diff --git a/Build/cgl/.php-cs-fixer.dist.php b/Build/cgl/.php-cs-fixer.dist.php deleted file mode 100644 index 13fafa1..0000000 --- a/Build/cgl/.php-cs-fixer.dist.php +++ /dev/null @@ -1,81 +0,0 @@ -setFinder( - (new Finder()) - ->in(__DIR__ . '/../../') - ->exclude(__DIR__ . '/../../.Build') - ->exclude(__DIR__ . '/../../var') - ) - ->setRiskyAllowed(true) - ->setRules([ - '@DoctrineAnnotation' => true, - // @todo: Switch to @PER-CS2.0 once php-cs-fixer's todo list is done: https://github.com/PHP-CS-Fixer/PHP-CS-Fixer/issues/7247 - '@PER-CS1.0' => true, - 'array_indentation' => true, - 'array_syntax' => ['syntax' => 'short'], - 'cast_spaces' => ['space' => 'none'], - // @todo: Can be dropped once we enable @PER-CS2.0 - 'concat_space' => ['spacing' => 'one'], - 'declare_equal_normalize' => ['space' => 'none'], - 'declare_parentheses' => true, - 'dir_constant' => true, - // @todo: Can be dropped once we enable @PER-CS2.0 - 'function_declaration' => [ - 'closure_fn_spacing' => 'none', - ], - 'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']], - 'type_declaration_spaces' => true, - 'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false], - 'list_syntax' => ['syntax' => 'short'], - // @todo: Can be dropped once we enable @PER-CS2.0 - 'method_argument_space' => true, - 'modernize_strpos' => true, - 'modernize_types_casting' => true, - 'native_function_casing' => true, - 'no_alias_functions' => true, - 'no_blank_lines_after_phpdoc' => true, - 'no_empty_phpdoc' => true, - 'no_empty_statement' => true, - 'no_extra_blank_lines' => true, - 'no_leading_namespace_whitespace' => true, - 'no_null_property_initialization' => true, - 'no_short_bool_cast' => true, - 'no_singleline_whitespace_before_semicolons' => true, - 'no_superfluous_elseif' => true, - 'no_trailing_comma_in_singleline' => true, - 'no_unneeded_control_parentheses' => true, - 'no_unused_imports' => true, - 'no_useless_nullsafe_operator' => true, - 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], - 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], - 'php_unit_mock_short_will_return' => true, - 'php_unit_test_case_static_method_calls' => ['call_type' => 'self'], - 'phpdoc_no_access' => true, - 'phpdoc_no_empty_return' => true, - 'phpdoc_no_package' => true, - 'phpdoc_scalar' => true, - 'phpdoc_trim' => true, - 'phpdoc_types' => true, - 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], - 'return_type_declaration' => ['space_before' => 'none'], - 'single_quote' => true, - 'single_space_around_construct' => true, - 'single_line_comment_style' => ['comment_types' => ['hash']], - // @todo: Can be dropped once we enable @PER-CS2.0 - 'single_line_empty_body' => true, - 'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']], - 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], - 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], - - // We need this for documentation! - 'no_useless_else' => false, // We want to preserve else with comments only - - // Add this rule to convert FQCN to use statements - 'full_opening_tag' => true, - ]); diff --git a/Build/cgl/config.php b/Build/cgl/config.php new file mode 100644 index 0000000..0e9510e --- /dev/null +++ b/Build/cgl/config.php @@ -0,0 +1,183 @@ + true, + '@PER-CS1x0' => true, + 'array_indentation' => true, + 'array_syntax' => ['syntax' => 'short'], + 'cast_spaces' => ['space' => 'none'], + 'concat_space' => ['spacing' => 'one'], + 'declare_equal_normalize' => ['space' => 'none'], + 'declare_parentheses' => true, + 'dir_constant' => true, + 'function_declaration' => [ + 'closure_fn_spacing' => 'none', + ], + 'function_to_constant' => ['functions' => ['get_called_class', 'get_class', 'get_class_this', 'php_sapi_name', 'phpversion', 'pi']], + 'type_declaration_spaces' => true, + 'global_namespace_import' => ['import_classes' => false, 'import_constants' => false, 'import_functions' => false], + 'list_syntax' => ['syntax' => 'short'], + 'method_argument_space' => true, + 'modernize_strpos' => true, + 'modernize_types_casting' => true, + 'native_function_casing' => true, + 'no_alias_functions' => true, + 'no_blank_lines_after_phpdoc' => true, + 'no_empty_phpdoc' => true, + 'no_empty_statement' => true, + 'no_extra_blank_lines' => true, + 'no_leading_namespace_whitespace' => true, + 'no_null_property_initialization' => true, + 'no_short_bool_cast' => true, + 'no_singleline_whitespace_before_semicolons' => true, + 'no_superfluous_elseif' => true, + 'no_trailing_comma_in_singleline' => true, + 'no_unneeded_control_parentheses' => true, + 'no_unused_imports' => true, + 'no_useless_else' => true, + 'no_useless_nullsafe_operator' => true, + 'nullable_type_declaration' => [ + 'syntax' => 'question_mark', + ], + 'nullable_type_declaration_for_default_null_value' => true, + 'ordered_class_elements' => ['order' => ['use_trait', 'case', 'constant', 'property']], + 'ordered_imports' => ['imports_order' => ['class', 'function', 'const'], 'sort_algorithm' => 'alpha'], + 'php_unit_construct' => ['assertions' => ['assertEquals', 'assertSame', 'assertNotEquals', 'assertNotSame']], + 'php_unit_mock_short_will_return' => true, + 'php_unit_test_case_static_method_calls' => ['call_type' => 'self', + 'methods' => [ + 'any' => 'this', + 'atLeast' => 'this', + 'atLeastOnce' => 'this', + 'atMost' => 'this', + 'exactly' => 'this', + 'never' => 'this', + 'onConsecutiveCalls' => 'this', + 'once' => 'this', + 'returnArgument' => 'this', + 'returnCallback' => 'this', + 'returnSelf' => 'this', + 'returnValue' => 'this', + 'returnValueMap' => 'this', + 'throwException' => 'this', + ], + ], + 'phpdoc_no_access' => true, + 'phpdoc_no_empty_return' => true, + 'phpdoc_no_package' => true, + 'phpdoc_scalar' => true, + 'phpdoc_trim' => true, + 'phpdoc_types' => true, + 'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'], + 'protected_to_private' => true, + 'return_type_declaration' => ['space_before' => 'none'], + 'single_quote' => true, + 'single_space_around_construct' => true, + 'single_line_comment_style' => ['comment_types' => ['hash']], + 'single_line_empty_body' => true, + 'trailing_comma_in_multiline' => ['elements' => ['arrays']], + 'whitespace_after_comma_in_array' => ['ensure_single_space' => true], + 'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false], +]; + +// 2. Custom stefanfroemken Overrides +$stefanfroemkenRules = [ + 'braces_position' => [ + 'allow_single_line_anonymous_functions' => false, + 'allow_single_line_empty_anonymous_classes' => true, + 'anonymous_classes_opening_brace' => 'same_line', + 'anonymous_functions_opening_brace' => 'same_line', + 'classes_opening_brace' => 'next_line_unless_newline_at_signature_end', + 'control_structures_opening_brace' => 'same_line', + 'functions_opening_brace' => 'next_line_unless_newline_at_signature_end', + ], + 'control_structure_braces' => true, + 'control_structure_continuation_position' => [ + 'position' => 'same_line', + ], + 'function_declaration' => [ + 'closure_fn_spacing' => 'none', + 'closure_function_spacing' => 'one', + 'trailing_comma_single_line' => false, + ], + 'method_argument_space' => [ + 'after_heredoc' => false, + 'attribute_placement' => 'same_line', + 'keep_multiple_spaces_after_comma' => false, + 'on_multiline' => 'ensure_fully_multiline', + ], + 'method_chaining_indentation' => true, + 'multiline_whitespace_before_semicolons' => [ + 'strategy' => 'no_multi_line', + ], + 'no_empty_comment' => true, + 'no_extra_blank_lines' => [ + 'tokens' => [ + 'attribute', + 'case', + 'continue', + 'curly_brace_block', + 'default', + 'extra', + 'parenthesis_brace_block', + 'square_brace_block', + 'switch', + 'throw', + 'use', + ], + ], + 'no_multiple_statements_per_line' => true, + 'operator_linebreak' => [ + 'only_booleans' => false, + 'position' => 'beginning', + ], + 'single_line_empty_body' => true, + 'single_space_around_construct' => true, + 'statement_indentation' => [ + 'stick_comment_to_next_continuous_control_statement' => false, + ], + 'trailing_comma_in_multiline' => [ + 'elements' => [ + 'arrays', + 'arguments', + 'parameters', + ], + ], +]; + +// Merge rules: stefanfroemkenRules will overwrite typo3Rules in case of conflicts +$mergedRules = array_merge($typo3Rules, $stefanfroemkenRules); + +return (new \PhpCsFixer\Config()) + ->setParallelConfig(\PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) + ->setFinder( + (new PhpCsFixer\Finder()) + ->exclude(['var', 'packages']) + ->ignoreVCSIgnored(true) + ->in(__DIR__ . '/../../'), + ) + ->setRiskyAllowed(true) + ->setRules($mergedRules); From 20db7a070d80f2335f95691d8865af23e28d5fc7 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:20:27 +0200 Subject: [PATCH 18/27] [TASK] Add ssch/typo3-rector to require-dev --- composer.json | 1 + 1 file changed, 1 insertion(+) diff --git a/composer.json b/composer.json index 5d29b69..8a21f7b 100644 --- a/composer.json +++ b/composer.json @@ -35,6 +35,7 @@ "friendsofphp/php-cs-fixer": "^3.88", "phpstan/phpstan": "^2.1", "phpunit/phpunit": "^11.5", + "ssch/typo3-rector": "^3.6", "typo3/cms-dashboard": "^14.0", "typo3/cms-install": "^14.0", "typo3/cms-reports": "^14.0", From 389c07553bf95105ad7373995d217525315dc613 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:20:37 +0200 Subject: [PATCH 19/27] [TASK] Apply Rector refactoring and CGL styling --- Classes/Configuration/ExtConf.php | 9 ++------- Classes/Controller/ProfileController.php | 2 -- Classes/DependencyInjection/DashboardPass.php | 9 ++------- .../Doctrine/Middleware/LoggerStatement.php | 3 +-- .../LoggerWithQueryTimeConnection.php | 8 ++++---- .../Factory/QueryInformationFactory.php | 3 ++- .../ModifyQueryInformationRecordsEvent.php | 14 +------------ Classes/EventListener/CacheAction.php | 1 - Classes/Helper/ExplainQueryHelper.php | 3 --- .../InfoBox/Information/ConnectionInfoBox.php | 1 - .../Information/ServerVersionInfoBox.php | 1 - Classes/InfoBox/Information/UptimeInfoBox.php | 1 - .../InfoBox/InnoDb/HitRatioBySFInfoBox.php | 3 +-- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 3 +-- .../InnoDb/InnoDbBufferLoadInfoBox.php | 3 +-- Classes/InfoBox/InnoDb/InstancesInfoBox.php | 7 +++---- Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php | 9 +++------ Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 3 +-- .../InfoBox/Misc/AbortedConnectsInfoBox.php | 1 - Classes/InfoBox/Misc/BackLogInfoBox.php | 3 +-- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 1 - .../InfoBox/Misc/MaxAllowedPacketInfoBox.php | 1 - .../Misc/StandaloneReplicationInfoBox.php | 1 - Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 1 - Classes/InfoBox/Misc/TempTablesInfoBox.php | 1 - .../QueryCache/AverageQuerySizeInfoBox.php | 15 ++++++-------- .../QueryCache/AverageUsedBlocksInfoBox.php | 7 +++---- .../QueryCache/FragmentationRatioInfoBox.php | 7 +++---- .../InfoBox/QueryCache/HitRatioInfoBox.php | 7 +++---- .../InfoBox/QueryCache/InsertRatioInfoBox.php | 7 +++---- .../InfoBox/QueryCache/PruneRatioInfoBox.php | 7 +++---- .../QueryCacheSizeTooHighInfoBox.php | 5 ++--- .../QueryCache/QueryCacheStatusInfoBox.php | 5 ++--- Classes/InfoBox/RenderInfoBoxFactory.php | 4 ++-- .../OpenedTableDefinitionsInfoBox.php | 3 +-- .../TableCache/OpenedTablesInfoBox.php | 3 +-- .../InfoBox/ThreadCache/HitRatioInfoBox.php | 3 +-- Configuration/Backend/DashboardPresets.php | 7 ++++--- .../Backend/DashboardWidgetGroups.php | 7 ++++--- Configuration/Services.php | 9 +++++---- .../TCA/tx_mysqlreport_query_information.php | 2 ++ .../Functional/Configuration/ExtConfTest.php | 20 +++++++++---------- .../Factory/QueryInformationFactoryTest.php | 8 ++++++-- 43 files changed, 84 insertions(+), 134 deletions(-) diff --git a/Classes/Configuration/ExtConf.php b/Classes/Configuration/ExtConf.php index 85749ed..2fff753 100644 --- a/Classes/Configuration/ExtConf.php +++ b/Classes/Configuration/ExtConf.php @@ -97,14 +97,9 @@ public function isQueryLoggingActivated(): bool return false; } - if ($this->isEnableFrontendLogging() && !$this->isBackendRequest()) { + if ($this->enableFrontendLogging && !$this->isBackendRequest()) { return true; } - - if ($this->isEnableBackendLogging() && $this->isBackendRequest()) { - return true; - } - - return false; + return $this->enableBackendLogging && $this->isBackendRequest(); } } diff --git a/Classes/Controller/ProfileController.php b/Classes/Controller/ProfileController.php index 6d740b3..969a548 100644 --- a/Classes/Controller/ProfileController.php +++ b/Classes/Controller/ProfileController.php @@ -151,7 +151,6 @@ public function downloadAction(string $uniqueIdentifier, string $downloadType): /** * @param array $headerColumns * @param array $records - * @return ResponseInterface */ private function downloadAsCsv(array $headerColumns, array $records): ResponseInterface { @@ -160,7 +159,6 @@ private function downloadAsCsv(array $headerColumns, array $records): ResponseIn /** * @param array $records - * @return ResponseInterface */ private function downloadAsJson(array $records): ResponseInterface { diff --git a/Classes/DependencyInjection/DashboardPass.php b/Classes/DependencyInjection/DashboardPass.php index 417fd5f..d121fb6 100644 --- a/Classes/DependencyInjection/DashboardPass.php +++ b/Classes/DependencyInjection/DashboardPass.php @@ -22,12 +22,7 @@ */ readonly class DashboardPass implements CompilerPassInterface { - private string $tagName; - - public function __construct(string $tagName) - { - $this->tagName = $tagName; - } + public function __construct(private string $tagName) {} /** * Start removing registered dashboard widgets if EXT:dashboard is not installed @@ -42,7 +37,7 @@ public function __construct(string $tagName) public function process(ContainerBuilder $container): void { if (!$container->has(DashboardController::class)) { - foreach ($container->findTaggedServiceIds($this->tagName) as $id => $tags) { + foreach (array_keys($container->findTaggedServiceIds($this->tagName)) as $id) { $container->removeDefinition($id); } } diff --git a/Classes/Doctrine/Middleware/LoggerStatement.php b/Classes/Doctrine/Middleware/LoggerStatement.php index bdfdc0a..c42932a 100644 --- a/Classes/Doctrine/Middleware/LoggerStatement.php +++ b/Classes/Doctrine/Middleware/LoggerStatement.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\Doctrine\Middleware; use Doctrine\DBAL\Driver\Result as ResultInterface; -use Doctrine\DBAL\Driver\Statement; use Doctrine\DBAL\Driver\Statement as StatementInterface; use Doctrine\DBAL\ParameterType; use StefanFroemken\Mysqlreport\Domain\Model\QueryInformation; @@ -21,7 +20,7 @@ /** * Here in the connection, we can wrap our logger around the queries and commands. */ -class LoggerStatement implements Statement +class LoggerStatement implements StatementInterface { /** * @var array diff --git a/Classes/Doctrine/Middleware/LoggerWithQueryTimeConnection.php b/Classes/Doctrine/Middleware/LoggerWithQueryTimeConnection.php index 1b41b70..e7214cb 100644 --- a/Classes/Doctrine/Middleware/LoggerWithQueryTimeConnection.php +++ b/Classes/Doctrine/Middleware/LoggerWithQueryTimeConnection.php @@ -30,13 +30,13 @@ class LoggerWithQueryTimeConnection extends AbstractConnectionMiddleware /** * @var \SplQueue */ - private \SplQueue $queries; + private readonly \SplQueue $queries; - private MySqlReportSqlLogger $logger; + private readonly MySqlReportSqlLogger $logger; - private ExplainQueryHelper $explainQueryHelper; + private readonly ExplainQueryHelper $explainQueryHelper; - private QueryInformationRepository $queryInformationRepository; + private readonly QueryInformationRepository $queryInformationRepository; public function __construct(Connection $connection) { diff --git a/Classes/Domain/Factory/QueryInformationFactory.php b/Classes/Domain/Factory/QueryInformationFactory.php index 154d2f6..084f7fd 100644 --- a/Classes/Domain/Factory/QueryInformationFactory.php +++ b/Classes/Domain/Factory/QueryInformationFactory.php @@ -14,6 +14,7 @@ use Psr\Http\Message\ServerRequestInterface; use StefanFroemken\Mysqlreport\Domain\Model\QueryInformation; use StefanFroemken\Mysqlreport\Traits\Typo3RequestTrait; +use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -48,7 +49,7 @@ public function __construct() $this->request = (string)GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'); $this->mode = $this->getTypo3Mode(); $this->uniqueCallIdentifier = uniqid('', true); - $this->crdate = (int)$GLOBALS['EXEC_TIME']; + $this->crdate = (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp'); } public function createNewQueryInformation(): QueryInformation diff --git a/Classes/Event/ModifyQueryInformationRecordsEvent.php b/Classes/Event/ModifyQueryInformationRecordsEvent.php index 5b9fb65..03fb200 100644 --- a/Classes/Event/ModifyQueryInformationRecordsEvent.php +++ b/Classes/Event/ModifyQueryInformationRecordsEvent.php @@ -17,22 +17,10 @@ */ class ModifyQueryInformationRecordsEvent { - private string $methodName; - - /** - * @var array - */ - private array $queryInformationRecords; - /** - * @param string $methodName * @param array $queryInformationRecords */ - public function __construct(string $methodName, array $queryInformationRecords) - { - $this->methodName = $methodName; - $this->queryInformationRecords = $queryInformationRecords; - } + public function __construct(private readonly string $methodName, private array $queryInformationRecords) {} public function getMethodName(): string { diff --git a/Classes/EventListener/CacheAction.php b/Classes/EventListener/CacheAction.php index 3348d98..13be178 100644 --- a/Classes/EventListener/CacheAction.php +++ b/Classes/EventListener/CacheAction.php @@ -30,7 +30,6 @@ public function __construct( /** * Add clear cache menu entry * - * @param ModifyClearCacheActionsEvent $modifyClearCacheActionsEvent * @throws RouteNotFoundException */ public function __invoke(ModifyClearCacheActionsEvent $modifyClearCacheActionsEvent): void diff --git a/Classes/Helper/ExplainQueryHelper.php b/Classes/Helper/ExplainQueryHelper.php index 825f924..2f23ef9 100644 --- a/Classes/Helper/ExplainQueryHelper.php +++ b/Classes/Helper/ExplainQueryHelper.php @@ -29,9 +29,6 @@ public function __construct( private LoggerInterface $logger, ) {} - /** - * @param QueryInformation $queryInformation - */ public function updateQueryInformation(QueryInformation $queryInformation): void { if (!$this->extConf->isActivateExplainQuery()) { diff --git a/Classes/InfoBox/Information/ConnectionInfoBox.php b/Classes/InfoBox/Information/ConnectionInfoBox.php index 7c511be..1fed916 100644 --- a/Classes/InfoBox/Information/ConnectionInfoBox.php +++ b/Classes/InfoBox/Information/ConnectionInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index f009e05..4bc1153 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index 45627cf..cbf51e2 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index c72e21f..68a3c91 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -63,7 +62,7 @@ public function getBody(): string /** * get hit ratio of innoDb Buffer by SF */ - protected function getHitRatioBySF(): float + private function getHitRatioBySF(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index 8818e97..437c4d8 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -64,7 +63,7 @@ public function getBody(): string * get hit ratio of innoDb Buffer * A ratio of 99.9 equals 1/1000 */ - protected function getHitRatio(): float + private function getHitRatio(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 8c118b1..7104dba 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -58,7 +57,7 @@ public function getBody(): string * * @return array */ - protected function getLoad(): array + private function getLoad(): array { $load = []; $status = $this->statusValues; diff --git a/Classes/InfoBox/InnoDb/InstancesInfoBox.php b/Classes/InfoBox/InnoDb/InstancesInfoBox.php index bddcf17..f40935a 100644 --- a/Classes/InfoBox/InnoDb/InstancesInfoBox.php +++ b/Classes/InfoBox/InnoDb/InstancesInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -59,7 +58,7 @@ public function getBody(): string ); } - protected function getInstances(): int + private function getInstances(): int { $variables = $this->variables; @@ -70,9 +69,9 @@ public function getState(): StateEnumeration { $variables = $this->variables; - $innodbBufferShouldBe = $variables['innodb_buffer_pool_instances'] * (1 * 1024 * 1024 * 1024); // Instances * 1 GB + $innodbBufferShouldBe = $variables['innodb_buffer_pool_instances'] * (1024 * 1024 * 1024); // Instances * 1 GB if ( - $variables['innodb_buffer_pool_size'] < (1 * 1024 * 1024 * 1024) + $variables['innodb_buffer_pool_size'] < (1024 * 1024 * 1024) && $variables['innodb_buffer_pool_instances'] === 1 ) { $state = StateEnumeration::STATE_OK; diff --git a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php index 8bac1bd..b380e40 100644 --- a/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php +++ b/Classes/InfoBox/InnoDb/LogFileSizeInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -70,7 +69,7 @@ public function getBody(): string * * @return array */ - protected function getLogFileSize(): array + private function getLogFileSize(): array { $variables = $this->variables; @@ -97,11 +96,9 @@ public function getState(): StateEnumeration $sizeOfEachLogFile = $this->getSizeOfEachLogFile(); if ($sizeOfEachLogFile < 5242880 || $sizeOfEachLogFile < $variables['innodb_log_file_size']) { - $state = StateEnumeration::STATE_OK; - } else { - $state = StateEnumeration::STATE_ERROR; + return StateEnumeration::STATE_OK; } - return $state; + return StateEnumeration::STATE_ERROR; } } diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index 8083116..580e332 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -62,7 +61,7 @@ public function getBody(): string * get write ratio of innoDb Buffer * A value higher than 1 is good */ - protected function getWriteRatio(): float + private function getWriteRatio(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index 380a999..bb08dd8 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index bb3eeaf..0be5b24 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; use TYPO3\CMS\Core\Utility\CommandUtility; @@ -59,7 +58,7 @@ public function getBody(): string /** * Execute shell command to get amount of max network requests by OS */ - protected function getMaxNetworkRequests(): string + private function getMaxNetworkRequests(): string { $value = ''; $command = CommandUtility::getCommand('sysctl'); diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index c6cb2eb..69b7afa 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index 96d4eb1..f8c9879 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index a2d446e..b0fe4af 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index 1fea5ca..7bb8694 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; diff --git a/Classes/InfoBox/Misc/TempTablesInfoBox.php b/Classes/InfoBox/Misc/TempTablesInfoBox.php index 4f70f98..8326a88 100644 --- a/Classes/InfoBox/Misc/TempTablesInfoBox.php +++ b/Classes/InfoBox/Misc/TempTablesInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index bf75162..5d3981f 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; @@ -30,13 +29,13 @@ { public const TITLE = 'Average Query Size'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; @@ -62,7 +61,7 @@ public function getBody(): string ); } - protected function getAvgQuerySize(): float + private function getAvgQuerySize(): float { $status = $this->statusValues; @@ -74,7 +73,7 @@ protected function getAvgQuerySize(): float return round($avgQuerySize, 4); } - protected function getUsedQueryCacheSize(): int + private function getUsedQueryCacheSize(): int { $status = $this->statusValues; $variables = $this->variables; @@ -91,11 +90,9 @@ public function getState(): StateEnumeration $avgQuerySize = $this->getAvgQuerySize(); if ($avgQuerySize > $variables['query_cache_min_res_unit']) { - $state = StateEnumeration::STATE_ERROR; - } else { - $state = StateEnumeration::STATE_OK; + return StateEnumeration::STATE_ERROR; } - return $state; + return StateEnumeration::STATE_OK; } } diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 24350bd..0484e09 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; @@ -30,13 +29,13 @@ { public const TITLE = 'Average Used Blocks'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; @@ -70,7 +69,7 @@ public function getBody(): string * * @link: http://dev.mysql.com/doc/refman/5.0/en/query-cache-status-and-maintenance.html */ - protected function getAvgUsedBlocks(): float + private function getAvgUsedBlocks(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 4ece219..9757302 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; @@ -30,13 +29,13 @@ { public const TITLE = 'Fragmentation Ratio'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; @@ -66,7 +65,7 @@ public function getBody(): string ); } - protected function getFragmentationRatio(): float + private function getFragmentationRatio(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index b2cf602..959394f 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; @@ -31,13 +30,13 @@ { public const TITLE = 'Hit Ratio'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; @@ -64,7 +63,7 @@ public function getBody(): string ); } - protected function getHitRatio(): float + private function getHitRatio(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index c2c4c19..5f2d1c6 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; @@ -31,13 +30,13 @@ { public const TITLE = 'Insert Ratio'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; @@ -66,7 +65,7 @@ public function getBody(): string ); } - protected function getInsertRatio(): float + private function getInsertRatio(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index 1aaabaa..83c2370 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; @@ -31,13 +30,13 @@ { public const TITLE = 'Prune Ratio'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; @@ -74,7 +73,7 @@ public function getBody(): string ); } - protected function getPruneRatio(): float + private function getPruneRatio(): float { $status = $this->statusValues; $pruneRatio = 0; diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index 2ef7878..e5e4732 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; @@ -30,13 +29,13 @@ { public const TITLE = 'Query Cache too high'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index 4763af5..21e2d96 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; @@ -31,13 +30,13 @@ { public const TITLE = 'Query Cache Status'; + private QueryCacheHelper $queryCacheHelper; + public function __construct( private StatusValues $statusValues, private Variables $variables, ) {} - private QueryCacheHelper $queryCacheHelper; - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void { $this->queryCacheHelper = $queryCacheHelper; diff --git a/Classes/InfoBox/RenderInfoBoxFactory.php b/Classes/InfoBox/RenderInfoBoxFactory.php index 0977418..2efd6e3 100644 --- a/Classes/InfoBox/RenderInfoBoxFactory.php +++ b/Classes/InfoBox/RenderInfoBoxFactory.php @@ -15,12 +15,12 @@ use TYPO3\CMS\Core\View\ViewFactoryInterface; use TYPO3\CMS\Core\View\ViewInterface; -final class RenderInfoBoxFactory +final readonly class RenderInfoBoxFactory { private const TEMPLATE_FILE = 'EXT:mysqlreport/Resources/Private/Templates/InfoBox/Default.html'; public function __construct( - private readonly ViewFactoryInterface $viewFactory, + private ViewFactoryInterface $viewFactory, ) {} /** diff --git a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php index beccc2c..cebda20 100644 --- a/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTableDefinitionsInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -52,7 +51,7 @@ public function getBody(): string /** * Get the number of opened table definitions each second */ - protected function getOpenedTableDefinitionsEachSecond(): float + private function getOpenedTableDefinitionsEachSecond(): float { $status = $this->statusValues; diff --git a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php index b3fd086..e19e206 100644 --- a/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php +++ b/Classes/InfoBox/TableCache/OpenedTablesInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -55,7 +54,7 @@ public function getBody(): string /** * get number of opened tables each second */ - protected function getOpenedTablesEachSecond(): float + private function getOpenedTablesEachSecond(): float { $status = $this->statusValues; $openedTables = $status['Opened_tables'] / $status['Uptime']; diff --git a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php index 567e937..12464d8 100644 --- a/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/ThreadCache/HitRatioInfoBox.php @@ -13,7 +13,6 @@ use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; - use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -66,7 +65,7 @@ public function getBody(): string * get hit ratio of threads cache * A ratio nearly 100 would be cool */ - protected function getHitRatio(): float + private function getHitRatio(): float { $status = $this->statusValues; diff --git a/Configuration/Backend/DashboardPresets.php b/Configuration/Backend/DashboardPresets.php index 80f2ff9..f310f19 100644 --- a/Configuration/Backend/DashboardPresets.php +++ b/Configuration/Backend/DashboardPresets.php @@ -2,6 +2,8 @@ declare(strict_types=1); +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; + /* * This file is part of the package stefanfroemken/mysqlreport. * @@ -9,7 +11,7 @@ * LICENSE file that was distributed with this source code. */ -if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('dashboard')) { +if (ExtensionManagementUtility::isLoaded('dashboard')) { return [ 'mysqlreport' => [ 'title' => 'LLL:EXT:mysqlreport/Resources/Private/Language/locallang.xlf:dashboard.mysqlreport.title', @@ -25,6 +27,5 @@ 'showInWizard' => true, ], ]; -} else { - return []; } +return []; diff --git a/Configuration/Backend/DashboardWidgetGroups.php b/Configuration/Backend/DashboardWidgetGroups.php index e2e639e..c07c252 100644 --- a/Configuration/Backend/DashboardWidgetGroups.php +++ b/Configuration/Backend/DashboardWidgetGroups.php @@ -2,6 +2,8 @@ declare(strict_types=1); +use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; + /* * This file is part of the package stefanfroemken/mysqlreport. * @@ -9,12 +11,11 @@ * LICENSE file that was distributed with this source code. */ -if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded('dashboard')) { +if (ExtensionManagementUtility::isLoaded('dashboard')) { return [ 'mysqlreport' => [ 'title' => 'LLL:EXT:mysqlreport/Resources/Private/Language/locallang.xlf:widget.group.mysqlreport', ], ]; -} else { - return []; } +return []; diff --git a/Configuration/Services.php b/Configuration/Services.php index bd31e4e..83c5044 100644 --- a/Configuration/Services.php +++ b/Configuration/Services.php @@ -2,14 +2,15 @@ declare(strict_types=1); -use StefanFroemken\Mysqlreport\DependencyInjection; +use StefanFroemken\Mysqlreport\DependencyInjection\DashboardPass; +use Symfony\Component\Config\Resource\ComposerResource; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator; -return static function (ContainerConfigurator $container, ContainerBuilder $containerBuilder) { - $containerBuilder->addCompilerPass(new DependencyInjection\DashboardPass('dashboard.widget')); +return static function (ContainerConfigurator $container, ContainerBuilder $containerBuilder): void { + $containerBuilder->addCompilerPass(new DashboardPass('dashboard.widget')); - $composerResource = new \Symfony\Component\Config\Resource\ComposerResource(); + $composerResource = new ComposerResource(); foreach ($composerResource->getVendors() as $vendorPath) { $sqlFormatterDir = $vendorPath . '/doctrine/sql-formatter/src'; if (is_dir($sqlFormatterDir)) { diff --git a/Configuration/TCA/tx_mysqlreport_query_information.php b/Configuration/TCA/tx_mysqlreport_query_information.php index 0b31dce..9d834f9 100644 --- a/Configuration/TCA/tx_mysqlreport_query_information.php +++ b/Configuration/TCA/tx_mysqlreport_query_information.php @@ -1,5 +1,7 @@ extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([]); @@ -64,7 +64,7 @@ public function isEnableFrontendLoggingInitiallyReturnsFalse(): void public function setEnableFrontendLoggingSetsEnableFrontendLogging(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([ @@ -82,7 +82,7 @@ public function setEnableFrontendLoggingSetsEnableFrontendLogging(): void public function isEnableBackendLoggingInitiallyReturnsFalse(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([]); @@ -98,7 +98,7 @@ public function isEnableBackendLoggingInitiallyReturnsFalse(): void public function setEnableBackendLoggingSetsEnableBackendLogging(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([ @@ -116,7 +116,7 @@ public function setEnableBackendLoggingSetsEnableBackendLogging(): void public function isActivateExplainQueryInitiallyReturnsFalse(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([]); @@ -132,7 +132,7 @@ public function isActivateExplainQueryInitiallyReturnsFalse(): void public function setActivateExplainQuerySetsActivateExplainQuery(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([ @@ -150,7 +150,7 @@ public function setActivateExplainQuerySetsActivateExplainQuery(): void public function getSlowQueryThresholdInitiallyReturns10Seconds(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([]); @@ -167,7 +167,7 @@ public function getSlowQueryThresholdInitiallyReturns10Seconds(): void public function setSlowQueryThresholdWithIntegerSetsSlowQueryThreshold(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([ @@ -186,7 +186,7 @@ public function setSlowQueryThresholdWithIntegerSetsSlowQueryThreshold(): void public function setSlowQueryThresholdWithFloatSetsSlowQueryThreshold(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([ @@ -205,7 +205,7 @@ public function setSlowQueryThresholdWithFloatSetsSlowQueryThreshold(): void public function setSlowQueryThresholdWithCommaFloatSetsSlowQueryThreshold(): void { $this->extensionConfigurationMock - ->expects(self::once()) + ->expects($this->once()) ->method('get') ->with('mysqlreport') ->willReturn([ diff --git a/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php b/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php index b4812aa..7045276 100644 --- a/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php +++ b/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php @@ -13,10 +13,13 @@ use PHPUnit\Framework\Attributes\Test; use StefanFroemken\Mysqlreport\Domain\Factory\QueryInformationFactory; +use TYPO3\CMS\Core\Context\Context; +use TYPO3\CMS\Core\Context\DateTimeAspect; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Routing\PageArguments; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\TestingFramework\Core\Unit\UnitTestCase; /** @@ -32,7 +35,8 @@ protected function setUp(): void { $this->time = time(); - $GLOBALS['EXEC_TIME'] = $this->time; + $context = GeneralUtility::makeInstance(Context::class); + $context->setAspect('date', new DateTimeAspect(new \DateTimeImmutable('@' . $this->time))); $_SERVER = array_merge($_SERVER, [ 'REMOTE_ADDR' => '123.124.125.126', @@ -66,8 +70,8 @@ protected function tearDown(): void unset( $this->subject, $GLOBALS['TYPO3_REQUEST'], - $GLOBALS['EXEC_TIME'], ); + GeneralUtility::purgeInstances(); } #[Test] From 82f42bffe19070d3d20a7035603ace2c2ea3b1e0 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:24:19 +0200 Subject: [PATCH 20/27] [TASK] Add packages/ to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index f31d9c3..0c119d8 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,7 @@ /.ddev /.Build /composer.lock +/packages/ *GENERATED* /Build/testing-docker/.env /.php-cs-fixer.cache From c58bc35f72533da2f0583e10529a47daa2a605fd Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:25:00 +0200 Subject: [PATCH 21/27] [TASK] Add scratch/ to gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index 0c119d8..f080a92 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,7 @@ /.Build /composer.lock /packages/ +/scratch/ *GENERATED* /Build/testing-docker/.env /.php-cs-fixer.cache From bfe990aa074f3ec4d9cc8e61b3ae366f5343a306 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:26:36 +0200 Subject: [PATCH 22/27] [TASK] Update TYPO3 version constraint in ext_emconf.php via Rector --- Build/rector/rector.php | 1 + ext_emconf.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Build/rector/rector.php b/Build/rector/rector.php index 7c983bc..a5bbf99 100644 --- a/Build/rector/rector.php +++ b/Build/rector/rector.php @@ -25,6 +25,7 @@ __DIR__ . '/../../Classes', __DIR__ . '/../../Configuration', __DIR__ . '/../../Tests', + __DIR__ . '/../../ext_emconf.php', ]) ->withPreparedSets( deadCode: true, diff --git a/ext_emconf.php b/ext_emconf.php index 6030b3d..10e9237 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -11,7 +11,7 @@ 'version' => '5.1.0', 'constraints' => [ 'depends' => [ - 'typo3' => '14.1.0-14.99.99', + 'typo3' => '14.3.0-14.3.99', ], 'conflicts' => [ 'adminpanel' => '', From eed45918120345332946fc691d0a25cf14bc523c Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:28:29 +0200 Subject: [PATCH 23/27] [TASK] Clean ext_localconf.php and remove call_user_func wrapper --- Build/rector/rector.php | 1 + ext_localconf.php | 45 +++++++++++++++++++++++------------------ 2 files changed, 26 insertions(+), 20 deletions(-) diff --git a/Build/rector/rector.php b/Build/rector/rector.php index a5bbf99..a3dca2b 100644 --- a/Build/rector/rector.php +++ b/Build/rector/rector.php @@ -26,6 +26,7 @@ __DIR__ . '/../../Configuration', __DIR__ . '/../../Tests', __DIR__ . '/../../ext_emconf.php', + __DIR__ . '/../../ext_localconf.php', ]) ->withPreparedSets( deadCode: true, diff --git a/ext_localconf.php b/ext_localconf.php index 3f62f8f..b59f4fc 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,29 +1,34 @@ clearProfiles'; +use Psr\Log\LogLevel; +use StefanFroemken\Mysqlreport\Doctrine\Middleware\LoggerWithQueryTimeMiddleware; +use StefanFroemken\Mysqlreport\EventListener\CacheAction; +use TYPO3\CMS\Core\Log\Writer\FileWriter; - // Register our logger in Doctrine Middleware - $GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['driverMiddlewares']['mysqlreport-dbal-middleware'] = [ - 'target' => \StefanFroemken\Mysqlreport\Doctrine\Middleware\LoggerWithQueryTimeMiddleware::class, - 'after' => [ - 'typo3/core/custom-platform-driver-middleware', - ], - ]; +// TRUNCATE table tx_mysqlreport_query_information on clear cache action +$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['clearCachePostProc'][] + = CacheAction::class . '->clearProfiles'; + +// Register our logger in Doctrine Middleware +$GLOBALS['TYPO3_CONF_VARS']['DB']['Connections']['Default']['driverMiddlewares']['mysqlreport-dbal-middleware'] = [ + 'target' => LoggerWithQueryTimeMiddleware::class, + 'after' => [ + 'typo3/core/custom-platform-driver-middleware', + ], +]; - if (!isset($GLOBALS['TYPO3_CONF_VARS']['LOG']['StefanFroemken']['Mysqlreport']['writerConfiguration'])) { - $GLOBALS['TYPO3_CONF_VARS']['LOG']['StefanFroemken']['Mysqlreport']['writerConfiguration'] = [ - \Psr\Log\LogLevel::INFO => [ - \TYPO3\CMS\Core\Log\Writer\FileWriter::class => [ - 'logFileInfix' => 'mysqlreport', - ], +if (!isset($GLOBALS['TYPO3_CONF_VARS']['LOG']['StefanFroemken']['Mysqlreport']['writerConfiguration'])) { + $GLOBALS['TYPO3_CONF_VARS']['LOG']['StefanFroemken']['Mysqlreport']['writerConfiguration'] = [ + LogLevel::INFO => [ + FileWriter::class => [ + 'logFileInfix' => 'mysqlreport', ], - ]; - } -}); + ], + ]; +} From 14d271811779badcdaf130001060dd36d066d16f Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:29:29 +0200 Subject: [PATCH 24/27] [DOCS] Update TYPO3 version and build status badge in README.md --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index cd11dd4..9d1ce8f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,11 @@ # MySQL Report [![Latest Stable Version](https://poser.pugx.org/stefanfroemken/mysqlreport/v/stable.svg)](https://packagist.org/packages/stefanfroemken/mysqlreport) -[![TYPO3 13.2](https://img.shields.io/badge/TYPO3-13.2-green.svg)](https://get.typo3.org/version/13) +[![TYPO3 14.3](https://img.shields.io/badge/TYPO3-14.3-green.svg)](https://get.typo3.org/version/14) [![License](https://poser.pugx.org/stefanfroemken/mysqlreport/license)](https://packagist.org/packages/stefanfroemken/mysqlreport) [![Total Downloads](https://poser.pugx.org/stefanfroemken/mysqlreport/downloads.svg)](https://packagist.org/packages/stefanfroemken/mysqlreport) [![Monthly Downloads](https://poser.pugx.org/stefanfroemken/mysqlreport/d/monthly)](https://packagist.org/packages/stefanfroemken/mysqlreport) -![Build Status](https://github.com/froemken/mysqlreport/actions/workflows/typo3_13.yml/badge.svg) +![Build Status](https://github.com/froemken/mysqlreport/actions/workflows/ci.yml/badge.svg) With `mysqlreport` you can analyze and profile all SQL queries created by `ConnectionPool` and Doctrine `QueryBuilder`. From f936a4e764260a1dd62082d03c300179404cbafb Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:40:56 +0200 Subject: [PATCH 25/27] [TASK] Resolve PHPStan static analysis errors --- Classes/Controller/InnoDBController.php | 3 +++ Classes/Controller/MiscController.php | 3 +++ Classes/Controller/QueryCacheController.php | 3 +++ Classes/Controller/StatusController.php | 3 +++ Classes/Controller/TableCacheController.php | 3 +++ Classes/Controller/ThreadCacheController.php | 3 +++ Classes/EventListener/CacheAction.php | 2 +- Classes/InfoBox/Information/ServerVersionInfoBox.php | 2 -- Classes/InfoBox/Information/UptimeInfoBox.php | 2 -- Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php | 2 -- Classes/InfoBox/InnoDb/HitRatioInfoBox.php | 2 -- Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php | 2 -- Classes/InfoBox/InnoDb/WriteRatioInfoBox.php | 2 -- Classes/InfoBox/Misc/AbortedConnectsInfoBox.php | 2 -- Classes/InfoBox/Misc/BackLogInfoBox.php | 2 -- Classes/InfoBox/Misc/BinaryLogInfoBox.php | 2 -- Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php | 2 -- Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php | 2 -- Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php | 2 -- Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php | 8 +------- .../InfoBox/QueryCache/AverageUsedBlocksInfoBox.php | 8 +------- .../InfoBox/QueryCache/FragmentationRatioInfoBox.php | 8 +------- Classes/InfoBox/QueryCache/HitRatioInfoBox.php | 8 +------- Classes/InfoBox/QueryCache/InsertRatioInfoBox.php | 8 +------- Classes/InfoBox/QueryCache/PruneRatioInfoBox.php | 8 +------- .../QueryCache/QueryCacheSizeTooHighInfoBox.php | 10 +--------- Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php | 10 +--------- 27 files changed, 27 insertions(+), 85 deletions(-) diff --git a/Classes/Controller/InnoDBController.php b/Classes/Controller/InnoDBController.php index 636026d..d7f2f34 100644 --- a/Classes/Controller/InnoDBController.php +++ b/Classes/Controller/InnoDBController.php @@ -18,6 +18,9 @@ class InnoDBController extends ActionController { + /** + * @param iterable $infoBoxes + */ public function __construct( private readonly iterable $infoBoxes, private readonly RenderInfoBoxFactory $renderInfoBoxFactory, diff --git a/Classes/Controller/MiscController.php b/Classes/Controller/MiscController.php index fc1874f..6c73559 100644 --- a/Classes/Controller/MiscController.php +++ b/Classes/Controller/MiscController.php @@ -18,6 +18,9 @@ class MiscController extends ActionController { + /** + * @param iterable $infoBoxes + */ public function __construct( private readonly iterable $infoBoxes, private readonly RenderInfoBoxFactory $renderInfoBoxFactory, diff --git a/Classes/Controller/QueryCacheController.php b/Classes/Controller/QueryCacheController.php index 4bd5c16..bad13c2 100644 --- a/Classes/Controller/QueryCacheController.php +++ b/Classes/Controller/QueryCacheController.php @@ -18,6 +18,9 @@ class QueryCacheController extends ActionController { + /** + * @param iterable $infoBoxes + */ public function __construct( private readonly iterable $infoBoxes, private readonly RenderInfoBoxFactory $renderInfoBoxFactory, diff --git a/Classes/Controller/StatusController.php b/Classes/Controller/StatusController.php index 5f43a77..38c834a 100644 --- a/Classes/Controller/StatusController.php +++ b/Classes/Controller/StatusController.php @@ -18,6 +18,9 @@ class StatusController extends ActionController { + /** + * @param iterable $infoBoxes + */ public function __construct( private readonly iterable $infoBoxes, private readonly RenderInfoBoxFactory $renderInfoBoxFactory, diff --git a/Classes/Controller/TableCacheController.php b/Classes/Controller/TableCacheController.php index e66ea94..bd7e274 100644 --- a/Classes/Controller/TableCacheController.php +++ b/Classes/Controller/TableCacheController.php @@ -18,6 +18,9 @@ class TableCacheController extends ActionController { + /** + * @param iterable $infoBoxes + */ public function __construct( private readonly iterable $infoBoxes, private readonly RenderInfoBoxFactory $renderInfoBoxFactory, diff --git a/Classes/Controller/ThreadCacheController.php b/Classes/Controller/ThreadCacheController.php index e04fb6b..104113d 100644 --- a/Classes/Controller/ThreadCacheController.php +++ b/Classes/Controller/ThreadCacheController.php @@ -18,6 +18,9 @@ class ThreadCacheController extends ActionController { + /** + * @param iterable $infoBoxes + */ public function __construct( private readonly iterable $infoBoxes, private readonly RenderInfoBoxFactory $renderInfoBoxFactory, diff --git a/Classes/EventListener/CacheAction.php b/Classes/EventListener/CacheAction.php index 13be178..c209fa9 100644 --- a/Classes/EventListener/CacheAction.php +++ b/Classes/EventListener/CacheAction.php @@ -39,7 +39,7 @@ public function __invoke(ModifyClearCacheActionsEvent $modifyClearCacheActionsEv 'id' => 'mysqlprofile', 'title' => 'LLL:EXT:mysqlreport/Resources/Private/Language/locallang.xlf:clearCache.title', 'description' => 'LLL:EXT:mysqlreport/Resources/Private/Language/locallang.xlf:clearCache.description', - 'href' => (string)$this->uriBuilder->buildUriFromRoute('tce_db', ['cacheCmd' => 'mysqlprofiles']), + 'endpoint' => (string)$this->uriBuilder->buildUriFromRoute('tce_db', ['cacheCmd' => 'mysqlprofiles']), 'iconIdentifier' => 'actions-system-cache-clear-impact-high', ]); } diff --git a/Classes/InfoBox/Information/ServerVersionInfoBox.php b/Classes/InfoBox/Information/ServerVersionInfoBox.php index 4bc1153..bf56446 100644 --- a/Classes/InfoBox/Information/ServerVersionInfoBox.php +++ b/Classes/InfoBox/Information/ServerVersionInfoBox.php @@ -11,7 +11,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Information; -use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; @@ -30,7 +29,6 @@ public const TITLE = 'Server Information'; public function __construct( - private StatusValues $statusValues, private Variables $variables, ) {} diff --git a/Classes/InfoBox/Information/UptimeInfoBox.php b/Classes/InfoBox/Information/UptimeInfoBox.php index cbf51e2..0fc2fd0 100644 --- a/Classes/InfoBox/Information/UptimeInfoBox.php +++ b/Classes/InfoBox/Information/UptimeInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Information; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -31,7 +30,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php index 68a3c91..89b192d 100644 --- a/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioBySFInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -31,7 +30,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php index 437c4d8..cbd92ac 100644 --- a/Classes/InfoBox/InnoDb/HitRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/HitRatioInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -31,7 +30,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php index 7104dba..f5d101d 100644 --- a/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php +++ b/Classes/InfoBox/InnoDb/InnoDbBufferLoadInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; use StefanFroemken\Mysqlreport\InfoBox\ListElement; @@ -32,7 +31,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php index 580e332..6bccbaf 100644 --- a/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php +++ b/Classes/InfoBox/InnoDb/WriteRatioInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\InnoDb; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxStateInterface; @@ -30,7 +29,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php index bb08dd8..5f47ada 100644 --- a/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php +++ b/Classes/InfoBox/Misc/AbortedConnectsInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -29,7 +28,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/Misc/BackLogInfoBox.php b/Classes/InfoBox/Misc/BackLogInfoBox.php index 0be5b24..e0aa464 100644 --- a/Classes/InfoBox/Misc/BackLogInfoBox.php +++ b/Classes/InfoBox/Misc/BackLogInfoBox.php @@ -11,7 +11,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; -use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -29,7 +28,6 @@ public const TITLE = 'Back Log'; public function __construct( - private StatusValues $statusValues, private Variables $variables, ) {} diff --git a/Classes/InfoBox/Misc/BinaryLogInfoBox.php b/Classes/InfoBox/Misc/BinaryLogInfoBox.php index 69b7afa..0f5a850 100644 --- a/Classes/InfoBox/Misc/BinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/BinaryLogInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -28,7 +27,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php index f8c9879..373f0dc 100644 --- a/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php +++ b/Classes/InfoBox/Misc/MaxAllowedPacketInfoBox.php @@ -11,7 +11,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; -use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxUnorderedListInterface; @@ -30,7 +29,6 @@ public const TITLE = 'Max Packet Size'; public function __construct( - private StatusValues $statusValues, private Variables $variables, ) {} diff --git a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php index b0fe4af..4ae9629 100644 --- a/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php +++ b/Classes/InfoBox/Misc/StandaloneReplicationInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -28,7 +27,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php index 7bb8694..e740de1 100644 --- a/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php +++ b/Classes/InfoBox/Misc/SyncBinaryLogInfoBox.php @@ -12,7 +12,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\Misc; use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; -use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\InfoBox\InfoBoxInterface; use Symfony\Component\DependencyInjection\Attribute\AutoconfigureTag; @@ -28,7 +27,6 @@ public function __construct( private StatusValues $statusValues, - private Variables $variables, ) {} public function getBody(): string diff --git a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php index 5d3981f..3ab5058 100644 --- a/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageQuerySizeInfoBox.php @@ -29,18 +29,12 @@ { public const TITLE = 'Average Query Size'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if ( diff --git a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php index 0484e09..419e967 100644 --- a/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php +++ b/Classes/InfoBox/QueryCache/AverageUsedBlocksInfoBox.php @@ -29,18 +29,12 @@ { public const TITLE = 'Average Used Blocks'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if ( diff --git a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php index 9757302..32aaab8 100644 --- a/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/FragmentationRatioInfoBox.php @@ -29,18 +29,12 @@ { public const TITLE = 'Fragmentation Ratio'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if ( diff --git a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php index 959394f..9584ca6 100644 --- a/Classes/InfoBox/QueryCache/HitRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/HitRatioInfoBox.php @@ -30,18 +30,12 @@ { public const TITLE = 'Hit Ratio'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if ( diff --git a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php index 5f2d1c6..7d99d1c 100644 --- a/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/InsertRatioInfoBox.php @@ -30,18 +30,12 @@ { public const TITLE = 'Insert Ratio'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if ( diff --git a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php index 83c2370..10a17e5 100644 --- a/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php +++ b/Classes/InfoBox/QueryCache/PruneRatioInfoBox.php @@ -30,18 +30,12 @@ { public const TITLE = 'Prune Ratio'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if ( diff --git a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php index e5e4732..de031bc 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheSizeTooHighInfoBox.php @@ -11,7 +11,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; -use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; @@ -29,18 +28,11 @@ { public const TITLE = 'Query Cache too high'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( - private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if ( diff --git a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php index 21e2d96..a6871fc 100644 --- a/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php +++ b/Classes/InfoBox/QueryCache/QueryCacheStatusInfoBox.php @@ -11,7 +11,6 @@ namespace StefanFroemken\Mysqlreport\InfoBox\QueryCache; -use StefanFroemken\Mysqlreport\Domain\Model\StatusValues; use StefanFroemken\Mysqlreport\Domain\Model\Variables; use StefanFroemken\Mysqlreport\Enumeration\StateEnumeration; use StefanFroemken\Mysqlreport\Helper\QueryCacheHelper; @@ -30,18 +29,11 @@ { public const TITLE = 'Query Cache Status'; - private QueryCacheHelper $queryCacheHelper; - public function __construct( - private StatusValues $statusValues, private Variables $variables, + private QueryCacheHelper $queryCacheHelper, ) {} - public function injectQueryCacheHelper(QueryCacheHelper $queryCacheHelper): void - { - $this->queryCacheHelper = $queryCacheHelper; - } - public function getBody(): string { if (!$this->queryCacheHelper->isQueryCacheEnabled($this->variables)) { From 493a5cfb50e5f53523c7feaf0920d54da7eddce4 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:46:56 +0200 Subject: [PATCH 26/27] [BUGFIX] Use NormalizedParams instead of deprecated GeneralUtility::getIndpEnv --- .../Factory/QueryInformationFactory.php | 19 ++++++++++++++++--- .../Factory/QueryInformationFactoryTest.php | 4 +++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Classes/Domain/Factory/QueryInformationFactory.php b/Classes/Domain/Factory/QueryInformationFactory.php index 084f7fd..d654329 100644 --- a/Classes/Domain/Factory/QueryInformationFactory.php +++ b/Classes/Domain/Factory/QueryInformationFactory.php @@ -16,6 +16,7 @@ use StefanFroemken\Mysqlreport\Traits\Typo3RequestTrait; use TYPO3\CMS\Core\Context\Context; use TYPO3\CMS\Core\Core\Environment; +use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -44,9 +45,21 @@ public function __construct() { $this->pageUid = $this->getPageUid(); - $this->ip = (string)GeneralUtility::getIndpEnv('REMOTE_ADDR'); - $this->referer = (string)GeneralUtility::getIndpEnv('HTTP_REFERER'); - $this->request = (string)GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL'); + $ip = ''; + $referer = ''; + $requestUrl = ''; + $request = $GLOBALS['TYPO3_REQUEST'] ?? null; + if ($request instanceof ServerRequestInterface) { + $normalizedParams = $request->getAttribute('normalizedParams'); + if ($normalizedParams instanceof NormalizedParams) { + $ip = (string)$normalizedParams->getRemoteAddress(); + $referer = (string)$normalizedParams->getHttpReferer(); + $requestUrl = (string)$normalizedParams->getRequestUrl(); + } + } + $this->ip = $ip; + $this->referer = $referer; + $this->request = $requestUrl; $this->mode = $this->getTypo3Mode(); $this->uniqueCallIdentifier = uniqid('', true); $this->crdate = (int)GeneralUtility::makeInstance(Context::class)->getPropertyFromAspect('date', 'timestamp'); diff --git a/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php b/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php index 7045276..fd2d61f 100644 --- a/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php +++ b/Tests/Unit/Domain/Factory/QueryInformationFactoryTest.php @@ -17,6 +17,7 @@ use TYPO3\CMS\Core\Context\DateTimeAspect; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder; +use TYPO3\CMS\Core\Http\NormalizedParams; use TYPO3\CMS\Core\Http\ServerRequest; use TYPO3\CMS\Core\Routing\PageArguments; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -48,7 +49,8 @@ protected function setUp(): void $GLOBALS['TYPO3_REQUEST'] = (new ServerRequest('https://www.example.com/', 'GET', 'php://input', [], $_SERVER)) ->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_FE) - ->withAttribute('routing', new PageArguments(1, '0', [])); + ->withAttribute('routing', new PageArguments(1, '0', [])) + ->withAttribute('normalizedParams', NormalizedParams::createFromServerParams($_SERVER)); Environment::initialize( Environment::getContext(), From cf9c994ed998431b60afda924b8278c6788b39a8 Mon Sep 17 00:00:00 2001 From: Stefan Froemken Date: Sat, 13 Jun 2026 00:50:14 +0200 Subject: [PATCH 27/27] [TASK] Upgrade checkout action to v6 and add PHP 8.4 to matrix --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8d5afb6..eca0b6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,10 +15,11 @@ jobs: php: - '8.2' - '8.3' + - '8.4' steps: - name: 'Checkout' - uses: actions/checkout@v4 + uses: actions/checkout@v6 - name: 'Lint PHP' run: Build/Scripts/runTests.sh -p ${{ matrix.php }} -s lint