r81352 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r81351‎ | r81352 | r81353 >
Date:23:23, 1 February 2011
Author:tparscal
Status:ok
Tags:
Comment:
Made use of new getUserEditCountSince function introduced in r81349.
Modified paths:
  • /trunk/extensions/ClickTracking/ApiClickTracking.php (modified) (history)
  • /trunk/extensions/ClickTracking/ClickTracking.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ClickTracking/ClickTracking.hooks.php
@@ -87,28 +87,6 @@
8888 }
8989
9090 /**
91 - * Get the number of revisions a user has made since a given time
92 - *
93 - * @param $ts beginning timestamp
94 - * @return number of revsions this user has made
95 - */
96 - public static function getEditCountSince( $ts ) {
97 - global $wgUser;
98 -
99 - // Convert to just the day
100 - $time = gmdate( 'Y-m-d', wfTimestamp( TS_UNIX, $ts ) );
101 - $dbr = wfGetDB( DB_SLAVE );
102 - $edits = $dbr->selectField(
103 - 'user_daily_contribs',
104 - 'SUM(contribs)',
105 - array( 'user_id' => $wgUser->getId(), 'day >= ' . $dbr->addQuotes( $time ) ),
106 - __METHOD__
107 - );
108 - // User hasn't made any edits in whatever amount of time
109 - return $edits == null ? 0 : $edits;
110 - }
111 -
112 - /**
11391 * Get event ID from name
11492 *
11593 * @param $event_name String: name of the event to get
Index: trunk/extensions/ClickTracking/ApiClickTracking.php
@@ -39,13 +39,13 @@
4040 $isLoggedIn = $wgUser->isLoggedIn();
4141 $now = time();
4242 $granularity1 = $isLoggedIn ?
43 - ClickTrackingHooks::getEditCountSince( $now - $wgClickTrackContribGranularity1 ) : 0;
 43+ getUserEditCountSince( $now - $wgClickTrackContribGranularity1 ) : 0;
4444
4545 $granularity2 = $isLoggedIn ?
46 - ClickTrackingHooks::getEditCountSince( $now - $wgClickTrackContribGranularity2 ) : 0;
 46+ getUserEditCountSince( $now - $wgClickTrackContribGranularity2 ) : 0;
4747
4848 $granularity3 = $isLoggedIn ?
49 - ClickTrackingHooks::getEditCountSince( $now - $wgClickTrackContribGranularity3 ) : 0;
 49+ getUserEditCountSince( $now - $wgClickTrackContribGranularity3 ) : 0;
5050
5151 ClickTrackingHooks::trackEvent(
5252 $sessionId, // randomly generated session ID

Follow-up revisions

RevisionCommit summaryAuthorDate
r814131.17: MFT r78395, r79968, r81311, r81313, r81349, r81352, r81376, r81389, r81...catrope20:45, 2 February 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r81349Added global getUserEditCountSince function so extensions don't have to copy-...tparscal23:22, 1 February 2011

Status & tagging log