Skip to content

Commit

Permalink
Merge branch 'release/38.0.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Nov 25, 2024
2 parents 9719773 + 3d2815f commit 14088e3
Show file tree
Hide file tree
Showing 134 changed files with 2,262 additions and 2,070 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/testing.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on: [push, pull_request]
jobs:
php-lint:
name: "PHP linter"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -20,12 +20,12 @@ jobs:
fail-fast: false
matrix:
php-version:
- 7.4
- 8.0
- 8.1
- 8.2
- 8.3
typoscript-lint:
name: "TypoScript linter"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
steps:
- name: "Checkout"
uses: actions/checkout@v2
Expand All @@ -36,7 +36,7 @@ jobs:
config_file: ".project/tests/typoscript-lint.yml"
php-cs-fixer:
name: "PHP CS Fixer"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: php-lint
steps:
- name: "Checkout"
Expand All @@ -51,7 +51,7 @@ jobs:
run: "composer test:php:cs"
unit-tests:
name: "PHP Unit Tests"
runs-on: ubuntu-20.04
runs-on: ubuntu-24.04
needs: php-lint
steps:
- name: Checkout
Expand All @@ -70,5 +70,5 @@ jobs:
fail-fast: false
matrix:
php-version:
- 8.1
- 8.2
- 8.3
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,4 @@ var/
/docker-compose.yml
/config/
/.phpunit.cache/
/.env.local
2 changes: 2 additions & 0 deletions .project/TYPO3/.env.local
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
WIREDMINDS_ENABLE=0
WIREDMINDS_TOKEN=
1 change: 1 addition & 0 deletions .project/TYPO3/DockerConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
$GLOBALS['TYPO3_CONF_VARS']['BE']['lockSSL'] = '0';
$GLOBALS['TYPO3_CONF_VARS']['BE']['compressionLevel'] = '0';
$GLOBALS['TYPO3_CONF_VARS']['BE']['debug'] = true;
$GLOBALS['TYPO3_CONF_VARS']['BE']['loginRateLimit'] = 500;

