PHP 7.4.33
Preview: CheckRelationsController.php Size: 2.25 KB
/usr/share/phpmyadmin/libraries/classes/Controllers/CheckRelationsController.php
<?php

declare(strict_types=1);

namespace PhpMyAdmin\Controllers;

use PhpMyAdmin\ConfigStorage\Relation;
use PhpMyAdmin\Http\ServerRequest;
use PhpMyAdmin\ResponseRenderer;
use PhpMyAdmin\Template;

use const SQL_DIR;

/**
 * Displays status of phpMyAdmin configuration storage
 */
class CheckRelationsController extends AbstractController
{
    /** @var Relation */
    private $relation;

    public function __construct(ResponseRenderer $response, Template $template, Relation $relation)
    {
        parent::__construct($response, $template);
        $this->relation = $relation;
    }

    public function __invoke(ServerRequest $request): void
    {
        global $db, $cfg;

        /** @var string|null $createPmaDb */
        $createPmaDb = $request->getParsedBodyParam('create_pmadb');
        /** @var string|null $fixAllPmaDb */
        $fixAllPmaDb = $request->getParsedBodyParam('fixall_pmadb');
        /** @var string|null $fixPmaDb */
        $fixPmaDb = $request->getParsedBodyParam('fix_pmadb');

        $cfgStorageDbName = $this->relation->getConfigurationStorageDbName();

        // If request for creating the pmadb
        if (isset($createPmaDb) && $this->relation->createPmaDatabase($cfgStorageDbName)) {
            $this->relation->fixPmaTables($cfgStorageDbName);
        }

        // If request for creating all PMA tables.
        if (isset($fixAllPmaDb)) {
            $this->relation->fixPmaTables($db);
        }

        // If request for creating missing PMA tables.
        if (isset($fixPmaDb)) {
            $relationParameters = $this->relation->getRelationParameters();
            $this->relation->fixPmaTables((string) $relationParameters->db);
        }

        // Do not use any previous $relationParameters value as it could have changed after a successful fixPmaTables()
        $relationParameters = $this->relation->getRelationParameters();

        $this->render('relation/check_relations', [
            'db' => $db,
            'zero_conf' => $cfg['ZeroConf'],
            'relation_parameters' => $relationParameters->toArray(),
            'sql_dir' => SQL_DIR,
            'config_storage_database_name' => $cfgStorageDbName,
            'are_config_storage_tables_defined' => $this->relation->arePmadbTablesDefined(),
        ]);
    }
}

Directory Contents

Dirs: 11 × Files: 25
Name Size Perms Modified Actions
Config DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
Database DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
Export DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
Import DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
Server DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
Setup DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
Sql DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
Table DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
View DIR
- drwxr-xr-x 2023-02-07 16:26:36
Edit Download
2.53 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
2.41 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
3.44 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
2.25 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
809 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
1.04 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
275 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
6.05 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
5.09 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
1.19 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
17.05 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
36.16 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
940 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
1.73 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
421 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
3.20 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
5.54 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
685 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
426 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
667 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
820 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
772 B lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
1.23 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
3.30 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
1.20 KB lrwxr-xr-x 2023-02-07 16:26:36
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).