Skip to content

Commit

Permalink
[BUGFIX] Fix scoring calculation
Browse files Browse the repository at this point in the history
as a regression with multiclient feature
  • Loading branch information
einpraegsam committed Apr 17, 2024
1 parent 408c17d commit 4659a50
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 10 deletions.
7 changes: 6 additions & 1 deletion Classes/Domain/Model/Visitor.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
use In2code\Lux\Exception\ConfigurationException;
use In2code\Lux\Utility\BackendUtility;
use In2code\Lux\Utility\DatabaseUtility;
use In2code\Lux\Utility\EnvironmentUtility;
use In2code\Lux\Utility\LocalizationUtility;
use In2code\Lux\Utility\ObjectUtility;
use In2code\Lux\Utility\StringUtility;
Expand Down Expand Up @@ -471,7 +472,11 @@ public function getPagevisitsAuthorized(): array
*/
public function getPagevisits(): array
{
$pagevisits = $this->getPagevisitsAuthorized();
if (EnvironmentUtility::isBackend()) {
$pagevisits = $this->getPagevisitsAuthorized();
} else {
$pagevisits = $this->pagevisits;
}
$pagevisitsArray = [];
/** @var Pagevisit $pagevisit */
foreach ($pagevisits as $pagevisit) {
Expand Down
27 changes: 27 additions & 0 deletions Classes/Utility/EnvironmentUtility.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

declare(strict_types=1);
namespace In2code\Lux\Utility;

use TYPO3\CMS\Core\Http\ApplicationType;

class EnvironmentUtility
{
/**
* @return bool
* @SuppressWarnings(PHPMD.Superglobals)
*/
public static function isFrontend(): bool
{
return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend();
}

/**
* @return bool
* @SuppressWarnings(PHPMD.Superglobals)
*/
public static function isBackend(): bool
{
return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isBackend();
}
}
9 changes: 0 additions & 9 deletions Classes/Utility/FrontendUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,6 @@ public static function getPropertyFromLoggedInFrontendUser($propertyName = 'uid'
return '';
}

/**
* @return bool
* @SuppressWarnings(PHPMD.Superglobals)
*/
public static function isFrontendMode(): bool
{
return ApplicationType::fromRequest($GLOBALS['TYPO3_REQUEST'])->isFrontend();
}

/**
* @return ?TypoScriptFrontendController
* @SuppressWarnings(PHPMD.Superglobals)
Expand Down

0 comments on commit 4659a50

Please sign in to comment.