// Debug lokal aktivieren - OS übergreifend
$GLOBALS['TYPO3_CONF_VARS']['SYS']['displayErrors'] = 1;
Expand Down
22 changes: 22 additions & 0 deletions .project/TYPO3/additional.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
'lockSSL' => '0',
'compressionLevel' => '0',
'debug' => true,
'loginRateLimit' => 1000,
],
'DB' => [
'Connections' => [
Expand All @@ -19,6 +20,27 @@
],
],
],
'EXTENSIONS' => [
'lux' => [
'anonymizeIp' => '1',
'categoryScoringAddDownload' => '20',
'categoryScoringAddNewsVisit' => '10',
'categoryScoringAddPageVisit' => '10',
'categoryScoringLinkListenerClick' => '20',
'disableAnalysisModule' => '0',
'disableCkEditorConfiguration' => '0',
'disableIpLogging' => '0',
'disableLeadModule' => '0',
'disablePageOverview' => '0',
'disableWorkflowModule' => '0',
'enableExceptionLogging' => '1',
'leadImageFromExternalSources' => 'all',
'pageOverviewView' => 'analysis',
'scoringCalculation' => '(10 * numberOfSiteVisits) + (1 * numberOfPageVisits) + (20 * downloads) - (1 * lastVisitDaysAgo)',
'showRenderTimes' => '1',
'useCacheLayer' => '0',
],
],
'FE' => [
'cacheHash' => [
'enforceValidation' => true,
Expand Down
Binary file modified .project/data/db.sql.gz
Binary file not shown.
Binary file modified .project/data/fileadmin.tar.gz
Binary file not shown.
4 changes: 3 additions & 1 deletion .project/docker/docker-compose.darwin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,15 @@ services:
- $HOME/.composer/cache/:/tmp/composer/cache/
env_file:
- .env
- .env.local
extra_hosts:
- host.docker.internal:host-gateway

mysql:
image: in2code/mysql:5.7
image: in2code/mysql:8.0
env_file:
- .env
- .env.local
volumes:
- mysql:/var/lib/mysql/
- ${SQLDUMPSDIR}:/${SQLDUMPSDIR}
Expand Down
4 changes: 3 additions & 1 deletion .project/docker/docker-compose.unix.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,13 @@ services:
- $HOME/.composer/cache/:/tmp/composer/cache/
env_file:
- .env
- .env.local

mysql:
image: in2code/mysql:5.7
image: in2code/mysql:8.0
env_file:
- .env
- .env.local
volumes:
- mysql:/var/lib/mysql/
- ${SQLDUMPSDIR}:/${SQLDUMPSDIR}
Expand Down
2 changes: 1 addition & 1 deletion .project/docker/php/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
FROM in2code/php-dev:8.1-fpm
FROM in2code/php-dev:8.2-fpm

COPY zz_xdebug.ini /usr/local/etc/php/conf.d/zz_xdebug.ini
15 changes: 11 additions & 4 deletions Classes/Backend/Buttons/NavigationGroupButton.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,15 @@ public function render()

protected function prepend(): string
{
$icon = $this->iconFactory->getIcon('extension-lux');
return $icon->render();
return '
<span class="t3js-icon icon icon-size-medium icon-state-default icon-extension-lux" data-identifier="extension-lux" aria-hidden="true">
<span class="icon-markup">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" x="0px" y="0px" viewBox="0 0 70.9 70.9" style="enable-background:new 0 0 70.9 70.9;" xml:space="preserve">
<path d="M27.4,2.7c0,0-2.4,6.7,0.9,9.3s4.8,7.1,4.3,9.1c0,0,12.7-0.5,16.4,7.7c0,0-0.2,1.3,7.7,4.7c0,0,2.7,0.9-2.4,6.9 c0,0,0.8,1.7-2.8,2.9c0,0,0.8,4.4-3.9,3.6c-4.7-0.8-11.1-3.8-6.9,3.3c0,0,7.9,7.8,6.4,14.6c0,0-4.9-12.4-20.5-14.1 c0,0,14,3.2,19.1,17.4c0,0-2.8-5.7-15.2-9.1c0,0,3.6,1.3,4.9,5.4c0,0-1-1.9-12.4-5.2s-9.6-14.8-9-17.1c0.9-3.5,3.5-12.4,8.9-17.2 c0,0-3.1-2.7,2.1-13.5C24.9,11.5,24.1,6.7,27.4,2.7z" fill="currentColor"></path>
</svg>
</span>
</span>
';
}

protected function append(string $content): string
Expand All @@ -84,9 +91,9 @@ protected function appendCommunity(string $content): string
$content .= '<a href="' . $this->getInfoUri() . '" style="margin-left: 5px;">';
$content .= $this->iconFactory->getIcon('actions-info-circle-alt', Icon::SIZE_SMALL);
$content .= '</a></div>';
$content .= '<a href="https://www.in2code.de/produkte/lux-typo3-marketing-automation/?utm_campaign=LUX+Community+Version&utm_id=llcv&utm_source=typo3&utm_medium=browser&utm_content=go+enterprise" class="lux_poweredby" style="color:black !important; font-weight:bold; right:85px; position:absolute;" target="_blank" rel="noopener">';
$content .= '<a href="https://www.in2code.de/produkte/lux-typo3-marketing-automation/?utm_campaign=LUX+Community+Version&utm_id=llcv&utm_source=typo3&utm_medium=browser&utm_content=go+enterprise" class="lux_poweredby" style="color:currentColor !important; font-weight:bold; right:85px; position:absolute;" target="_blank" rel="noopener">';
$content .= $icon->render();
$content .= 'Go enterprise</a>';
$content .= ' Go enterprise</a>';
return $content;
}

Expand Down
138 changes: 138 additions & 0 deletions Classes/Backend/LiveSearch/Visitor.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<?php

declare(strict_types=1);

namespace In2code\Lux\Backend\LiveSearch;

use In2code\Lux\Domain\Model\Visitor as VisitorModel;
use In2code\Lux\Domain\Repository\VisitorRepository;
use In2code\Lux\Utility\BackendUtility;
use In2code\Lux\Utility\ObjectUtility;
use TYPO3\CMS\Backend\Module\ModuleProvider;
use TYPO3\CMS\Backend\Routing\Exception\RouteNotFoundException;
use TYPO3\CMS\Backend\Routing\UriBuilder;
use TYPO3\CMS\Backend\Search\LiveSearch\ResultItem;
use TYPO3\CMS\Backend\Search\LiveSearch\ResultItemAction;
use TYPO3\CMS\Backend\Search\LiveSearch\SearchDemand\SearchDemand;
use TYPO3\CMS\Backend\Search\LiveSearch\SearchProviderInterface;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;

class Visitor implements SearchProviderInterface
{
protected string $title = 'LUX Marketing Automation';
protected int $limit = 10;
protected array $results = [];

public function __construct(
readonly protected UriBuilder $uriBuilder,
readonly protected VisitorRepository $visitorRepository,
readonly protected IconFactory $iconFactory
) {
}

/**
* @param SearchDemand $searchDemand
* @return int
* @throws InvalidQueryException
*/
public function count(SearchDemand $searchDemand): int
{
if ($this->isEnabled() === false) {
return 0;
}
return count($this->getResults($searchDemand->getQuery()));
}

/**
* @param SearchDemand $searchDemand
* @return array|ResultItem[]
* @throws InvalidQueryException
* @throws RouteNotFoundException
*/
public function find(SearchDemand $searchDemand): array
{
$resultItems = [];
if ($this->isEnabled()) {
foreach ($this->getResults($searchDemand->getQuery()) as $visitor) {
$resultItems[] = $this->getResultItem($visitor);
}
}
return $resultItems;
}

public function getFilterLabel(): string
{
return $this->title;
}

/**
* @param VisitorModel $visitor
* @return ResultItem
* @throws RouteNotFoundException
*/
protected function getResultItem(VisitorModel $visitor): ResultItem
{
return (new ResultItem(self::class))
->setItemTitle($visitor->getFullNameWithEmail())
->setTypeLabel($this->title)
->setIcon($this->iconFactory->getIcon('extension-lux'))
->setActions(...$this->getActionsForResult($visitor));
}

/**
* @param VisitorModel $visitor
* @return array
* @throws RouteNotFoundException
*/
protected function getActionsForResult(VisitorModel $visitor): array
{
$actions = [];

$uri = $this->uriBuilder->buildUriFromRoute('lux_LuxLead.Lead_detail', ['visitor' => $visitor->getUid()]);
$action = (new ResultItemAction('open_website'))
->setLabel('Lead details')
->setIcon($this->iconFactory->getIcon('extension-lux'))
->setUrl($uri->__toString());
$actions[] = $action;

if ($visitor->getCompanyrecord() !== null) {
$uri = $this->uriBuilder->buildUriFromRoute('lux_LuxLead.Lead_company', ['company' => $visitor->getCompanyrecord()->getUid()]);
$action = (new ResultItemAction('open_website'))
->setLabel('Company details')
->setIcon($this->iconFactory->getIcon('extension-lux'))
->setUrl($uri->__toString());
$actions[] = $action;
}

return $actions;
}

/**
* @param string $searchTerm
* @return array
* @throws InvalidQueryException
*/
protected function getResults(string $searchTerm): array
{
if ($this->results === []) {
$filter = ObjectUtility::getFilterDto()->setLimit($this->limit)->setSearchTerm($searchTerm);
$this->results = $this->visitorRepository->findAllWithIdentifiedFirst($filter);
}
return $this->results;
}

/**
* Check if backend user has access to the leads module
*
* @return bool
*/
protected function isEnabled(): bool
{
/** @var ModuleProvider $moduleProvider */
$moduleProvider = GeneralUtility::makeInstance(ModuleProvider::class);
return BackendUtility::getBackendUserAuthentication() !== null &&
$moduleProvider->accessGranted('lux_LuxLead', BackendUtility::getBackendUserAuthentication());
}
}
26 changes: 26 additions & 0 deletions Classes/Command/ExtbaseCommandTrait.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

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

use In2code\Lux\Utility\ConfigurationUtility;
use In2code\Lux\Utility\EnvironmentUtility;
use TYPO3\CMS\Core\Core\Bootstrap;
use TYPO3\CMS\Core\Core\SystemEnvironmentBuilder;
use TYPO3\CMS\Core\Http\ServerRequest;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;

trait ExtbaseCommandTrait
{
public function initializeExtbase()
{
if (EnvironmentUtility::isCli() && ConfigurationUtility::isTypo3Version12() === false) {
Bootstrap::initializeBackendAuthentication();
$configurationManager = GeneralUtility::makeInstance(ConfigurationManagerInterface::class);
$configurationManager->setRequest(
(new ServerRequest())->withAttribute('applicationType', SystemEnvironmentBuilder::REQUESTTYPE_BE)
);
}
}
}
3 changes: 3 additions & 0 deletions Classes/Command/LuxCacheWarmupCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@

class LuxCacheWarmupCommand extends Command
{
use ExtbaseCommandTrait;

protected ?OutputInterface $output = null;
protected ?CacheWarmup $cacheWarmup = null;

Expand Down Expand Up @@ -54,6 +56,7 @@ public function execute(InputInterface $input, OutputInterface $output): int
if (EnvironmentUtility::isCli() === false) {
throw new ContextException('This command can only be executed from CLI', 1645378130);
}
$this->initializeExtbase();

$this->output = $output;
$this->cacheWarmup = GeneralUtility::makeInstance(CacheWarmup::class);
Expand Down
3 changes: 3 additions & 0 deletions Classes/Command/LuxCleanupUnknownVisitorsByAgeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@

class LuxCleanupUnknownVisitorsByAgeCommand extends Command
{
use ExtbaseCommandTrait;

public function configure()
{
$description = 'Remove all unknown visitors where the last update (tstamp) is older than a given timestamp';
Expand All @@ -38,6 +40,7 @@ public function configure()
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
$this->initializeExtbase();
$visitorRepository = GeneralUtility::makeInstance(VisitorRepository::class);
$visitors = $visitorRepository->findByLastChangeUnknown((int)$input->getArgument('timestamp'));
/** @var Visitor $visitor */
Expand Down
3 changes: 3 additions & 0 deletions Classes/Command/LuxCleanupVisitorByUidCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

class LuxCleanupVisitorByUidCommand extends Command
{
use ExtbaseCommandTrait;

public function configure()
{
$this->setDescription('Remove visitor and all related data from the database');
Expand All @@ -35,6 +37,7 @@ public function configure()
*/
public function execute(InputInterface $input, OutputInterface $output): int
{
$this->initializeExtbase();
$visitorRepository = GeneralUtility::makeInstance(VisitorRepository::class);
/** @var Visitor $visitor */
$visitor = $visitorRepository->findByUid((int)$input->getArgument('visitorUid'));
Expand Down
Loading

0 comments on commit 14088e3

Please sign in to comment.