diff --git a/Classes/DirectMailUtility.php b/Classes/DirectMailUtility.php index 427aaba10..554bb0a0f 100644 --- a/Classes/DirectMailUtility.php +++ b/Classes/DirectMailUtility.php @@ -274,6 +274,12 @@ protected static function addUserPass(string $url, array $params): string public static function getFullUrlsForDirectMailRecord(array $row): array { // Finding the domain to use + if (!$_SERVER['HTTP_HOST']) { + // In CLI / Scheduler context, $_SERVER['HTTP_HOST'] can be null + $siteFinder = GeneralUtility::makeInstance(SiteFinder::class); + $site = $siteFinder->getSiteByPageId((int)$row['page']); + $_SERVER['HTTP_HOST'] = $site->getBase()->getHost(); + } $result = [ 'baseUrl' => self::getTypolinkURL((int)$row['page']), 'htmlUrl' => '', diff --git a/Classes/Module/StatisticsController.php b/Classes/Module/StatisticsController.php index dd19d2251..e1ea291f2 100644 --- a/Classes/Module/StatisticsController.php +++ b/Classes/Module/StatisticsController.php @@ -643,7 +643,7 @@ protected function stats($row) ($html ? $id : '-'), ($html ? '-' : $id), ($html ? $urlCounter['html'][$id]['counter'] : $urlCounter['plain'][$origId]['counter']), - $urlCounter['html'][$id]['counter'], + $urlCounter['html'][$id]['counter'] ?? 0, $urlCounter['plain'][$origId]['counter'] ?? 0, $img, ]; @@ -1533,7 +1533,7 @@ public function getLinkLabel($url, $urlStr, $forceFetch = false, $linkedWord = ' $urlParts = parse_url($url); if (!$forceFetch && (substr($url, 0, strlen($pathSite)) === $pathSite)) { - if ($urlParts['fragment'] && (substr($urlParts['fragment'], 0, 1) == 'c')) { + if ($urlParts['fragment'] ?? '' && (substr($urlParts['fragment'], 0, 1) == 'c')) { // linking directly to a content $elementUid = (int)(substr($urlParts['fragment'], 1)); $row = BackendUtility::getRecord('tt_content', $elementUid); @@ -1559,11 +1559,11 @@ public function getLinkLabel($url, $urlStr, $forceFetch = false, $linkedWord = ' $contentTitle = $file['file']; } } -/** +/** if ($this->params['showContentTitle'] == 1) { $label = $contentTitle; } - + if ($this->params['prependContentTitle'] == 1) { $label = $contentTitle . ' (' . $linkedWord . ')'; } diff --git a/composer.json b/composer.json index 66fe684fd..c8ef80fd2 100644 --- a/composer.json +++ b/composer.json @@ -24,7 +24,7 @@ "require": { "typo3/cms-core": "^11.5", "typo3/cms-dashboard": "^11.5", - "php": "^7.4 || ^8.0 || ^8.1", + "php": "^7.4 || ^8.0 || ^8.1", "friendsoftypo3/tt-address": "^6.0 || ^7.0 || ^8.0", "tedivm/fetch": "0.7.*" },