ImgURL Pro容器部署
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

63 lines
1.6 KiB

2 years ago
<?php
declare(strict_types=1);
namespace PhpMyAdmin\Controllers\Table\Structure;
use PhpMyAdmin\Controllers\Table\AbstractController;
use PhpMyAdmin\Controllers\Table\StructureController;
use PhpMyAdmin\Database\CentralColumns;
use PhpMyAdmin\Message;
use PhpMyAdmin\ResponseRenderer;
use PhpMyAdmin\Template;
use function __;
final class CentralColumnsAddController extends AbstractController
{
/** @var CentralColumns */
private $centralColumns;
/** @var StructureController */
private $structureController;
public function __construct(
ResponseRenderer $response,
Template $template,
string $db,
string $table,
CentralColumns $centralColumns,
StructureController $structureController
) {
parent::__construct($response, $template, $db, $table);
$this->centralColumns = $centralColumns;
$this->structureController = $structureController;
}
public function __invoke(): void
{
global $message;
$selected = $_POST['selected_fld'] ?? [];
if (empty($selected)) {
$this->response->setRequestStatus(false);
$this->response->addJSON('message', __('No column selected.'));
return;
}
$centralColsError = $this->centralColumns->syncUniqueColumns($selected, false);
if ($centralColsError instanceof Message) {
$message = $centralColsError;
}
if (empty($message)) {
$message = Message::success();
}
($this->structureController)();
}
}