phpmyadmin/libraries/classes/Controllers/CheckRelationsController.php
Maurício Meneghini Fauth f5c970639c Move response handling from routes to controllers
Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-02-12 14:59:42 -03:00

57 lines
1.6 KiB
PHP

<?php
/**
* Displays status of phpMyAdmin configuration storage
*/
declare(strict_types=1);
namespace PhpMyAdmin\Controllers;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Relation;
use PhpMyAdmin\Response;
use PhpMyAdmin\Template;
class CheckRelationsController extends AbstractController
{
/** @var Relation */
private $relation;
/**
* @param Response $response Response object
* @param DatabaseInterface $dbi DatabaseInterface object
* @param Template $template Template that should be used
* @param Relation $relation Relation object
*/
public function __construct($response, $dbi, Template $template, Relation $relation)
{
parent::__construct($response, $dbi, $template);
$this->relation = $relation;
}
/**
* @param array $params Request parameters
*/
public function index(array $params): void
{
global $db;
// If request for creating the pmadb
if (isset($params['create_pmadb']) && $this->relation->createPmaDatabase()) {
$this->relation->fixPmaTables('phpmyadmin');
}
// If request for creating all PMA tables.
if (isset($params['fixall_pmadb'])) {
$this->relation->fixPmaTables($db);
}
$cfgRelation = $this->relation->getRelationsParam();
// If request for creating missing PMA tables.
if (isset($params['fix_pmadb'])) {
$this->relation->fixPmaTables($cfgRelation['db']);
}
$this->response->addHTML($this->relation->getRelationsParamDiagnostic($cfgRelation));
}
}