2 declare(strict_types = 1);
18 use Psr\Http\Message\ResponseInterface;
19 use Psr\Http\Message\ServerRequestInterface;
53 public function cardsAction(ServerRequestInterface $request): ResponseInterface
58 'html' => $view->render(),
71 $view->assignMultiple([
72 'systemInformationCgiDetected' => GeneralUtility::isRunningOnCgiServerApi(),
78 'html' => $view->render(),
93 'html' => $view->render(),
107 $checkMessages = (
new Check())->getStatus();
108 foreach ($checkMessages as $message) {
109 $messageQueue->enqueue($message);
112 foreach ($setupMessages as $message) {
113 $messageQueue->enqueue($message);
116 foreach ($databaseMessages as $message) {
117 $messageQueue->enqueue($message);
120 foreach ($serverResponseMessages as $message) {
121 $messageQueue->enqueue($message);
132 'html' => $view->render(),
145 $folderStructureFactory = GeneralUtility::makeInstance(DefaultFactory::class);
146 $structureFacade = $folderStructureFactory->getStructure();
148 $structureMessages = $structureFacade->getStatus();
151 foreach ($structureMessages as $message) {
155 $errorQueue->enqueue($message);
157 $okQueue->enqueue($message);
161 $permissionCheck = GeneralUtility::makeInstance(DefaultPermissionsCheck::class);
167 'errorStatus' => $errorQueue,
168 'okStatus' => $okQueue,
169 'folderStructureFilePermissionStatus' => $permissionCheck->getMaskStatus(
'fileCreateMask'),
170 'folderStructureDirectoryPermissionStatus' => $permissionCheck->getMaskStatus(
'folderCreateMask'),
171 'html' => $view->render(),
182 $folderStructureFactory = GeneralUtility::makeInstance(DefaultFactory::class);
183 $structureFacade = $folderStructureFactory->getStructure();
184 $fixedStatusObjects = $structureFacade->fix();
187 'fixedStatus' => $fixedStatusObjects,
201 $view->assignMultiple([
202 'mailTestToken' => $formProtection->generateToken(
'installTool',
'mailTest'),
203 'mailTestSenderAddress' => $this->getSenderEmailAddress(),
207 'html' => $view->render(),
220 $recipient = $request->getParsedBody()[
'install'][
'email'];
222 if (empty($recipient) || !GeneralUtility::validEmail($recipient)) {
224 'Given address is not a valid email address.',
230 $mailMessage = GeneralUtility::makeInstance(MailMessage::class);
235 ->setBody(
'<html><body>html test content</body></html>',
'text/html')
236 ->addPart(
'plain test content',
'text/plain')
239 'Recipient: ' . $recipient,
243 }
catch (\Swift_RfcComplianceException $exception) {
245 'Please verify $GLOBALS[\'TYPO3_CONF_VARS\'][\'MAIL\'][\'defaultMailFromAddress\'] is a valid mail address.'
246 .
' Error message: ' . $exception->getMessage(),
247 'RFC compliance problem',
250 }
catch (\Throwable $throwable) {
252 'Please verify $GLOBALS[\'TYPO3_CONF_VARS\'][\'MAIL\'][*] settings are valid.'
253 .
' Error message: ' . $throwable->getMessage(),
254 'Could not deliver mail',
260 'success' => $delivered,
261 'status' => $messages,
274 $view->assignMultiple([
275 'imageProcessingProcessor' =>
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'processor'] ===
'GraphicsMagick' ?
'GraphicsMagick' :
'ImageMagick',
276 'imageProcessingEnabled' =>
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'processor_enabled'],
277 'imageProcessingPath' =>
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'processor_path'],
279 'imageProcessingEffects' =>
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'processor_effects'],
280 'imageProcessingGdlibEnabled' =>
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib'],
281 'imageProcessingGdlibPng' =>
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gdlib_png'],
282 'imageProcessingFileFormats' =>
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'],
286 'html' => $view->render(),
297 $image = @imagecreate(200, 50);
298 imagecolorallocate($image, 255, 255, 55);
299 $textColor = imagecolorallocate($image, 233, 14, 91);
311 imagegif($image, $outputFile);
312 $fileExists = file_exists($outputFile);
314 GeneralUtility::fixPermissions($outputFile);
317 'fileExists' => $fileExists,
318 'outputFile' => $outputFile,
396 $inputFile = $imageBasePath .
'TestInput/Test.gif';
399 $imResult = $imageProcessor->imageMagickConvert($inputFile,
'gif',
'300',
'',
'',
'', [],
true);
401 if ($imResult !==
null && is_file($imResult[3])) {
402 if (
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'gif_compress']) {
404 $previousSize = GeneralUtility::formatSize(filesize($imResult[3]));
407 $compressedSize = GeneralUtility::formatSize(filesize($imResult[3]));
409 'Method used by compress: ' . $methodUsed . LF
410 .
' Previous filesize: ' . $previousSize .
'. Current filesize:' . $compressedSize,
417 'Gif compression not enabled by [GFX][gif_compress]',
422 'status' => $messages,
423 'fileExists' =>
true,
424 'outputFile' => $imResult[3],
426 'command' => $imageProcessor->IM_commands,
431 'command' => $imageProcessor->IM_commands,
450 $inputFile = $imageBasePath .
'TestInput/Test.png';
453 $imResult = $imageProcessor->imageMagickConvert($inputFile,
'png',
'300',
'',
'',
'', [],
true);
454 if ($imResult !==
null && is_file($imResult[3])) {
456 'fileExists' =>
true,
457 'outputFile' => $imResult[3],
459 'command' => $imageProcessor->IM_commands,
464 'command' => $imageProcessor->IM_commands,
484 $inputFile = $imageBasePath .
'TestInput/Transparent.gif';
486 $imResult = $imageProcessor->imageMagickConvert($inputFile,
'gif',
'300',
'',
'',
'', [],
true);
487 if ($imResult !==
null && file_exists($imResult[3])) {
489 'fileExists' =>
true,
490 'outputFile' => $imResult[3],
492 'command' => $imageProcessor->IM_commands,
497 'command' => $imageProcessor->IM_commands,
517 $inputFile = $imageBasePath .
'TestInput/Transparent.png';
519 $imResult = $imageProcessor->imageMagickConvert($inputFile,
'png',
'300',
'',
'',
'', [],
true);
520 if ($imResult !==
null && file_exists($imResult[3])) {
522 'fileExists' =>
true,
523 'outputFile' => $imResult[3],
525 'command' => $imageProcessor->IM_commands,
530 'command' => $imageProcessor->IM_commands,
550 $inputFile = $imageBasePath .
'TestInput/Transparent.gif';
553 $imResult = $imageProcessor->imageMagickConvert($inputFile,
'jpg',
'300',
'',
'-quality ' . $jpegQuality .
' -opaque white -background white -flatten',
'', [],
true);
554 if ($imResult !==
null && file_exists($imResult[3])) {
556 'fileExists' =>
true,
557 'outputFile' => $imResult[3],
559 'command' => $imageProcessor->IM_commands,
564 'command' => $imageProcessor->IM_commands,
584 $inputFile = $imageBasePath .
'TestInput/BackgroundOrange.gif';
585 $overlayFile = $imageBasePath .
'TestInput/Test.jpg';
586 $maskFile = $imageBasePath .
'TestInput/MaskBlackWhite.gif';
587 $resultFile = $this->
getImagesPath() . $imageProcessor->filenamePrefix
589 $imageProcessor->combineExec($inputFile, $overlayFile, $maskFile, $resultFile);
590 $imResult = $imageProcessor->getImageDimensions($resultFile);
593 'fileExists' =>
true,
594 'outputFile' => $imResult[3],
596 'command' => $imageProcessor->IM_commands,
601 'command' => $imageProcessor->IM_commands,
621 $inputFile = $imageBasePath .
'TestInput/BackgroundCombine.jpg';
622 $overlayFile = $imageBasePath .
'TestInput/Test.jpg';
623 $maskFile = $imageBasePath .
'TestInput/MaskCombine.jpg';
624 $resultFile = $this->
getImagesPath() . $imageProcessor->filenamePrefix
626 $imageProcessor->combineExec($inputFile, $overlayFile, $maskFile, $resultFile);
627 $imResult = $imageProcessor->getImageDimensions($resultFile);
630 'fileExists' =>
true,
631 'outputFile' => $imResult[3],
633 'command' => $imageProcessor->IM_commands,
638 'command' => $imageProcessor->IM_commands,
652 $gifOrPng = $imageProcessor->gifExtension;
653 $image = imagecreatetruecolor(300, 225);
654 $backgroundColor = imagecolorallocate($image, 0, 0, 0);
655 imagefilledrectangle($image, 0, 0, 300, 225, $backgroundColor);
656 $workArea = [0, 0, 300, 225];
658 'dimensions' =>
'10,50,280,50',
661 $imageProcessor->makeBox($image, $conf, $workArea);
663 $imageProcessor->ImageWrite($image, $outputFile);
664 $imResult = $imageProcessor->getImageDimensions($outputFile);
666 'fileExists' =>
true,
667 'outputFile' => $imResult[3],
669 'command' => $imageProcessor->IM_commands,
682 $gifOrPng = $imageProcessor->gifExtension;
684 $inputFile = $imageBasePath .
'TestInput/Test.' . $gifOrPng;
685 $image = $imageProcessor->imageCreateFromFile($inputFile);
686 $workArea = [0, 0, 400, 300];
688 'dimensions' =>
'10,50,380,50',
691 $imageProcessor->makeBox($image, $conf, $workArea);
693 $imageProcessor->ImageWrite($image, $outputFile);
694 $imResult = $imageProcessor->getImageDimensions($outputFile);
696 'fileExists' =>
true,
697 'outputFile' => $imResult[3],
699 'command' => $imageProcessor->IM_commands,
712 $gifOrPng = $imageProcessor->gifExtension;
713 $image = imagecreatetruecolor(300, 225);
714 $backgroundColor = imagecolorallocate($image, 128, 128, 150);
715 imagefilledrectangle($image, 0, 0, 300, 225, $backgroundColor);
716 $workArea = [0, 0, 300, 225];
721 'text' =>
'HELLO WORLD',
722 'fontColor' =>
'#003366',
727 $conf[
'BBOX'] = $imageProcessor->calcBBox($conf);
728 $imageProcessor->makeText($image, $conf, $workArea);
730 $imageProcessor->ImageWrite($image, $outputFile);
731 $imResult = $imageProcessor->getImageDimensions($outputFile);
733 'fileExists' =>
true,
734 'outputFile' => $imResult[3],
736 'command' => $imageProcessor->IM_commands,
754 $gifOrPng = $imageProcessor->gifExtension;
755 $image = imagecreatetruecolor(300, 225);
756 $backgroundColor = imagecolorallocate($image, 128, 128, 150);
757 imagefilledrectangle($image, 0, 0, 300, 225, $backgroundColor);
758 $workArea = [0, 0, 300, 225];
763 'text' =>
'HELLO WORLD',
764 'fontColor' =>
'#003366',
769 $conf[
'BBOX'] = $imageProcessor->calcBBox($conf);
770 $imageProcessor->makeText($image, $conf, $workArea);
772 $imageProcessor->ImageWrite($image, $outputFile);
773 $conf[
'offset'] =
'30,120';
774 $conf[
'niceText'] = 1;
775 $imageProcessor->makeText($image, $conf, $workArea);
777 $imageProcessor->ImageWrite($image, $outputFile);
778 $imResult = $imageProcessor->getImageDimensions($outputFile);
780 'fileExists' =>
true,
781 'outputFile' => $imResult[3],
783 'command' => $imageProcessor->IM_commands,
801 $gifOrPng = $imageProcessor->gifExtension;
802 $image = imagecreatetruecolor(300, 225);
803 $backgroundColor = imagecolorallocate($image, 128, 128, 150);
804 imagefilledrectangle($image, 0, 0, 300, 225, $backgroundColor);
805 $workArea = [0, 0, 300, 225];
810 'text' =>
'HELLO WORLD',
811 'fontColor' =>
'#003366',
816 $conf[
'BBOX'] = $imageProcessor->calcBBox($conf);
817 $imageProcessor->makeText($image, $conf, $workArea);
819 $imageProcessor->ImageWrite($image, $outputFile);
820 $conf[
'offset'] =
'30,120';
821 $conf[
'niceText'] = 1;
822 $imageProcessor->makeText($image, $conf, $workArea);
824 $imageProcessor->ImageWrite($image, $outputFile);
825 $conf[
'offset'] =
'30,160';
826 $conf[
'niceText'] = 1;
834 $imageProcessor->makeShadow($image, $conf[
'shadow.'], $workArea, $conf);
835 $imageProcessor->makeText($image, $conf, $workArea);
837 $imageProcessor->ImageWrite($image, $outputFile);
838 $imResult = $imageProcessor->getImageDimensions($outputFile);
840 'fileExists' =>
true,
841 'outputFile' => $imResult[3],
843 'command' => $imageProcessor->IM_commands,
855 $imageProcessor = GeneralUtility::makeInstance(GraphicalFunctions::class);
856 $imageProcessor->dontCheckForExistingTempFile =
true;
857 $imageProcessor->filenamePrefix =
'installTool-';
858 $imageProcessor->dontCompress =
true;
859 $imageProcessor->alternativeOutputKey =
'typo3InstallTest';
860 return $imageProcessor;
872 $string = $result[0];
874 if (!empty($string)) {
875 list(, $version) = explode(
'Magick', $string);
876 list($version) = explode(
' ', trim($version));
877 $version = trim($version);
895 if (!GeneralUtility::inList(
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'imagefile_ext'], $inputFormat)) {
899 'Handling format ' . $inputFormat .
' must be enabled in TYPO3_CONF_VARS[\'GFX\'][\'imagefile_ext\']',
908 $inputFile = $imageBasePath .
'TestInput/Test.' . $inputFormat;
910 $imResult = $imageProcessor->imageMagickConvert($inputFile,
'jpg',
'300',
'',
'',
'', [],
true);
912 if ($imResult !==
null) {
914 'fileExists' => file_exists($imResult[3]),
915 'outputFile' => $imResult[3],
917 'command' => $imageProcessor->IM_commands,
922 'command' => $imageProcessor->IM_commands,
935 $connectionInfos = [];
936 $connectionPool = GeneralUtility::makeInstance(ConnectionPool::class);
937 foreach ($connectionPool->getConnectionNames() as $connectionName) {
938 $connection = $connectionPool->getConnectionByName($connectionName);
939 $connectionParameters = $connection->getParams();
941 'connectionName' => $connectionName,
942 'version' => $connection->getServerVersion(),
943 'databaseName' => $connection->getDatabase(),
944 'username' => $connectionParameters[
'user'],
945 'host' => $connectionParameters[
'host'],
946 'port' => $connectionParameters[
'port'],
947 'socket' => $connectionParameters[
'unix_socket'] ??
'',
948 'numberOfTables' => count($connection->getSchemaManager()->listTableNames()),
949 'numberOfMappedTables' => 0,
951 if (isset(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'TableMapping'])
952 && is_array(
$GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'TableMapping'])
955 $connectionInfo[
'numberOfMappedTables'] = count(array_intersect(
956 $GLOBALS[
'TYPO3_CONF_VARS'][
'DB'][
'TableMapping'],
960 $connectionInfos[] = $connectionInfo;
962 return $connectionInfos;
974 return !empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress'])
975 ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromAddress']
976 :
'no-reply@example.com';
988 return !empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName'])
989 ?
$GLOBALS[
'TYPO3_CONF_VARS'][
'MAIL'][
'defaultMailFromName']
990 :
'TYPO3 CMS install tool';
1002 $name = !empty(
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'])
1003 ?
' from site "' .
$GLOBALS[
'TYPO3_CONF_VARS'][
'SYS'][
'sitename'] .
'"'
1005 return 'Test TYPO3 CMS mail delivery' . $name;
1019 foreach ($testResult as $resultKey => $value) {
1020 if ($resultKey ===
'referenceFile') {
1021 $fileExt = end(explode(
'.', $testResult[
'referenceFile']));
1022 $responseData[
'referenceFile'] =
'data:image/' . $fileExt .
';base64,' . base64_encode(file_get_contents($testResult[
'referenceFile']));
1023 } elseif ($resultKey ===
'outputFile') {
1024 $fileExt = end(explode(
'.', $testResult[
'outputFile']));
1025 $responseData[
'outputFile'] =
'data:image/' . $fileExt .
';base64,' . base64_encode(file_get_contents($testResult[
'outputFile']));
1027 $responseData[$resultKey] = $value;
1041 'ImageMagick / GraphicsMagick handling is enabled, but the execute'
1042 .
' command returned an error. Please check your settings, especially'
1043 .
' [\'GFX\'][\'processor_path\'] and [\'GFX\'][\'processor_path_lzw\'] and ensure Ghostscript is installed on your server.',
1044 'Image generation failed',
1056 $enabled =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'processor_enabled'];
1057 $path =
$GLOBALS[
'TYPO3_CONF_VARS'][
'GFX'][
'processor_path'];
1058 return $enabled && $path;
1069 'ImageMagick / GraphicsMagick handling is disabled or not configured correctly.',
1070 'Tests not executed',
1084 if (!is_dir($imagePath)) {
1085 GeneralUtility::mkdir_deep($imagePath);