first commit
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Server\Status\Monitor;
|
||||
|
||||
use PhpMyAdmin\Controllers\Server\Status\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Monitor;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
final class ChartingDataController extends AbstractController
|
||||
{
|
||||
/** @var Monitor */
|
||||
private $monitor;
|
||||
|
||||
/** @var DatabaseInterface */
|
||||
private $dbi;
|
||||
|
||||
public function __construct(
|
||||
ResponseRenderer $response,
|
||||
Template $template,
|
||||
Data $data,
|
||||
Monitor $monitor,
|
||||
DatabaseInterface $dbi
|
||||
) {
|
||||
parent::__construct($response, $template, $data);
|
||||
$this->monitor = $monitor;
|
||||
$this->dbi = $dbi;
|
||||
}
|
||||
|
||||
public function __invoke(): void
|
||||
{
|
||||
global $errorUrl;
|
||||
|
||||
$params = ['requiredData' => $_POST['requiredData'] ?? null];
|
||||
$errorUrl = Url::getFromRoute('/');
|
||||
|
||||
if ($this->dbi->isSuperUser()) {
|
||||
$this->dbi->selectDb('mysql');
|
||||
}
|
||||
|
||||
if (! $this->response->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response->addJSON([
|
||||
'message' => $this->monitor->getJsonForChartingData(
|
||||
$params['requiredData'] ?? ''
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Server\Status\Monitor;
|
||||
|
||||
use PhpMyAdmin\Controllers\Server\Status\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Monitor;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
final class GeneralLogController extends AbstractController
|
||||
{
|
||||
/** @var Monitor */
|
||||
private $monitor;
|
||||
|
||||
/** @var DatabaseInterface */
|
||||
private $dbi;
|
||||
|
||||
public function __construct(
|
||||
ResponseRenderer $response,
|
||||
Template $template,
|
||||
Data $data,
|
||||
Monitor $monitor,
|
||||
DatabaseInterface $dbi
|
||||
) {
|
||||
parent::__construct($response, $template, $data);
|
||||
$this->monitor = $monitor;
|
||||
$this->dbi = $dbi;
|
||||
}
|
||||
|
||||
public function __invoke(): void
|
||||
{
|
||||
global $errorUrl;
|
||||
|
||||
$params = [
|
||||
'time_start' => $_POST['time_start'] ?? null,
|
||||
'time_end' => $_POST['time_end'] ?? null,
|
||||
'limitTypes' => $_POST['limitTypes'] ?? null,
|
||||
'removeVariables' => $_POST['removeVariables'] ?? null,
|
||||
];
|
||||
$errorUrl = Url::getFromRoute('/');
|
||||
|
||||
if ($this->dbi->isSuperUser()) {
|
||||
$this->dbi->selectDb('mysql');
|
||||
}
|
||||
|
||||
if (! $this->response->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->monitor->getJsonForLogDataTypeGeneral(
|
||||
(int) $params['time_start'],
|
||||
(int) $params['time_end'],
|
||||
(bool) $params['limitTypes'],
|
||||
(bool) $params['removeVariables']
|
||||
);
|
||||
|
||||
if ($data === null) {
|
||||
$this->response->setRequestStatus(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response->addJSON(['message' => $data]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Server\Status\Monitor;
|
||||
|
||||
use PhpMyAdmin\Controllers\Server\Status\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Monitor;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
final class LogVarsController extends AbstractController
|
||||
{
|
||||
/** @var Monitor */
|
||||
private $monitor;
|
||||
|
||||
/** @var DatabaseInterface */
|
||||
private $dbi;
|
||||
|
||||
public function __construct(
|
||||
ResponseRenderer $response,
|
||||
Template $template,
|
||||
Data $data,
|
||||
Monitor $monitor,
|
||||
DatabaseInterface $dbi
|
||||
) {
|
||||
parent::__construct($response, $template, $data);
|
||||
$this->monitor = $monitor;
|
||||
$this->dbi = $dbi;
|
||||
}
|
||||
|
||||
public function __invoke(): void
|
||||
{
|
||||
global $errorUrl;
|
||||
|
||||
$params = [
|
||||
'varName' => $_POST['varName'] ?? null,
|
||||
'varValue' => $_POST['varValue'] ?? null,
|
||||
];
|
||||
$errorUrl = Url::getFromRoute('/');
|
||||
|
||||
if ($this->dbi->isSuperUser()) {
|
||||
$this->dbi->selectDb('mysql');
|
||||
}
|
||||
|
||||
if (! $this->response->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response->addJSON([
|
||||
'message' => $this->monitor->getJsonForLoggingVars(
|
||||
$params['varName'],
|
||||
$params['varValue']
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Server\Status\Monitor;
|
||||
|
||||
use PhpMyAdmin\Controllers\Server\Status\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Monitor;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
final class QueryAnalyzerController extends AbstractController
|
||||
{
|
||||
/** @var Monitor */
|
||||
private $monitor;
|
||||
|
||||
/** @var DatabaseInterface */
|
||||
private $dbi;
|
||||
|
||||
public function __construct(
|
||||
ResponseRenderer $response,
|
||||
Template $template,
|
||||
Data $data,
|
||||
Monitor $monitor,
|
||||
DatabaseInterface $dbi
|
||||
) {
|
||||
parent::__construct($response, $template, $data);
|
||||
$this->monitor = $monitor;
|
||||
$this->dbi = $dbi;
|
||||
}
|
||||
|
||||
public function __invoke(): void
|
||||
{
|
||||
global $errorUrl;
|
||||
|
||||
$params = [
|
||||
'database' => $_POST['database'] ?? null,
|
||||
'query' => $_POST['query'] ?? null,
|
||||
];
|
||||
$errorUrl = Url::getFromRoute('/');
|
||||
|
||||
if ($this->dbi->isSuperUser()) {
|
||||
$this->dbi->selectDb('mysql');
|
||||
}
|
||||
|
||||
if (! $this->response->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response->addJSON([
|
||||
'message' => $this->monitor->getJsonForQueryAnalyzer(
|
||||
$params['database'] ?? '',
|
||||
$params['query'] ?? ''
|
||||
),
|
||||
]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace PhpMyAdmin\Controllers\Server\Status\Monitor;
|
||||
|
||||
use PhpMyAdmin\Controllers\Server\Status\AbstractController;
|
||||
use PhpMyAdmin\DatabaseInterface;
|
||||
use PhpMyAdmin\ResponseRenderer;
|
||||
use PhpMyAdmin\Server\Status\Data;
|
||||
use PhpMyAdmin\Server\Status\Monitor;
|
||||
use PhpMyAdmin\Template;
|
||||
use PhpMyAdmin\Url;
|
||||
|
||||
final class SlowLogController extends AbstractController
|
||||
{
|
||||
/** @var Monitor */
|
||||
private $monitor;
|
||||
|
||||
/** @var DatabaseInterface */
|
||||
private $dbi;
|
||||
|
||||
public function __construct(
|
||||
ResponseRenderer $response,
|
||||
Template $template,
|
||||
Data $data,
|
||||
Monitor $monitor,
|
||||
DatabaseInterface $dbi
|
||||
) {
|
||||
parent::__construct($response, $template, $data);
|
||||
$this->monitor = $monitor;
|
||||
$this->dbi = $dbi;
|
||||
}
|
||||
|
||||
public function __invoke(): void
|
||||
{
|
||||
global $errorUrl;
|
||||
|
||||
$params = [
|
||||
'time_start' => $_POST['time_start'] ?? null,
|
||||
'time_end' => $_POST['time_end'] ?? null,
|
||||
];
|
||||
$errorUrl = Url::getFromRoute('/');
|
||||
|
||||
if ($this->dbi->isSuperUser()) {
|
||||
$this->dbi->selectDb('mysql');
|
||||
}
|
||||
|
||||
if (! $this->response->isAjax()) {
|
||||
return;
|
||||
}
|
||||
|
||||
$data = $this->monitor->getJsonForLogDataTypeSlow(
|
||||
(int) $params['time_start'],
|
||||
(int) $params['time_end']
|
||||
);
|
||||
|
||||
if ($data === null) {
|
||||
$this->response->setRequestStatus(false);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
$this->response->addJSON(['message' => $data]);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user