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'] ?? '' ), ]); } }