[TASK] Doctrine: Migrate MailUtility 66/49266/2
authorWouter Wolters <typo3@wouterwolters.nl>
Fri, 29 Jul 2016 12:43:11 +0000 (14:43 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 2 Aug 2016 11:38:57 +0000 (13:38 +0200)
Resolves: #77307
Releases: master
Change-Id: I65492ac5d6b1ebed4f52196f1b709ee8d0ca0507
Reviewed-on: https://review.typo3.org/49266
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/Utility/MailUtility.php

index fd5d65f..d320b09 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Core\Utility;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Database\ConnectionPool;
+use TYPO3\CMS\Core\Database\Query\Restriction\HiddenRestriction;
+
 /**
  * Class to handle mail specific functionality
  */
@@ -75,7 +78,21 @@ class MailUtility
         if (!GeneralUtility::validEmail($address)) {
             // just get us a domain record we can use as the host
             $host = '';
-            $domainRecord = $GLOBALS['TYPO3_DB']->exec_SELECTgetSingleRow('domainName', 'sys_domain', 'hidden = 0', '', 'pid ASC, sorting ASC');
+            $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)
+                ->getQueryBuilderForTable('sys_domain');
+
+            $queryBuilder->getRestrictions()
+                ->removeAll()
+                ->add(GeneralUtility::makeInstance(HiddenRestriction::class));
+
+            $domainRecord = $queryBuilder
+                ->select('domainName')
+                ->from('sys_domain')
+                ->orderBy('pid', 'ASC')
+                ->orderBy('sorting', 'ASC')
+                ->execute()
+                ->fetch();
+
             if (!empty($domainRecord['domainName'])) {
                 $tempUrl = $domainRecord['domainName'];
                 if (!GeneralUtility::isFirstPartOfStr($tempUrl, 'http')) {