mirror of
https://github.com/DanielSiepmann/tracking.git
synced 2024-11-22 13:56:09 +01:00
!!!|Rename bad phrases like blacklist
This involves changed inside of Services.yaml if those configuration options were used before. Relates: #17
This commit is contained in:
parent
f48714cb7b
commit
a387580df7
9 changed files with 25 additions and 24 deletions
|
@ -40,16 +40,16 @@ class NewestPageviews implements ListDataProviderInterface
|
||||||
/**
|
/**
|
||||||
* @var array
|
* @var array
|
||||||
*/
|
*/
|
||||||
private $blackListedPages;
|
private $pagesToExclude;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
QueryBuilder $queryBuilder,
|
QueryBuilder $queryBuilder,
|
||||||
int $maxResults = 6,
|
int $maxResults = 6,
|
||||||
array $blackListedPages = []
|
array $pagesToExclude = []
|
||||||
) {
|
) {
|
||||||
$this->queryBuilder = $queryBuilder;
|
$this->queryBuilder = $queryBuilder;
|
||||||
$this->maxResults = $maxResults;
|
$this->maxResults = $maxResults;
|
||||||
$this->blackListedPages = $blackListedPages;
|
$this->pagesToExclude = $pagesToExclude;
|
||||||
}
|
}
|
||||||
|
|
||||||
public function getItems(): array
|
public function getItems(): array
|
||||||
|
@ -57,11 +57,11 @@ class NewestPageviews implements ListDataProviderInterface
|
||||||
$preparedItems = [];
|
$preparedItems = [];
|
||||||
|
|
||||||
$constraints = [];
|
$constraints = [];
|
||||||
if (count($this->blackListedPages)) {
|
if (count($this->pagesToExclude)) {
|
||||||
$constraints[] = $this->queryBuilder->expr()->notIn(
|
$constraints[] = $this->queryBuilder->expr()->notIn(
|
||||||
'tx_tracking_pageview.pid',
|
'tx_tracking_pageview.pid',
|
||||||
$this->queryBuilder->createNamedParameter(
|
$this->queryBuilder->createNamedParameter(
|
||||||
$this->blackListedPages,
|
$this->pagesToExclude,
|
||||||
Connection::PARAM_INT_ARRAY
|
Connection::PARAM_INT_ARRAY
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -48,7 +48,7 @@ class PageviewsPerDay implements ChartDataProviderInterface
|
||||||
/**
|
/**
|
||||||
* @var array<int>
|
* @var array<int>
|
||||||
*/
|
*/
|
||||||
private $blackListedPages;
|
private $pagesToExclude;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var string
|
* @var string
|
||||||
|
@ -59,13 +59,13 @@ class PageviewsPerDay implements ChartDataProviderInterface
|
||||||
LanguageService $languageService,
|
LanguageService $languageService,
|
||||||
QueryBuilder $queryBuilder,
|
QueryBuilder $queryBuilder,
|
||||||
int $days = 31,
|
int $days = 31,
|
||||||
array $blackListedPages = [],
|
array $pagesToExclude = [],
|
||||||
string $dateFormat = 'Y-m-d'
|
string $dateFormat = 'Y-m-d'
|
||||||
) {
|
) {
|
||||||
$this->queryBuilder = $queryBuilder;
|
$this->queryBuilder = $queryBuilder;
|
||||||
$this->days = $days;
|
$this->days = $days;
|
||||||
$this->languageService = $languageService;
|
$this->languageService = $languageService;
|
||||||
$this->blackListedPages = $blackListedPages;
|
$this->pagesToExclude = $pagesToExclude;
|
||||||
$this->dateFormat = $dateFormat;
|
$this->dateFormat = $dateFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -119,11 +119,11 @@ class PageviewsPerDay implements ChartDataProviderInterface
|
||||||
$this->queryBuilder->expr()->lte('crdate', $end),
|
$this->queryBuilder->expr()->lte('crdate', $end),
|
||||||
];
|
];
|
||||||
|
|
||||||
if (count($this->blackListedPages)) {
|
if (count($this->pagesToExclude)) {
|
||||||
$constraints[] = $this->queryBuilder->expr()->notIn(
|
$constraints[] = $this->queryBuilder->expr()->notIn(
|
||||||
'tx_tracking_pageview.pid',
|
'tx_tracking_pageview.pid',
|
||||||
$this->queryBuilder->createNamedParameter(
|
$this->queryBuilder->createNamedParameter(
|
||||||
$this->blackListedPages,
|
$this->pagesToExclude,
|
||||||
Connection::PARAM_INT_ARRAY
|
Connection::PARAM_INT_ARRAY
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -48,17 +48,17 @@ class PageviewsPerPage implements ChartDataProviderInterface
|
||||||
/**
|
/**
|
||||||
* @var array<int>
|
* @var array<int>
|
||||||
*/
|
*/
|
||||||
private $blackListedPages;
|
private $pagesToExclude;
|
||||||
|
|
||||||
public function __construct(
|
public function __construct(
|
||||||
QueryBuilder $queryBuilder,
|
QueryBuilder $queryBuilder,
|
||||||
int $days = 31,
|
int $days = 31,
|
||||||
int $maxResults = 6,
|
int $maxResults = 6,
|
||||||
array $blackListedPages = []
|
array $pagesToExclude = []
|
||||||
) {
|
) {
|
||||||
$this->queryBuilder = $queryBuilder;
|
$this->queryBuilder = $queryBuilder;
|
||||||
$this->days = $days;
|
$this->days = $days;
|
||||||
$this->blackListedPages = $blackListedPages;
|
$this->pagesToExclude = $pagesToExclude;
|
||||||
$this->maxResults = $maxResults;
|
$this->maxResults = $maxResults;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,11 +92,11 @@ class PageviewsPerPage implements ChartDataProviderInterface
|
||||||
time()
|
time()
|
||||||
),
|
),
|
||||||
];
|
];
|
||||||
if (count($this->blackListedPages)) {
|
if (count($this->pagesToExclude)) {
|
||||||
$constraints[] = $this->queryBuilder->expr()->notIn(
|
$constraints[] = $this->queryBuilder->expr()->notIn(
|
||||||
'tx_tracking_pageview.pid',
|
'tx_tracking_pageview.pid',
|
||||||
$this->queryBuilder->createNamedParameter(
|
$this->queryBuilder->createNamedParameter(
|
||||||
$this->blackListedPages,
|
$this->pagesToExclude,
|
||||||
Connection::PARAM_INT_ARRAY
|
Connection::PARAM_INT_ARRAY
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
|
@ -23,7 +23,7 @@ Default widget configuration.
|
||||||
DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews:
|
DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews:
|
||||||
arguments:
|
arguments:
|
||||||
$queryBuilder: '@querybuilder.tx_tracking_pageview'
|
$queryBuilder: '@querybuilder.tx_tracking_pageview'
|
||||||
$blackListedPages: [1, 11, 38]
|
$pagesToExclude: [1, 11, 38]
|
||||||
|
|
||||||
dashboard.widget.danielsiepmann.tracking.newestPageviews:
|
dashboard.widget.danielsiepmann.tracking.newestPageviews:
|
||||||
class: 'TYPO3\CMS\Dashboard\Widgets\ListWidget'
|
class: 'TYPO3\CMS\Dashboard\Widgets\ListWidget'
|
||||||
|
@ -48,7 +48,7 @@ Options
|
||||||
Integer defining how many results should be displayed.
|
Integer defining how many results should be displayed.
|
||||||
Defaults to 6.
|
Defaults to 6.
|
||||||
|
|
||||||
.. option:: $blackListedPages
|
.. option:: $pagesToExclude
|
||||||
|
|
||||||
Array of page uids that should not be collected.
|
Array of page uids that should not be collected.
|
||||||
Defaults to empty array, all pages are shown.
|
Defaults to empty array, all pages are shown.
|
||||||
|
|
|
@ -25,6 +25,7 @@ Default widget configuration.
|
||||||
arguments:
|
arguments:
|
||||||
$queryBuilder: '@querybuilder.tx_tracking_pageview'
|
$queryBuilder: '@querybuilder.tx_tracking_pageview'
|
||||||
$blackListedPages: [1, 11, 38]
|
$blackListedPages: [1, 11, 38]
|
||||||
|
$pagesToExclude: [1, 11, 38]
|
||||||
|
|
||||||
dashboard.widget.danielsiepmann.tracking.pageViewsPerDay:
|
dashboard.widget.danielsiepmann.tracking.pageViewsPerDay:
|
||||||
class: 'TYPO3\CMS\Dashboard\Widgets\BarChartWidget'
|
class: 'TYPO3\CMS\Dashboard\Widgets\BarChartWidget'
|
||||||
|
@ -51,7 +52,7 @@ Options
|
||||||
|
|
||||||
Defaults to 31.
|
Defaults to 31.
|
||||||
|
|
||||||
.. option:: $blackListedPages
|
.. option:: $pagesToExclude
|
||||||
|
|
||||||
Array of page uids that should not be collected.
|
Array of page uids that should not be collected.
|
||||||
Defaults to empty array, all pages are shown.
|
Defaults to empty array, all pages are shown.
|
||||||
|
|
|
@ -24,7 +24,7 @@ Default widget configuration.
|
||||||
DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage:
|
DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage:
|
||||||
arguments:
|
arguments:
|
||||||
$queryBuilder: '@querybuilder.tx_tracking_pageview'
|
$queryBuilder: '@querybuilder.tx_tracking_pageview'
|
||||||
$blackListedPages: [1, 11, 38]
|
$pagesToExclude: [1, 11, 38]
|
||||||
|
|
||||||
dashboard.widget.danielsiepmann.tracking.pageViewsPerPage:
|
dashboard.widget.danielsiepmann.tracking.pageViewsPerPage:
|
||||||
class: 'TYPO3\CMS\Dashboard\Widgets\DoughnutChartWidget'
|
class: 'TYPO3\CMS\Dashboard\Widgets\DoughnutChartWidget'
|
||||||
|
@ -58,7 +58,7 @@ Options
|
||||||
|
|
||||||
Defaults to 6.
|
Defaults to 6.
|
||||||
|
|
||||||
.. option:: $blackListedPages
|
.. option:: $pagesToExclude
|
||||||
|
|
||||||
Array of page uids that should not be collected.
|
Array of page uids that should not be collected.
|
||||||
Defaults to empty array, all pages are shown.
|
Defaults to empty array, all pages are shown.
|
||||||
|
|
|
@ -78,7 +78,7 @@ class NewestPageviewsTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function defaultsToNoBlackListedPages(): void
|
public function defaultsToNoExcludedPages(): void
|
||||||
{
|
{
|
||||||
$statement = $this->prophesize(Statement::class);
|
$statement = $this->prophesize(Statement::class);
|
||||||
$statement->fetchAll()->willReturn([]);
|
$statement->fetchAll()->willReturn([]);
|
||||||
|
@ -99,7 +99,7 @@ class NewestPageviewsTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function respectsBlackListedPages(): void
|
public function respectsExcludedPages(): void
|
||||||
{
|
{
|
||||||
$expressionBuilder = $this->prophesize(ExpressionBuilder::class);
|
$expressionBuilder = $this->prophesize(ExpressionBuilder::class);
|
||||||
$queryBuilder = $this->prophesize(QueryBuilder::class);
|
$queryBuilder = $this->prophesize(QueryBuilder::class);
|
||||||
|
|
|
@ -44,7 +44,7 @@ class PageviewTest extends TestCase
|
||||||
/**
|
/**
|
||||||
* @test
|
* @test
|
||||||
*/
|
*/
|
||||||
public function doesNotAddBlacklistedRequest(): void
|
public function doesNotAddRequestIfRuleDoesNotApply(): void
|
||||||
{
|
{
|
||||||
$repository = $this->prophesize(Repository::class);
|
$repository = $this->prophesize(Repository::class);
|
||||||
$context = $this->prophesize(Context::class);
|
$context = $this->prophesize(Context::class);
|
||||||
|
|
|
@ -22,7 +22,7 @@ PSR-11 Container Interface
|
||||||
Used to resolve external dependencies, e.g. foreign classes.
|
Used to resolve external dependencies, e.g. foreign classes.
|
||||||
Existing TYPO3 factories are used to build `QueryBuilder` instances.
|
Existing TYPO3 factories are used to build `QueryBuilder` instances.
|
||||||
Also DI is "misused" to provide configuration for dashboard widgets
|
Also DI is "misused" to provide configuration for dashboard widgets
|
||||||
and tracking blacklists.
|
and tracking.
|
||||||
|
|
||||||
PSR-15 HTTP Handlers
|
PSR-15 HTTP Handlers
|
||||||
Also known as middlewares.
|
Also known as middlewares.
|
||||||
|
|
Loading…
Reference in a new issue