Skip to content
This repository was archived by the owner on Mar 20, 2026. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/Model/EditCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -700,6 +700,20 @@ public function patrols(): int
return $logCounts['patrol-patrol'] ?: 0;
}

/**
* Get the total number of PageCurations reviews performed by the user.
* (Only exists on English Wikipedia.)
* @return int
*/
public function reviews(): int
{
$logCounts = $this->getLogCounts();
$reviewed = $logCounts['pagetriage-curation-reviewed'] ?: 0;
$reviewedRedirect = $logCounts['pagetriage-curation-reviewed-redirect'] ?: 0;
$reviewedArticle = $logCounts['pagetriage-curation-reviewed-article'] ?: 0;
return ($reviewed + $reviewedRedirect + $reviewedArticle);
}

/**
* Get the total number of accounts created by the user.
* @return int
Expand Down
10 changes: 10 additions & 0 deletions src/Model/Project.php
Original file line number Diff line number Diff line change
Expand Up @@ -263,6 +263,16 @@
return $installedExtensions = $this->getRepository()->getInstalledExtensions($this);
}

/**
* Get if this Wiki has the PageTriage extension (for review counts)
* @return bool Whether it does.
*/
public function hasPageTriage() : bool

Check warning on line 270 in src/Model/Project.php

View check run for this annotation

Codecov / codecov/patch

src/Model/Project.php#L270

Added line #L270 was not covered by tests
{
$extensions = $this->getInstalledExtensions();
return in_array('PageTriage', $extensions);

Check warning on line 273 in src/Model/Project.php

View check run for this annotation

Codecov / codecov/patch

src/Model/Project.php#L272-L273

Added lines #L272 - L273 were not covered by tests
}

/**
* Whether the project has temporary accounts enabled.
* @return bool
Expand Down
3 changes: 3 additions & 0 deletions src/Repository/EditCounterRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,9 @@ public function getLogCounts(Project $project, User $user): array
'merge-merge',
'contentmodel-change',
'contentmodel-new',
'pagetriage-curation-reviewed',
'pagetriage-curation-reviewed-redirect',
'pagetriage-curation-reviewed-article',
];
foreach ($requiredCounts as $req) {
if (!isset($logCounts[$req])) {
Expand Down
8 changes: 8 additions & 0 deletions templates/editCounter/general_stats.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,14 @@
{{ wiki.userLogLink(user, project, ec.approvals|num_format, 'review', 'accept') }}
</td>
</tr>
{% if project.hasPageTriage %}
<tr>
<td>{{ msg('page-curation') }}</td>
<td>
{{ wiki.userLogLink(user, project, ec.reviews|num_format, 'pagetriage-curation', 'review') }}
</td>
</tr>
{% endif %}
<tr>
<td>{{ msg('patrol') }}</td>
<td>
Expand Down
5 changes: 5 additions & 0 deletions templates/editCounter/general_stats.wikitext.twig
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,11 @@
|-
| {{ msg('approve') }}
| [{{ wiki.pageUrlRaw('Special:Log/review/' ~ user.username, project, '&subtype=accept') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.approvals }}}}]
{% if project.hasPageTriage %}
|-
| {{ msg('page-curation') }}
| [{{ wiki.pageUrlRaw('Special:Log/pagetriage-curation/' ~ user.username, project, '&subtype=review') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.reviews }}}}]
{% endif %}
|-
| {{ msg('patrol') }}
| [[Special:Log/patrol/{{ user.username }}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.patrols }}}}]]
Expand Down
5 changes: 5 additions & 0 deletions tests/Model/EditCounterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public function testLogCounts(): void
// Account creation, sum 3
'newusers-create2' => 1,
'newusers-byemail' => 2,
// PageTriage reviews, sum 9
'pagetriage-curation-reviewed' => 2,
'pagetriage-curation-reviewed-article' => 3,
'pagetriage-curation-reviewed-redirect' => 4,
]);
static::assertEquals(0, $this->editCounter->getLogCounts()['delete-delete']);
static::assertEquals(0, $this->editCounter->countPagesDeleted());
Expand All @@ -125,6 +129,7 @@ public function testLogCounts(): void
static::assertEquals(3, $this->editCounter->countContentModelChanges());
static::assertEquals(10, $this->editCounter->approvals());
static::assertEquals(3, $this->editCounter->accountsCreated());
static::assertEquals(9, $this->editCounter->reviews());
}

/**
Expand Down
Loading