GWicke has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/279681

Change subject: Exclude null edits from edit metrics
......................................................................

Exclude null edits from edit metrics

Edit metrics are generally interested in actual edits with content changes,
rather than null edits without any content change.

To this end, the WikimediaEventsHooks extension had set up a quick return for
the case that the $revision parameter is null. This is inspired by the
documentation for PageContentSaveComplete [1], which mentions that the
$revision parameter *can* be null if the content was not changed. However, on
the MediaWiki side, the $revision parameter actually ends up being defined
even if the content has not changed.

This patch improves null edit detection by additionally checking for the
revision property in the status object, which is null for null edits.

[1]: https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSaveComplete

Bug: T128838
Change-Id: Ia855b653534a19c35f600988f59e204457cad3c4
---
M WikimediaEventsHooks.php
1 file changed, 2 insertions(+), 1 deletion(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/WikimediaEvents 
refs/changes/81/279681/1

diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php
index 7f70a97..e74e23f 100644
--- a/WikimediaEventsHooks.php
+++ b/WikimediaEventsHooks.php
@@ -54,7 +54,8 @@
        public static function onPageContentSaveComplete( $article, $user, 
$content, $summary,
                $isMinor, $isWatch, $section, $flags, $revision, $status, 
$baseRevId ) {
 
-               if ( !$revision ) {
+               if ( !$revision || is_null( $status->getValue()['revision'] ) ) 
{
+                       // Null edit. Do not count.
                        return;
                }
 

-- 
To view, visit https://gerrit.wikimedia.org/r/279681
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: Ia855b653534a19c35f600988f59e204457cad3c4
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: GWicke <gwi...@wikimedia.org>

_______________________________________________
MediaWiki-commits mailing list
MediaWiki-commits@lists.wikimedia.org
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to