export = $export; $this->response = $response; } public function __invoke(ServerRequest $request): void { $db = DatabaseName::tryFromValue($request->getParsedBodyParam('db')); /** @var mixed $exportType */ $exportType = $request->getParsedBodyParam('export_type'); if ($db === null || ! is_string($exportType) || $exportType === '') { $errorMessage = __('Missing parameter:') . ($db === null ? ' db' : ' export_type') . MySQLDocumentation::showDocumentation('faq', 'faqmissingparameters', true) . '[br]'; $this->response->setRequestStatus(false); $this->response->addHTML(Message::error($errorMessage)->getDisplay()); return; } /** * Include the appropriate Schema Class depending on $exportType, default is PDF. */ try { $exportInfo = $this->export->getExportSchemaInfo($db, $exportType); } catch (ExportException $exception) { $this->response->setRequestStatus(false); $this->response->addHTML(Message::error($exception->getMessage())->getDisplay()); return; } $this->response->disable(); Core::downloadHeader( $exportInfo['fileName'], $exportInfo['mediaType'], mb_strlen($exportInfo['fileData'], '8bit') ); echo $exportInfo['fileData']; } }