Skip to content

Commit 61944d3

Browse files
committed
[TASK] Initial replace of wiredminds with leadfeeder
Related: https://projekte.in2code.de/issues/81677
1 parent cd9ba36 commit 61944d3

32 files changed

Lines changed: 529 additions & 312 deletions

‎Classes/Command/LuxSetWiredmindCompanyInformationCommand.php‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,10 @@ class LuxSetWiredmindCompanyInformationCommand extends Command
1818

1919
public function configure()
2020
{
21-
$this->setDescription('Add company records from Wiredminds from existing IP addresses in visitor records');
21+
$this->setDescription('Add company records from Leadfeeder from existing IP addresses in visitor records');
2222
$descriptionLimit = 'Search for the latest X leads and try to extend them with company information. ' .
2323
'But: Not every of this IP addresses leads to a company record. ' .
24-
'So 100 means 100 requests to Wiredminds and maybe 10 new company records.';
24+
'So 100 means 100 requests to Leadfeeder and maybe 10 new company records.';
2525
$this->addOption('limit', 'l', InputArgument::OPTIONAL, $descriptionLimit, '0');
2626
$this->addOption(
2727
'overwriteexisting',
@@ -34,7 +34,7 @@ public function configure()
3434
}
3535

3636
/**
37-
* Add company records from Wiredminds from existing IP addresses in visitor records
37+
* Add company records from Leadfeeder from existing IP addresses in visitor records
3838
*
3939
* Example command: ./vendor/bin/typo3 lux:setWiredmindCompanyInformation
4040
* Example command: ./vendor/bin/typo3 lux:setWiredmindCompanyInformation -l 50 -o 1 --time="-300000 seconds"

‎Classes/Controller/AbstractController.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
use In2code\Lux\Domain\Repository\NewsvisitRepository;
2121
use In2code\Lux\Domain\Repository\PageRepository;
2222
use In2code\Lux\Domain\Repository\PagevisitRepository;
23-
use In2code\Lux\Domain\Repository\Remote\WiredmindsRepository;
23+
use In2code\Lux\Domain\Repository\Remote\LeadfeederRepository;
2424
use In2code\Lux\Domain\Repository\SearchRepository;
2525
use In2code\Lux\Domain\Repository\UtmRepository;
2626
use In2code\Lux\Domain\Repository\VisitorRepository;
@@ -65,7 +65,7 @@ public function __construct(
6565
protected readonly SearchRepository $searchRepository,
6666
protected readonly UtmRepository $utmRepository,
6767
protected readonly CompanyRepository $companyRepository,
68-
protected readonly WiredmindsRepository $wiredmindsRepository,
68+
protected readonly LeadfeederRepository $leadfeederRepository,
6969
protected readonly LanguageRepository $languageRepository,
7070
protected readonly RenderingTimeService $renderingTimeService,
7171
protected readonly SiteService $siteService,

‎Classes/Controller/GeneralController.php‎

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ class GeneralController extends AbstractController
2424
public function informationAction(): ResponseInterface
2525
{
2626
$filter = ObjectUtility::getFilterDto(FilterDto::PERIOD_THISYEAR);
27+
$leadfeederConfigured = ($this->settings['tracking']['company']['token'] ?? '') !== ''
28+
&& ($this->settings['tracking']['company']['accountId'] ?? '') !== '';
2729
$values = [
2830
'settings' => $this->settings,
2931
'statistics' => [
@@ -49,12 +51,12 @@ public function informationAction(): ResponseInterface
4951
'fingerprints' => $this->fingerprintRepository->findAllAmount(),
5052
'ipinformations' => $this->ipinformationRepository->findAllAmount(),
5153
'logs' => $this->logRepository->findAllAmount(),
52-
'wiredminds' => [
54+
'leadfeeder' => [
5355
'amount' => $this->companyRepository->getAllAmount(),
5456
'status' => [
55-
'token' => ($this->settings['tracking']['company']['token'] ?? '') !== '',
56-
'result' => $this->wiredmindsRepository->getStatus() !== [],
57-
'statistics' => $this->wiredmindsRepository->getStatus(),
57+
'token' => $leadfeederConfigured,
58+
'result' => $leadfeederConfigured,
59+
'statistics' => $this->leadfeederRepository->getStatus(),
5860
],
5961
],
6062
],

‎Classes/Controller/LeadController.php‎

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ public function companiesAction(FilterDto $filter, string $export = ''): Respons
200200
}
201201

202202
$limit = (int)($this->settings['tracking']['company']['connectionLimit'] ?? 0);
203-
$statistics = $this->wiredmindsRepository->getStatus()[0] ?? ['hits' => 0, 'misses' => 0];
203+
$statistics = $this->leadfeederRepository->getStatus()[0] ?? ['hits' => 0, 'misses' => 0];
204204
$available = $limit - $statistics['hits'] - $statistics['misses'];
205205
if ($available < 0) {
206206
$available = 0;
@@ -220,8 +220,9 @@ public function companiesAction(FilterDto $filter, string $export = ''): Respons
220220
'latestPagevisitsWithCompanies' => $this->pagevisitsRepository->findLatestPagevisitsWithCompanies(
221221
$filter->setLimit(8)
222222
),
223-
'wiredminds' => [
224-
'status' => $this->wiredmindsRepository->getStatus() !== [],
223+
'leadfeeder' => [
224+
'status' => ($this->settings['tracking']['company']['token'] ?? '') !== ''
225+
&& ($this->settings['tracking']['company']['accountId'] ?? '') !== '',
225226
'statistics' => $statistics,
226227
'limit' => $limit,
227228
'overall' => $limit,
@@ -233,12 +234,12 @@ public function companiesAction(FilterDto $filter, string $export = ''): Respons
233234
return $this->defaultRendering();
234235
}
235236

236-
public function companiesDisabledAction(string $tokenWiredminds = ''): ResponseInterface
237+
public function companiesDisabledAction(string $leadfeederToken = '', string $leadfeederAccountId = ''): ResponseInterface
237238
{
238-
if ($tokenWiredminds !== '') {
239+
if ($leadfeederToken !== '' && $leadfeederAccountId !== '') {
239240
try {
240241
$companyConfigurationService = GeneralUtility::makeInstance(CompanyConfigurationService::class);
241-
$companyConfigurationService->add($tokenWiredminds);
242+
$companyConfigurationService->add($leadfeederToken, $leadfeederAccountId);
242243
$this->addFlashMessage(LocalizationUtility::translateByKey('module.companiesDisabled.token.success'));
243244
} catch (Throwable $exception) {
244245
$this->addFlashMessage($exception->getMessage(), '', ContextualFeedbackSeverity::ERROR);
@@ -528,7 +529,8 @@ protected function addDocumentHeaderForCurrentController(): void
528529

529530
protected function isCompaniesViewDisabled(): bool
530531
{
531-
return ($this->settings['tracking']['company']['_enable'] ?? '') !== '1' ||
532-
($this->settings['tracking']['company']['token'] ?? '') === '';
532+
return ($this->settings['tracking']['company']['_enable'] ?? '') !== '1'
533+
|| ($this->settings['tracking']['company']['token'] ?? '') === ''
534+
|| ($this->settings['tracking']['company']['accountId'] ?? '') === '';
533535
}
534536
}

‎Classes/Domain/Model/Log.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ class Log extends AbstractModel
4343
public const STATUS_SHORTENER_VISIT = 100;
4444
public const STATUS_ABTESTING_PAGE = 200;
4545
public const STATUS_UTM_TRACK = 300;
46-
public const STATUS_WIREDMINDS_CONNECTION = 400;
47-
public const STATUS_WIREDMINDS_SUCCESSFUL = 410;
46+
public const STATUS_COMPANY_ENRICH_CONNECTION = 400;
47+
public const STATUS_COMPANY_ENRICH_SUCCESSFUL = 410;
4848
public const STATUS_API_CREATEVISITOR = 500;
4949
public const STATUS_ERROR = 900;
5050

‎Classes/Domain/Model/Visitor.php‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
use In2code\Lux\Domain\Factory\CompanyFactory;
99
use In2code\Lux\Domain\Repository\CategoryscoringRepository;
1010
use In2code\Lux\Domain\Repository\FrontendUserRepository;
11-
use In2code\Lux\Domain\Repository\Remote\WiredmindsRepository;
11+
use In2code\Lux\Domain\Repository\Remote\LeadfeederRepository;
1212
use In2code\Lux\Domain\Repository\VisitorRepository;
1313
use In2code\Lux\Domain\Service\GetCompanyFromIpService;
1414
use In2code\Lux\Domain\Service\Image\VisitorImageService;
@@ -403,15 +403,15 @@ public function resetCompanyrecord(): self
403403

404404
/**
405405
* @param string $ipAddress use current IP address when empty
406-
* @return bool return if there was a hit on wiredminds
406+
* @return bool return if there was a hit on leadfeeder
407407
* @throws ConfigurationException
408408
* @throws IllegalObjectTypeException
409409
* @throws UnknownObjectException
410410
*/
411411
public function setCompanyrecordByIpAdressFromInterface(string $ipAddress = ''): bool
412412
{
413-
$wiredmindsRepository = GeneralUtility::makeInstance(WiredmindsRepository::class);
414-
$properties = $wiredmindsRepository->getPropertiesForIpAddress($this, $ipAddress);
413+
$leadfeederRepository = GeneralUtility::makeInstance(LeadfeederRepository::class);
414+
$properties = $leadfeederRepository->getPropertiesForIpAddress($this, $ipAddress);
415415
if ($properties !== []) {
416416
$companyFactory = GeneralUtility::makeInstance(CompanyFactory::class);
417417
$company = $companyFactory->getExistingOrNewPersistedCompany($properties);

‎Classes/Domain/Repository/LogRepository.php‎

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -133,37 +133,47 @@ public function findAmountOfIdentifiedLogsByPageIdentifierAndTimeFrame(int $page
133133
}
134134
}
135135

136-
public function findWiredmindsLogByVisitor(Visitor $visitor): ?Log
136+
public function findCompanyEnrichLogByVisitor(Visitor $visitor): ?Log
137137
{
138138
$query = $this->createQuery();
139139
$query->matching(
140140
$query->logicalAnd(
141141
$query->equals('visitor', $visitor),
142-
$query->equals('status', Log::STATUS_WIREDMINDS_CONNECTION)
142+
$query->equals('status', Log::STATUS_COMPANY_ENRICH_CONNECTION)
143143
)
144144
);
145145
$query->setLimit(1);
146146
$query->setOrderings(['crdate' => QueryInterface::ORDER_DESCENDING]);
147147
return $query->execute()->getFirst();
148148
}
149149

150-
public function findAmountOfWiredmindsLogsOfCurrentMonth(): int
150+
public function findAmountOfCompanyEnrichLogsOfCurrentMonth(): int
151+
{
152+
return $this->findAmountOfCompanyEnrichLogsOfCurrentMonthByStatus(Log::STATUS_COMPANY_ENRICH_CONNECTION);
153+
}
154+
155+
public function findAmountOfSuccessfulCompanyEnrichLogsOfCurrentMonth(): int
156+
{
157+
return $this->findAmountOfCompanyEnrichLogsOfCurrentMonthByStatus(Log::STATUS_COMPANY_ENRICH_SUCCESSFUL);
158+
}
159+
160+
public function findAmountOfCompanyEnrichLogsOfCurrentHour(): int
151161
{
152162
$connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME);
153163
$sql = 'select count(uid)'
154164
. ' from ' . Log::TABLE_NAME
155-
. ' where crdate > ' . (new \DateTime('first day of this month'))->getTimestamp()
156-
. ' and status=' . Log::STATUS_WIREDMINDS_CONNECTION . ' and deleted=0';
165+
. ' where crdate > ' . DateUtility::getHourStart()->getTimestamp()
166+
. ' and status=' . Log::STATUS_COMPANY_ENRICH_CONNECTION . ' and deleted=0';
157167
return (int)$connection->executeQuery($sql)->fetchOne();
158168
}
159169

160-
public function findAmountOfWiredmindsLogsOfCurrentHour(): int
170+
protected function findAmountOfCompanyEnrichLogsOfCurrentMonthByStatus(int $status): int
161171
{
162172
$connection = DatabaseUtility::getConnectionForTable(Log::TABLE_NAME);
163173
$sql = 'select count(uid)'
164174
. ' from ' . Log::TABLE_NAME
165-
. ' where crdate > ' . DateUtility::getHourStart()->getTimestamp()
166-
. ' and status=' . Log::STATUS_WIREDMINDS_CONNECTION . ' and deleted=0';
175+
. ' where crdate > ' . (new \DateTime('first day of this month'))->getTimestamp()
176+
. ' and status=' . $status . ' and deleted=0';
167177
return (int)$connection->executeQuery($sql)->fetchOne();
168178
}
169179

0 commit comments

Comments
 (0)