-
Notifications
You must be signed in to change notification settings - Fork 66
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
EditCounter: add wikitext and CSV download options
- Loading branch information
1 parent
8d51f90
commit a611524
Showing
92 changed files
with
648 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
226 changes: 226 additions & 0 deletions
226
app/Resources/views/editCounter/general_stats.wikitext.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,226 @@ | ||
{% import 'macros/wiki.html.twig' as wiki %} | ||
{% if not is_sub_request %} | ||
== [[User:{{ user.username }}]] == | ||
|
||
{% set link %}[{{ url('EditCounterGeneralStats', {'username': user.username, 'project': project.domain}) }} {{ msg('xtools-title') }}]{% endset %} | ||
{{ msg('xtools-advert', [link, date()|date('Y-m-d H:i')]) }} | ||
{% endif %} | ||
|
||
=== {{ msg('general-stats') }} === | ||
|
||
{| class="wikitable sortable" | ||
| {{ msg('user-id') }} | ||
| {{ user.id(project) }} | ||
|- | ||
| {{ msg('user-groups') }} | ||
| {% for group in user.groups(project) %}{{ group }}{% if not loop.last %}, {% endif %}{% endfor %} | ||
|
||
{% if user.globalGroups(project) %} | ||
|- | ||
| {{ msg('global-user-groups') }} | ||
| {% for group in user.globalGroups(project) %}{{ group }}{% if not loop.last %}, {% endif %}{% endfor %} | ||
|
||
{% endif %} | ||
|- | ||
| {{ msg('is-admin') }} | ||
| {% if user.isAdmin(project) %}1{% else %}0{% endif %} | ||
|
||
|- | ||
| {{ msg('first-edit') }} | ||
| {% if ec.datetimeFirstRevision %}{{ ec.datetimeFirstRevision|date('Y-m-d H:i') }}{% endif %} | ||
|
||
|- | ||
| {{ msg('latest-edit') }} | ||
| {% if ec.datetimeLastRevision %}{{ ec.datetimeLastRevision|date('Y-m-d H:i') }}{% endif %} | ||
|
||
|- | ||
| {{ msg('live-edits') }} | ||
| [[Special:Contributions/{{user.username}}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ec.countLiveRevisions}}}}]] {% if ec.countAllRevisions %}({{ ((ec.countLiveRevisions / ec.countAllRevisions) * 100)|percent_format }}){% endif %} | ||
|
||
|- | ||
| {{ msg('deleted-edits') }} | ||
| [[Special:DeletedContributions/{{user.username}}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ec.countDeletedRevisions}}}}]] {% if ec.countAllRevisions %}({{ ((ec.countDeletedRevisions / ec.countAllRevisions) * 100)|percent_format }}){% endif %} | ||
|
||
|- | ||
| {{ msg('total-edits') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countAllRevisions }}}} | ||
|- | ||
| {{ msg('last-day') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countRevisionsInLast('day') }}}} | ||
|- | ||
| {{ msg('last-week') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countRevisionsInLast('week') }}}} | ||
|- | ||
| {{ msg('last-month') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countRevisionsInLast('month') }}}} | ||
|- | ||
| {{ msg('last-year') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countRevisionsInLast('year') }}}} | ||
|- | ||
| {{ msg('average-edits-per-day', [msg('days', [1])]) }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.averageRevisionsPerDay|round(1) }}}} ({% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.days }}}} {{ msg('num-days', [ec.days]) }}) | ||
|- | ||
| {{ msg('average-edit-size') }}* | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.averageEditSize|round(1) }}}} {{ msg('num-bytes', [ec.averageEditSize]) }} | ||
|- | ||
|} | ||
|
||
{# ======================== PAGES ======================== #} | ||
=== {{ msg('pages') }} === | ||
|
||
{| class="wikitable sortable" | ||
| {{ msg('pages-edited-total') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countAllPagesEdited}}}} | ||
|- | ||
| {{ msg('average-per-page') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.averageRevisionsPerPage }}}} | ||
|- | ||
| {{ msg('pages-created') }} | ||
| [{{ url('PagesResult', {project:project.domain, username:user.username, namespace:'all', redirects:'noredirects'}) }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesCreated }}}}] ({{ msg('pages-created-since-deleted', [ec.countPagesCreatedDeleted]) }}) | ||
|- | ||
| {{ msg('pages-moved') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesMoved }}}} | ||
|- | ||
| {{ msg('pages-deleted') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesDeleted|num_format }}}} | ||
|- | ||
|} | ||
|
||
{# ======================== FILES ======================== #} | ||
=== {{ msg('files') }} === | ||
|
||
{| class="wikitable sortable" | ||
| {{ msg('files-uploaded') }} | ||
| [[Special:ListFiles/{{ user.username }}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countFilesUploaded }}}}]] | ||
|
||
{% if isWMFLabs() %} | ||
|- | ||
| {{ msg('files-uploaded-commons') }} | ||
| [https://commons.wikimedia.org/wiki/Special:ListFiles/{{ user.username|e('url') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countFilesUploadedCommons }}}}] | ||
{% endif %} | ||
|- | ||
|} | ||
|
||
{# ======================== EDITS ======================== #} | ||
=== {{ msg('edits') }} ({{ msg('live')|lower }}) === | ||
|
||
{| class="wikitable sortable" | ||
| {{ msg('auto-edits') }} | ||
| {% if enabled('autoedits') %}[{{ url('autoeditsResult', {project:project.domain, username:user.username, namespace:'all'}) }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countAutomatedEdits }}}}]{% else %}{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countAutomatedEdits }}}}{% endif %} | ||
{% if ec.countLiveRevisions %} ({{ ((ec.countAutomatedEdits / ec.countLiveRevisions) * 100)|percent_format }}) | ||
{% endif %} | ||
|- | ||
| {{ msg('edits-with-summaries') }} | ||
| {% if enabled('es') %}[{{ url('EditSummaryResult', {project:project.domain, username:user.username, namespace:'all'}) }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countRevisionsWithComments }}}}]{% else %}{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countRevisionsWithComments }}}}{% endif %}{% if ec.countLiveRevisions %} ({{ ((ec.countRevisionsWithComments / ec.countLiveRevisions) * 100)|percent_format }}) | ||
{% endif %} | ||
|- | ||
| {{ msg('minor-edits') }} | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countMinorRevisions }}}}{% if ec.countLiveRevisions %} ({{ ((ec.countMinorRevisions / ec.countLiveRevisions) * 100)|percent_format }}) | ||
{% endif %} | ||
|- | ||
| {{ msg('small-edits') }}* | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countSmallEdits }}}}{% if ec.countLast5000 %} ({{ ((ec.countSmallEdits / ec.countLast5000) * 100)|percent_format }}) | ||
{% endif %} | ||
|- | ||
| {{ msg('large-edits') }}* | ||
| {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countLargeEdits }}}}{% if ec.countLast5000 %} ({{ ((ec.countLargeEdits / ec.countLast5000) * 100)|percent_format }}) | ||
{% endif %} | ||
|- | ||
|} | ||
|
||
{# ======================== ACTIONS ======================== #} | ||
=== {{ msg('actions') }} === | ||
|
||
{| class="wikitable sortable" | ||
| {{ msg('thank') }} | ||
| [[Special:Log/thanks/{{ user.username }}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.thanks }}}}]] | ||
|- | ||
| {{ msg('approve') }} | ||
| [[Special:Log/review/{{ user.username }}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.approvals }}}}]] | ||
|- | ||
| {{ msg('patrol') }} | ||
| [[Special:Log/patrol/{{ user.username }}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.patrols }}}}]] | ||
|- | ||
| {{ msg('accounts-created') }} | ||
| [[Special:Log/newusers/{{ user.username }}|{% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.accountsCreated }}}}]] | ||
|- | ||
|} | ||
|
||
{% if user.isAdmin(project) %} | ||
==== {{ msg('actions-as-admin') }} ==== | ||
|
||
{| class="wikitable sortable" | ||
|- | ||
| {{ msg('block') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/block/' ~ user.username, project, 'subtype=block') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countBlocksSet }}}}] | ||
|- | ||
| {{ msg('reblock') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/block/' ~ user.username, project, 'subtype=reblock') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countReblocksSet }}}}] | ||
|- | ||
| {{ msg('unblock') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/block/' ~ user.username, project, 'subtype=unblock') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countUnblocksSet }}}}] | ||
|- | ||
| {{ msg('protect') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/protect/' ~ user.username, project, 'subtype=protect') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesProtected }}}}] | ||
|- | ||
| {{ msg('reprotect') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/protect/' ~ user.username, project, 'subtype=modify') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesReprotected }}}}] | ||
|- | ||
| {{ msg('unprotect') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/protect/' ~ user.username, project, 'subtype=unprotect') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesUnprotected }}}}] | ||
|- | ||
| {{ msg('delete') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/delete/' ~ user.username, project, 'subtype=delete') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesDeleted }}}}] | ||
|- | ||
| {{ msg('revision-delete') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/delete/' ~ user.username, project, 'subtype=revision') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countEditsDeleted }}}}] | ||
|- | ||
| {{ msg('restore') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/delete/' ~ user.username, project, 'subtype=restore') }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesRestored }}}}] | ||
|- | ||
| {{ msg('rights') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/rights/' ~ user.username, project) }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countRightsModified }}}}] | ||
|- | ||
| {{ msg('import') }} | ||
| [{{ wiki.pageUrlRaw('Special:Log/import/' ~ user.username, project) }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countPagesImported }}}}] | ||
|- | ||
|} | ||
|
||
{% endif %}{# ======================== BLOCKS ======================== #} | ||
=== {{ msg('re-blocks') }} === | ||
|
||
{| class="wikitable sortable" | ||
| {{ msg('block-longest') }} | ||
| {% if ec.longestBlockSeconds == -1 %}∞ {# infinity #}{% elseif ec.longestBlockSeconds == false %}–{% else %}{{ formatDuration(ec.longestBlockSeconds) }}{% endif %} | ||
|
||
|- | ||
| {{ msg('block-current') }} | ||
| {% if user.isBlocked(project) %}[[Special:BlockList/{{ user.username }}|{% spaceless %} | ||
{% if user.getBlockExpiry(project) == 'infinity' %}∞{# infinity #}{% else %} | ||
{{ user.getBlockExpiry(project)|date('Y-m-d H:i') }} | ||
{% endif %}]] | ||
{% endspaceless %} | ||
|
||
{% else %}– | ||
{% endif %} | ||
|- | ||
|} | ||
|
||
{# ======================== GLOBAL EDITS ======================== #} | ||
=== {{ msg('top-projects-edit-counts') ~ ' (' ~ msg('approximate')|lower ~ ')' }} === | ||
|
||
{| class="wikitable sortable" | ||
|- | ||
{% set topN = 10 %} | ||
{% for topProj in ec.globalEditCountsTopN(topN) %}{% spaceless %} | ||
| {% if topProj.project.databaseName == project.databaseName %}►{% endif %} | ||
{# use project.domain instead of title due to limited space available in the interface #} | ||
[{{ wiki.pageUrlRaw('Special:Contributions/'~user.username, topProj.project) }} {{ topProj.project.domain }}] | ||
| [{{ url('TopEditsResults', {project:topProj.project.domain, username:user.username}) }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ topProj.total }}}}] | ||
{% endspaceless %} | ||
|
||
|- | ||
{% endfor %} | ||
|} | ||
|
||
<nowiki>*</nowiki> {{ msg('data-limit', [5000, 5000|num_format]) }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{{ msg('month') }},{{ msg('count') }} | ||
{% for nsId in ec.monthCounts.totals|keys %} | ||
{% for month,total in ec.monthTotals %} | ||
{{ month }},{{ total }} | ||
{% endfor %} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
{### FIXME: don't show if they haven't opted in ###} | ||
|
||
{% import 'macros/wiki.html.twig' as wiki %} | ||
{% if not is_sub_request %} | ||
== [[User:{{ user.username }}]] == | ||
|
||
{% set link %}[{{ url('EditCounterMonthCounts', {'username': user.username, 'project': project.domain}) }} {{ msg('xtools-title') }}]{% endset %} | ||
{{ msg('xtools-advert', [link, date()|date('Y-m-d H:i')]) }} | ||
{% endif %} | ||
|
||
=== {{ msg('month-counts') }} === | ||
|
||
{| class="wikitable sortable" | ||
! {{ msg('month') }} | ||
! {{ msg('count') }} | ||
|- | ||
{% for month,total in ec.monthTotals %} | ||
| {{ month }} | ||
| {{ total }} | ||
|- | ||
{% endfor %} | ||
|} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{% for key in ['rank', 'namespace', 'count'] %} | ||
{{ msg(key)|capitalize_first }}{% if not loop.last %},{% endif %} | ||
{% endfor %} | ||
|
||
{% set availableNamespaces = [] %} | ||
{% for nsId, value in ec.namespaceTotals %} | ||
{% set availableNamespaces = availableNamespaces|merge([nsId]) %} | ||
{{ loop.index }},{{ nsName(nsId, project.namespaces) }},{{ value }} | ||
{% endfor %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
app/Resources/views/editCounter/namespace_totals.wikitext.twig
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
{% import 'macros/wiki.html.twig' as wiki %} | ||
{% if not is_sub_request %} | ||
== [[User:{{ user.username }}]] == | ||
|
||
{% set link %}[{{ url('EditCounterNamespaceTotals', {'username': user.username, 'project': project.domain}) }} {{ msg('xtools-title') }}]{% endset %} | ||
{{ msg('xtools-advert', [link, date()|date('Y-m-d H:i')]) }} | ||
{% endif %} | ||
|
||
=== {{ msg('namespace-totals') }} === | ||
|
||
{| class="wikitable sortable" | ||
|- | ||
{% for key in ['rank', 'namespace', 'count'] %} | ||
! {{ msg(key)|capitalize_first }} | ||
{% endfor %} | ||
|- | ||
{% set availableNamespaces = [] %} | ||
{% for nsId, value in ec.namespaceTotals %} | ||
{% set availableNamespaces = availableNamespaces|merge([nsId]) %} | ||
| {{ loop.index }} | ||
| {{ nsName(nsId, project.namespaces) }} | ||
| [{{ url('TopEditsResults', {project:project.domain, username:user.username, namespace:nsId}) }} {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ value }}}}] ({{ value|percent_format(ec.countLiveRevisions) }}) | ||
|- | ||
{% endfor %} | ||
! | ||
! {{ ec.namespaceTotals|length}} {{ msg('num-namespaces', [ec.namespaceTotals|length]) }} | ||
! {% verbatim %}{{FORMATNUM:{% endverbatim %}{{ ec.countLiveRevisions }}}} | ||
|} |
Oops, something went wrong.