Ori.livneh has uploaded a new change for review.

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

Change subject: Keep count of small, "wikignome" edits
......................................................................

Keep count of small, "wikignome" edits

Our hypothesis is that the rate of small, wikignome-type edits is most likely
to be influenced by changes in site performance. So, count 'em.

An edit is considered small if it has been marked as minor of it consists of a
small (under 20b) modification to an existing article.

Bug: T115603
Change-Id: I2381fafae66c4aeedacd595fb60b6f4d21b09de9
---
M WikimediaEventsHooks.php
1 file changed, 26 insertions(+), 1 deletion(-)


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

diff --git a/WikimediaEventsHooks.php b/WikimediaEventsHooks.php
index bd71292..33dd4c3 100644
--- a/WikimediaEventsHooks.php
+++ b/WikimediaEventsHooks.php
@@ -45,6 +45,23 @@
        }
 
        /**
+        * Derive the size of an edit from the revision object it produced.
+        *
+        * @param Revision $revision
+        * @return int Size of edit in bytes
+        */
+       public static function getEditSize( Revision $revision ) {
+               $parentId = $revision->getParentId();
+               if ( !$parentId ) {
+                       $prevSize = 0;
+               } else {
+                       $lengths = Revision::getParentLengths( wfGetDB( 
DB_SLAVE ), array( $parentId ) );
+                       $prevSize = $lengths[ $parentId ];
+               }
+               return $revision->getSize() - $prevSize;
+       }
+
+       /**
         * Log server-side event on successful page edit.
         * @see 
https://www.mediawiki.org/wiki/Manual:Hooks/PageContentSaveComplete
         * @see https://meta.wikimedia.org/wiki/Schema:PageContentSaveComplete
@@ -57,10 +74,19 @@
                        return;
                }
 
+               $stats = RequestContext::getMain()->getStats();
                $isAPI = defined( 'MW_API' );
                $isMobile = class_exists( 'MobileContext' ) && 
MobileContext::singleton()->shouldDisplayMobileView();
                $revId = $revision->getId();
                $title = $article->getTitle();
+
+               // Keep stats on small, "wikignome" edits. An edit is 
considered small
+               // if it has been marked as minor of it consists of a small 
(under 20b)
+               // modification to an existing article. (T115603)
+               if ( $isMinor || ( $revision->getParentId() && 
self::getEditSize( $revision ) < 20 ) ) {
+                       $stats->increment( 'edits.small' );
+               }
+
 
                $event = array(
                        'revisionId' => $revId,
@@ -89,7 +115,6 @@
                // are important indicators of community health.
                if ( $editCount === 0 || preg_match( '/^9+$/' , "$editCount" ) 
) {
                        $milestone = $editCount + 1;
-                       $stats = RequestContext::getMain()->getStats();
                        $stats->increment( "editor.milestones.{$milestone}" );
                        $stats->timing( 
"editor.milestones.timing.{$milestone}", $age );
                }

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

Gerrit-MessageType: newchange
Gerrit-Change-Id: I2381fafae66c4aeedacd595fb60b6f4d21b09de9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/WikimediaEvents
Gerrit-Branch: master
Gerrit-Owner: Ori.livneh <o...@wikimedia.org>

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

Reply via email to