Skip to content

Commit

Permalink
Merge branch 'release/36.2.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Aug 5, 2024
2 parents 94dab0a + 3bdc72b commit 650e88b
Show file tree
Hide file tree
Showing 9 changed files with 119 additions and 22 deletions.
13 changes: 8 additions & 5 deletions Classes/Controller/FrontendController.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
use In2code\Lux\Exception\EmailValidationException;
use In2code\Lux\Exception\FakeException;
use In2code\Lux\Utility\BackendUtility;
use In2code\Lux\Utility\ConfigurationUtility;
use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Log\LoggerInterface;
Expand Down Expand Up @@ -456,11 +457,13 @@ protected function getError(Throwable $exception): array
{
$this->eventDispatcher->dispatch(new AfterTrackingEvent(new Visitor(), 'error', ['error' => $exception]));
if (BackendUtility::isBackendAuthentication() === false) {
// Log error to var/log/typo3_[hash].log
$this->logger->warning('Error in FrontendController happened', [
'code' => $exception->getCode(),
'message' => $exception->getMessage(),
]);
if (ConfigurationUtility::isExceptionLoggingActivated()) {
// Log error to var/log/typo3_[hash].log
$this->logger->warning('Error in FrontendController happened', [
'code' => $exception->getCode(),
'message' => $exception->getMessage(),
]);
}
$exception = new FakeException('Error happened', 1680200937);
}
return [
Expand Down
49 changes: 40 additions & 9 deletions Classes/Domain/Tracker/StopTracking.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
/**
* Class StopTracking
*
* to stop the initial tracking for some reasons:
* to stop the initial tracking for some reason:
* - If useragent is empty (seems to be not a normal visitor)
* - If useragent contains stop words (e.g. lighthouse, sistrix)
* - If useragent turns out to be a blacklisted browser (e.g. "Googlebot")
Expand All @@ -35,17 +35,48 @@ class StopTracking
* @var array
*/
protected array $blacklistedUa = [
'googlebot',
'pinterestbot',
'linkedinbot',
'bingbot',
'adidxbot',
'ahrefsbot',
'alexabot',
'amazonbot',
'applebot',
'archive.org_bot',
'yandexbot',
'sistrix',
'baiduspider',
'bingbot',
'blexbot',
'cookieradar',
'curl',
'discordbot',
'dotbot',
'duckduckbot',
'exabot',
'facebookexternalhit',
'googlebot',
'headlesschrome',
'ia_archiver',
'lighthouse',
'linkedinbot',
'mauibot',
'msnbot',
'phantomjs',
'pingdom',
'pinterestbot',
'python-requests',
'rogerbot',
'selenium',
'semrushbot',
'sistrix',
'cookieradar',
'HeadlessChrome',
'skypebot',
'slackbot',
'slurp',
'sogou',
'telegrambot',
'twitterbot',
'uptimerobot',
'wget',
'whatsapp',
'yacybot',
'yandexbot',
];

/**
Expand Down
6 changes: 3 additions & 3 deletions Classes/UserFunc/EnableStatus.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@

use Doctrine\DBAL\Exception as ExceptionDbal;
use In2code\Lux\Domain\Model\Visitor;
use In2code\Lux\Utility\ConfigurationUtility;
use In2code\Lux\Utility\DatabaseUtility;
use In2code\Lux\Utility\EnvironmentUtility;
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Fluid\View\StandaloneView;
Expand All @@ -23,8 +23,8 @@ class EnableStatus
public function showEnableStatus(): string
{
$variables = [
'status' => ConfigurationUtility::isComposerMode() && ExtensionManagementUtility::isLoaded('lux'),
'composerMode' => ConfigurationUtility::isComposerMode(),
'status' => EnvironmentUtility::isComposerMode() && ExtensionManagementUtility::isLoaded('lux'),
'composerMode' => EnvironmentUtility::isComposerMode(),
'enabled' => [
'lux' => ExtensionManagementUtility::isLoaded('lux'),
'luxenterprise' => ExtensionManagementUtility::isLoaded('luxenterprise'),
Expand Down
14 changes: 10 additions & 4 deletions Classes/Utility/ConfigurationUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,21 @@ public static function isAnalysisModuleDisabled(): bool
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
*/
public static function isWorkflowModuleDisabled(): bool
public static function isExceptionLoggingActivated(): bool
{
$extensionConfig = self::getExtensionConfiguration();
return $extensionConfig['disableWorkflowModule'] === '1';
return $extensionConfig['enbaleExceptionLogging'] === '1';
}

public static function isComposerMode(): bool
/**
* @return bool
* @throws ExtensionConfigurationExtensionNotConfiguredException
* @throws ExtensionConfigurationPathDoesNotExistException
*/
public static function isWorkflowModuleDisabled(): bool
{
return defined('TYPO3_COMPOSER_MODE');
$extensionConfig = self::getExtensionConfiguration();
return $extensionConfig['disableWorkflowModule'] === '1';
}

/**
Expand Down
5 changes: 5 additions & 0 deletions Classes/Utility/EnvironmentUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,9 @@ public static function isCli(): bool
{
return Environment::isCli();
}

public static function isComposerMode(): bool
{
return defined('TYPO3_COMPOSER_MODE');
}
}
1 change: 1 addition & 0 deletions Documentation/Technical/Changelog/Index.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Double check if you have cleared all caches after installing a new LUX version t

| Version | Date | State | TYPO3 | Description |
|------------|------------|----------|----------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| 36.2.0 | 2024-08-05 | Task | `11.5 + 12.4` | Add main configuration to stop/enable exception logging, extend lists of bots/spider user agent to prevent unneeded tracking |
| 36.1.1 | 2024-08-01 | Bugfix | `11.5 + 12.4` | Use site.identifier instead of websiteTitle in all filters, fix possible exception on CLI commands, increase field size of attribute.value, fix small typo in docs |
| 36.1.0 | 2024-07-31 | Task | `11.5 + 12.4` | Add a bunch of onetime mail domains to configuration, rename virtual page request to event tracking requests |
| 36.0.0 | 2024-07-28 | Feature | `11.5 + 12.4` | Add push service for virtual page visits or search usage (via JavaScript) |
Expand Down
48 changes: 48 additions & 0 deletions Tests/Unit/Utility/EnvironmentUtilityTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
<?php

namespace In2code\Lux\Tests\Unit\Utility;

use In2code\Lux\Utility\EnvironmentUtility;
use TYPO3\TestingFramework\Core\Unit\UnitTestCase;

/**
* @coversDefaultClass \In2code\Lux\Utility\EnvironmentUtility
*/
class EnvironmentUtilityTest extends UnitTestCase
{
/**
* @return void
* @covers ::isFrontend
*/
public function testIsFrontend(): void
{
self::assertFalse(EnvironmentUtility::isFrontend());
}

/**
* @return void
* @covers ::isBackend
*/
public function testIsBackend(): void
{
self::assertFalse(EnvironmentUtility::isBackend());
}

/**
* @return void
* @covers ::isCli
*/
public function testIsCli(): void
{
self::assertTrue(EnvironmentUtility::isCli());
}

/**
* @return void
* @covers ::isComposerMode
*/
public function testIsComposerMode(): void
{
self::assertTrue(EnvironmentUtility::isComposerMode());
}
}
3 changes: 3 additions & 0 deletions ext_conf_template.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,6 @@ showRenderTimes = 0

# cat=advanced/enable/270; type=boolean; label= Use cache layer: Performance boost for backend views. Cache layer could be used for both dashboard views and quick analyse in page overview view. Lifetime is per default 24h and caches can be warmed up via scheduler task.
useCacheLayer = 1

# cat=advanced/enable/280; type=boolean; label= Enable exception logging: If the user is not logged in into backend and an exception happens, those exceptions can be logged as warning in var/log/typo3_[hash].log
enbaleExceptionLogging = 0
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
'description' => 'Living User Experience - LUX - the Marketing Automation tool for TYPO3.
Turn your visitors to leads. Identification and profiling of your visitors within your TYPO3 website.',
'category' => 'plugin',
'version' => '36.1.1',
'version' => '36.2.0',
'author' => 'Alex Kellner',
'author_email' => '[email protected]',
'author_company' => 'in2code.de',
Expand Down

0 comments on commit 650e88b

Please sign in to comment.