dbi = $dbi; $this->relation = $relation; $this->relationCleanup = $relationCleanup; $this->operations = $operations; $this->flash = $flash; $this->structureController = $structureController; } public function __invoke(ServerRequest $request): void { $multBtn = $_POST['mult_btn'] ?? ''; $selected = $_POST['selected'] ?? []; if ($multBtn !== __('Yes')) { $this->flash->addMessage('success', __('No change')); $this->redirect('/database/structure', ['db' => $GLOBALS['db']]); return; } $defaultFkCheckValue = ForeignKey::handleDisableCheckInit(); $GLOBALS['sql_query'] = ''; $selectedCount = count($selected); for ($i = 0; $i < $selectedCount; $i++) { $aQuery = 'TRUNCATE '; $aQuery .= Util::backquote($selected[$i]); $GLOBALS['sql_query'] .= $aQuery . ';' . "\n"; $this->dbi->selectDb($GLOBALS['db']); $this->dbi->query($aQuery); } if (! empty($_REQUEST['pos'])) { $sql = new Sql( $this->dbi, $this->relation, $this->relationCleanup, $this->operations, new Transformations(), $this->template ); $_REQUEST['pos'] = $sql->calculatePosForLastPage($GLOBALS['db'], $GLOBALS['table'], $_REQUEST['pos']); } ForeignKey::handleDisableCheckCleanup($defaultFkCheckValue); $GLOBALS['message'] = Message::success(); unset($_POST['mult_btn']); ($this->structureController)($request); } }