!!!|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:
Daniel Siepmann 2020-07-30 08:00:14 +02:00
parent f48714cb7b
commit a387580df7
9 changed files with 25 additions and 24 deletions

View file

@ -40,16 +40,16 @@ class NewestPageviews implements ListDataProviderInterface
/**
* @var array
*/
private $blackListedPages;
private $pagesToExclude;
public function __construct(
QueryBuilder $queryBuilder,
int $maxResults = 6,
array $blackListedPages = []
array $pagesToExclude = []
) {
$this->queryBuilder = $queryBuilder;
$this->maxResults = $maxResults;
$this->blackListedPages = $blackListedPages;
$this->pagesToExclude = $pagesToExclude;
}
public function getItems(): array
@ -57,11 +57,11 @@ class NewestPageviews implements ListDataProviderInterface
$preparedItems = [];
$constraints = [];
if (count($this->blackListedPages)) {
if (count($this->pagesToExclude)) {
$constraints[] = $this->queryBuilder->expr()->notIn(
'tx_tracking_pageview.pid',
$this->queryBuilder->createNamedParameter(
$this->blackListedPages,
$this->pagesToExclude,
Connection::PARAM_INT_ARRAY
)
);

View file

@ -48,7 +48,7 @@ class PageviewsPerDay implements ChartDataProviderInterface
/**
* @var array<int>
*/
private $blackListedPages;
private $pagesToExclude;
/**
* @var string
@ -59,13 +59,13 @@ class PageviewsPerDay implements ChartDataProviderInterface
LanguageService $languageService,
QueryBuilder $queryBuilder,
int $days = 31,
array $blackListedPages = [],
array $pagesToExclude = [],
string $dateFormat = 'Y-m-d'
) {
$this->queryBuilder = $queryBuilder;
$this->days = $days;
$this->languageService = $languageService;
$this->blackListedPages = $blackListedPages;
$this->pagesToExclude = $pagesToExclude;
$this->dateFormat = $dateFormat;
}
@ -119,11 +119,11 @@ class PageviewsPerDay implements ChartDataProviderInterface
$this->queryBuilder->expr()->lte('crdate', $end),
];
if (count($this->blackListedPages)) {
if (count($this->pagesToExclude)) {
$constraints[] = $this->queryBuilder->expr()->notIn(
'tx_tracking_pageview.pid',
$this->queryBuilder->createNamedParameter(
$this->blackListedPages,
$this->pagesToExclude,
Connection::PARAM_INT_ARRAY
)
);

View file

@ -48,17 +48,17 @@ class PageviewsPerPage implements ChartDataProviderInterface
/**
* @var array<int>
*/
private $blackListedPages;
private $pagesToExclude;
public function __construct(
QueryBuilder $queryBuilder,
int $days = 31,
int $maxResults = 6,
array $blackListedPages = []
array $pagesToExclude = []
) {
$this->queryBuilder = $queryBuilder;
$this->days = $days;
$this->blackListedPages = $blackListedPages;
$this->pagesToExclude = $pagesToExclude;
$this->maxResults = $maxResults;
}
@ -92,11 +92,11 @@ class PageviewsPerPage implements ChartDataProviderInterface
time()
),
];
if (count($this->blackListedPages)) {
if (count($this->pagesToExclude)) {
$constraints[] = $this->queryBuilder->expr()->notIn(
'tx_tracking_pageview.pid',
$this->queryBuilder->createNamedParameter(
$this->blackListedPages,
$this->pagesToExclude,
Connection::PARAM_INT_ARRAY
)
);

View file

@ -23,7 +23,7 @@ Default widget configuration.
DanielSiepmann\Tracking\Dashboard\Provider\NewestPageviews:
arguments:
$queryBuilder: '@querybuilder.tx_tracking_pageview'
$blackListedPages: [1, 11, 38]
$pagesToExclude: [1, 11, 38]
dashboard.widget.danielsiepmann.tracking.newestPageviews:
class: 'TYPO3\CMS\Dashboard\Widgets\ListWidget'
@ -48,7 +48,7 @@ Options
Integer defining how many results should be displayed.
Defaults to 6.
.. option:: $blackListedPages
.. option:: $pagesToExclude
Array of page uids that should not be collected.
Defaults to empty array, all pages are shown.

View file

@ -25,6 +25,7 @@ Default widget configuration.
arguments:
$queryBuilder: '@querybuilder.tx_tracking_pageview'
$blackListedPages: [1, 11, 38]
$pagesToExclude: [1, 11, 38]
dashboard.widget.danielsiepmann.tracking.pageViewsPerDay:
class: 'TYPO3\CMS\Dashboard\Widgets\BarChartWidget'
@ -51,7 +52,7 @@ Options
Defaults to 31.
.. option:: $blackListedPages
.. option:: $pagesToExclude
Array of page uids that should not be collected.
Defaults to empty array, all pages are shown.

View file

@ -24,7 +24,7 @@ Default widget configuration.
DanielSiepmann\Tracking\Dashboard\Provider\PageviewsPerPage:
arguments:
$queryBuilder: '@querybuilder.tx_tracking_pageview'
$blackListedPages: [1, 11, 38]
$pagesToExclude: [1, 11, 38]
dashboard.widget.danielsiepmann.tracking.pageViewsPerPage:
class: 'TYPO3\CMS\Dashboard\Widgets\DoughnutChartWidget'
@ -58,7 +58,7 @@ Options
Defaults to 6.
.. option:: $blackListedPages
.. option:: $pagesToExclude
Array of page uids that should not be collected.
Defaults to empty array, all pages are shown.

View file

@ -78,7 +78,7 @@ class NewestPageviewsTest extends TestCase
/**
* @test
*/
public function defaultsToNoBlackListedPages(): void
public function defaultsToNoExcludedPages(): void
{
$statement = $this->prophesize(Statement::class);
$statement->fetchAll()->willReturn([]);
@ -99,7 +99,7 @@ class NewestPageviewsTest extends TestCase
/**
* @test
*/
public function respectsBlackListedPages(): void
public function respectsExcludedPages(): void
{
$expressionBuilder = $this->prophesize(ExpressionBuilder::class);
$queryBuilder = $this->prophesize(QueryBuilder::class);

View file

@ -44,7 +44,7 @@ class PageviewTest extends TestCase
/**
* @test
*/
public function doesNotAddBlacklistedRequest(): void
public function doesNotAddRequestIfRuleDoesNotApply(): void
{
$repository = $this->prophesize(Repository::class);
$context = $this->prophesize(Context::class);

View file

@ -22,7 +22,7 @@ PSR-11 Container Interface
Used to resolve external dependencies, e.g. foreign classes.
Existing TYPO3 factories are used to build `QueryBuilder` instances.
Also DI is "misused" to provide configuration for dashboard widgets
and tracking blacklists.
and tracking.
PSR-15 HTTP Handlers
Also known as middlewares.