Skip to content

Commit 895b6dc

Browse files
committed
[TODO] Alternate for PHP exec()
1 parent 1ca8e1f commit 895b6dc

File tree

1 file changed

+17
-2
lines changed

1 file changed

+17
-2
lines changed

Classes/Controller/nsextcompatibilityController.php

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -415,8 +415,23 @@ public function getSysDetail()
415415
**/
416416
public function getSysRequirementForTargetVersion($targetVersion)
417417
{
418-
exec('convert -version', $imgmagic);
419-
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', shell_exec('mysql -V'), $mysqlVersion);
418+
try {
419+
exec('convert -version', $imgmagic);
420+
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', shell_exec('mysql -V'), $mysqlVersion);
421+
} catch (\Exception $e) {
422+
if (version_compare(TYPO3_branch, '6.2', '<')) {
423+
$erorrMessage = GeneralUtility::makeInstance(
424+
'TYPO3\\CMS\\Core\\Messaging\\FlashMessage',
425+
$e->getMessage(),
426+
'Exception: ' . $e->getCode(), // the header is optional
427+
\TYPO3\CMS\Core\Messaging\FlashMessage::ERROR
428+
);
429+
430+
\TYPO3\CMS\Core\Messaging\FlashMessageQueue::addMessage($erorrMessage);
431+
} else {
432+
$this->addFlashMessage($e->getMessage(), 'Exception: ' . $e->getCode(), \TYPO3\CMS\Core\Messaging\AbstractMessage::ERROR);
433+
}
434+
}
420435

421436
$typo3Config = [
422437
'4.x' => [

0 commit comments

Comments
 (0)