Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 13 additions & 1 deletion src/Model/SimpleEditCounter.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class SimpleEditCounter extends Model
'live_edit_count' => 0,
'user_groups' => [],
'global_user_groups' => [],
'creation_count' => 0,
];

/**
Expand Down Expand Up @@ -100,7 +101,9 @@ private function prepareFullData(): void
$this->data['deleted_edit_count'] = (int)$row['value'];
break;
case 'rev':
$this->data['live_edit_count'] = (int)$row['value'];
$values = explode(';', $row['value']);
$this->data['live_edit_count'] = (int)$values[0];
$this->data['creation_count'] = (int)$values[1];
break;
case 'groups':
$this->data['user_groups'][] = $row['value'];
Expand Down Expand Up @@ -140,6 +143,15 @@ public function getDeletedEditCount(): int
return $this->data['deleted_edit_count'];
}

/**
* Get number of page creations
* @return int
*/
public function getCreationCount() : int
{
return $this->data['creation_count'];
}

/**
* Get the number of live edits.
* @return int
Expand Down
10 changes: 9 additions & 1 deletion src/Repository/SimpleEditCounterRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,15 @@ private function fetchDataNormal(
$arNamespaceWhereSql
$arDateConditions
UNION
SELECT 'rev' AS source, COUNT(*) AS value
SELECT 'rev' AS source,
CONCAT(COUNT(*), \";\",
COUNT(
CASE rev_parent_id
WHEN 0
THEN 1
ELSE NULL
END
)) AS value
FROM $revisionTable
$revNamespaceJoinSql
WHERE rev_actor = :actorId
Expand Down
4 changes: 4 additions & 0 deletions templates/simpleEditCounter/result.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,10 @@
<td>{{ wiki.pageLinkRaw('Special:DeletedContributions/' ~ user.username, project, sec.deletedEditCount|num_format) }}</td>
</tr>
{% endif %}
<tr>
<td>{{ msg('pages-created') }}</td>
<td>{{ sec.creationCount|num_format }}</td>
</tr>
{% endif %}
</table>
</div>
Expand Down
Loading