r81354 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81353‎ | r81354 | r81355 >
Date:23:26, 1 February 2011
Author:tparscal
Status:deferred
Tags:
Comment:
Added 1 month, 3 month, 6 month and liftime edit counts to properties table upon rating.
Modified paths:
  • /trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ArticleFeedback/api/ApiArticleFeedback.php
@@ -193,6 +193,29 @@
194194 private function insertProperties( $revisionId, $user, $token, $params ) {
195195 // Expertise is given as a list of one or more tags, such as profession, hobby, etc.
196196 $this->insertProperty( $revisionId, $user, $token, 'expertise', $params['expertise'] );
 197+ // Capture edit counts as of right now for the past 1, 3 and 6 months as well as all time
 198+ // - These time distances match the default configuration for the ClickTracking extension
 199+ if ( $user->isLoggedIn() ) {
 200+ $this->insertProperty(
 201+ $revisionId, $user, $token, 'contribs-lifetime', (integer) $user->getEditCount()
 202+ );
 203+ // Take advantage of the UserDailyContribs extension if it's present
 204+ if ( function_exists( 'getUserEditCountSince' ) ) {
 205+ $now = time();
 206+ $this->insertProperty(
 207+ $revisionId, $user, $token, 'contribs-6-months',
 208+ getUserEditCountSince( $now - ( 60 * 60 * 24 * 365 / 2 ) )
 209+ );
 210+ $this->insertProperty(
 211+ $revisionId, $user, $token, 'contribs-3-months',
 212+ getUserEditCountSince( $now - ( 60 * 60 * 24 * 365 / 4 ) )
 213+ );
 214+ $this->insertProperty(
 215+ $revisionId, $user, $token, 'contribs-1-month',
 216+ getUserEditCountSince( $now - ( 60 * 60 * 24 * 30 ) )
 217+ );
 218+ }
 219+ }
197220 }
198221
199222 /**

Status & tagging log