Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ insert_final_newline = true
trim_trailing_whitespace = true

# TS/JS-Files
[*.{ts,js}]
[*.{ts,js,mjs}]
indent_size = 2

# JSON-Files
Expand Down Expand Up @@ -51,8 +51,8 @@ indent_size = 2
indent_size = 2

# XLF-Files
[*.xlf]
indent_style = tab
[*.{xlf,xliff}]
indent_size = 2

# SQL-Files
[*.sql]
Expand Down
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/.github/ export-ignore
/Build/ export-ignore
/Tests/ export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/.editorconfig export-ignore
1 change: 0 additions & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
name: tests

on:
push:
pull_request:

jobs:
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
########################
# cache_analyzer
# mysql_widget
# global ignore file
########################

Expand Down
6 changes: 3 additions & 3 deletions Build/Scripts/runTests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash

#
# EXT:examples test runner based on docker/podman.
# EXT:mysqlreport test runner based on docker/podman.
#

trap 'cleanUp;exit 2' SIGINT
Expand Down Expand Up @@ -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.4"
if ! [[ ${DBMS_VERSION} =~ ^(10.4|10.5|10.6|10.7|10.8|10.9|10.10|10.11|11.0|11.1)$ ]]; then
[ -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
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
Expand Down
1 change: 1 addition & 0 deletions Build/phpunit/FunctionalTestsBootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the TYPO3 CMS project.
*
Expand Down
1 change: 1 addition & 0 deletions Build/phpunit/UnitTestsBootstrap.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

/*
* This file is part of the TYPO3 CMS project.
*
Expand Down
159 changes: 0 additions & 159 deletions Classes/DataProvider/InnoDbDataProvider.php

This file was deleted.

47 changes: 47 additions & 0 deletions Classes/Domain/Factory/HandlerFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package stefanfroemken/mysql-widget.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace StefanFroemken\MySqlWidget\Domain\Factory;

use Doctrine\DBAL\Exception;
use StefanFroemken\MySqlWidget\Domain\Model\Handler;
use TYPO3\CMS\Core\Database\ConnectionPool;

readonly class HandlerFactory
{
public function __construct(
protected ConnectionPool $connectionPool,
) {}

public function getHandler(): ?Handler
{
try {
$connection = $this->connectionPool->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME);
$queryResult = $connection->executeQuery('SHOW GLOBAL STATUS LIKE \'Handler_%\'');

$innoDbStatus = [];
while ($row = $queryResult->fetchAssociative()) {
$innoDbStatus[$row['Variable_name']] = $row['Value'];
}
} catch (Exception $e) {
return null;
}

return new Handler(
handlerReadRndNext: (int)($innoDbStatus['Handler_read_rnd_next'] ?? 0),
handlerReadRnd: (int)($innoDbStatus['Handler_read_rnd'] ?? 0),
handlerReadFirst: (int)($innoDbStatus['Handler_read_first'] ?? 0),
handlerReadNext: (int)($innoDbStatus['Handler_read_next'] ?? 0),
handlerReadKey: (int)($innoDbStatus['Handler_read_key'] ?? 0),
handlerReadPrev: (int)($innoDbStatus['Handler_read_prev'] ?? 0),
);
}
}
49 changes: 49 additions & 0 deletions Classes/Domain/Factory/InnoDbStatusFactory.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package stefanfroemken/mysql-widget.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace StefanFroemken\MySqlWidget\Domain\Factory;

use Doctrine\DBAL\Exception;
use StefanFroemken\MySqlWidget\Domain\Model\InnoDbStatus;
use TYPO3\CMS\Core\Database\ConnectionPool;

readonly class InnoDbStatusFactory
{
public function __construct(
protected ConnectionPool $connectionPool,
) {}

public function getInnoDbStatus(): ?InnoDbStatus
{
try {
$connection = $this->connectionPool->getConnectionByName(ConnectionPool::DEFAULT_CONNECTION_NAME);
$queryResult = $connection->executeQuery('SHOW GLOBAL STATUS LIKE \'Innodb_%\'');

$innoDbStatus = [];
while ($row = $queryResult->fetchAssociative()) {
$innoDbStatus[$row['Variable_name']] = $row['Value'];
}
} catch (Exception $e) {
return null;
}

return new InnoDbStatus(
innodbBufferPoolPagesData: (int)($innoDbStatus['Innodb_buffer_pool_pages_data'] ?? 0),
innodbBufferPoolPagesFree: (int)($innoDbStatus['Innodb_buffer_pool_pages_free'] ?? 0),
innodbBufferPoolPagesMisc: (int)($innoDbStatus['Innodb_buffer_pool_pages_misc'] ?? 0),
innodbBufferPoolPagesTotal: (int)($innoDbStatus['Innodb_buffer_pool_pages_total'] ?? 0),
innodbBufferPoolReadRequests: (int)($innoDbStatus['Innodb_buffer_pool_read_requests'] ?? 0),
innodbBufferPoolReads: (int)($innoDbStatus['Innodb_buffer_pool_reads'] ?? 0),
innodbBufferPoolWaitFree: (int)($innoDbStatus['Innodb_buffer_pool_wait_free'] ?? 0),
innodbPageSize: (int)($innoDbStatus['Innodb_page_size'] ?? 0),
);
}
}
54 changes: 54 additions & 0 deletions Classes/Domain/Model/Handler.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
<?php

declare(strict_types=1);

/*
* This file is part of the package stefanfroemken/mysql-widget.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/

namespace StefanFroemken\MySqlWidget\Domain\Model;

readonly class Handler
{
public function __construct(
private int $handlerReadRndNext,
private int $handlerReadRnd,
private int $handlerReadFirst,
private int $handlerReadNext,
private int $handlerReadKey,
private int $handlerReadPrev,
) {}

public function getHandlerReadRndNext(): int
{
return $this->handlerReadRndNext;
}

public function getHandlerReadRnd(): int
{
return $this->handlerReadRnd;
}

public function getHandlerReadFirst(): int
{
return $this->handlerReadFirst;
}

public function getHandlerReadNext(): int
{
return $this->handlerReadNext;
}

public function getHandlerReadKey(): int
{
return $this->handlerReadKey;
}

public function getHandlerReadPrev(): int
{
return $this->handlerReadPrev;
}
}
Loading