Skip to content

Commit eabd111

Browse files
committed
fix after merge
1 parent 0f5aec3 commit eabd111

File tree

4 files changed

+27
-19
lines changed

4 files changed

+27
-19
lines changed

src/Controller/PagesController.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -82,11 +82,11 @@ public function indexAction(): Response {
8282
* @codeCoverageIgnore
8383
*/
8484
protected function setUpPages(
85-
PagesRepository $pagesRepo,
86-
string $redirects,
87-
string $deleted,
88-
bool $countsOnly = false
89-
): Pages {
85+
PagesRepository $pagesRepo,
86+
string $redirects,
87+
string $deleted,
88+
bool $countsOnly = false
89+
): Pages {
9090
if ( $this->user->isIpRange() ) {
9191
$this->params['username'] = $this->user->getUsername();
9292
$this->throwXtoolsException( $this->getIndexRoute(), 'error-ip-range-unsupported' );
@@ -102,7 +102,7 @@ protected function setUpPages(
102102
$this->start,
103103
$this->end,
104104
$this->offset,
105-
$countsOnly
105+
$countsOnly
106106
);
107107
}
108108

@@ -134,11 +134,11 @@ public function resultAction(
134134
string $redirects = Pages::REDIR_NONE,
135135
string $deleted = Pages::DEL_ALL
136136
): RedirectResponse|Response {
137-
$countsOnly = filter_var(
138-
$this->request->query->get('countsOnly', 'false'),
137+
$countsOnly = filter_var(
138+
$this->request->query->get( 'countsOnly', 'false' ),
139139
FILTER_VALIDATE_BOOLEAN,
140140
) && (
141-
$this->request->query->get('format', 'html') === 'html'
141+
$this->request->query->get( 'format', 'html' ) === 'html'
142142
);
143143
// Check for legacy values for 'redirects', and redirect
144144
// back with correct values if need be. This could be refactored
@@ -150,7 +150,7 @@ public function resultAction(
150150
'redirects' => Pages::REDIR_NONE,
151151
'deleted' => $deleted,
152152
'offset' => $this->offset,
153-
'countsOnly' => $countsOnly,
153+
'countsOnly' => $countsOnly,
154154
] ) );
155155
}
156156

src/Controller/XtoolsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -638,7 +638,7 @@ public function getParams(): array {
638638
'include_pattern',
639639
'exclude_pattern',
640640
'classonly',
641-
'countsOnly',
641+
'countsOnly',
642642

643643
// Legacy parameters.
644644
'user',

src/Model/Pages.php

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ class Pages extends Model {
3333

3434
/** @var array Number of redirects/pages that were created/deleted, broken down by namespace. */
3535
protected array $countsByNamespace;
36-
37-
/** @var bool Whether to only get the counts */
36+
37+
/** @var bool Whether to only get the counts */
3838
protected bool $countsOnly;
3939

4040
/**
@@ -48,7 +48,7 @@ class Pages extends Model {
4848
* @param int|false $start Start date as Unix timestamp.
4949
* @param int|false $end End date as Unix timestamp.
5050
* @param int|false $offset Unix timestamp. Used for pagination.
51-
* @param bool $countsOnly Whether to only get the counts
51+
* @param bool $countsOnly Whether to only get the counts
5252
*/
5353
public function __construct(
5454
protected Repository|PagesRepository $repository,
@@ -60,11 +60,12 @@ public function __construct(
6060
protected int|false $start = false,
6161
protected int|false $end = false,
6262
protected int|false $offset = false,
63-
protected bool $countsOnly = false,
63+
bool $countsOnly = false,
6464
) {
6565
$this->namespace = $namespace === 'all' ? 'all' : (int)$namespace;
6666
$this->redirects = $redirects ?: self::REDIR_NONE;
6767
$this->deleted = $deleted ?: self::DEL_ALL;
68+
$this->countsOnly = $countsOnly;
6869
}
6970

7071
/**
@@ -83,6 +84,14 @@ public function getDeleted(): string {
8384
return $this->deleted;
8485
}
8586

87+
/**
88+
* Whether to only calculate counts.
89+
* @return bool
90+
*/
91+
public function isCountsOnly(): bool {
92+
return $this->countsOnly;
93+
}
94+
8695
/**
8796
* Fetch and prepare the pages created by the user.
8897
* @param bool $all Whether to get *all* results. This should only be used for
@@ -93,7 +102,7 @@ public function getDeleted(): string {
93102
public function prepareData( bool $all = false ): array {
94103
$this->pages = [];
95104

96-
if ($this->countsOnly) {
105+
if ( $this->countsOnly ) {
97106
return [];
98107
}
99108

templates/pages/result.html.twig

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -238,10 +238,9 @@
238238
{{ layout.content_block('summary', content, downloadLink) }}
239239

240240
{################## LIST OF PAGES ###################}
241-
{# not if countsOnly is true #}
242-
{% if not countsOnly %}
241+
{% if not pages.countsOnly %}
243242
{% include 'pages/_pages_list.html.twig' with {'pages': pages} %}
244-
243+
245244
<div class="text-muted times-in-utc" style="clear:both">
246245
{{ msg('times-in-utc') }}
247246
{% endif %}

0 commit comments

Comments
 (0)