r86147 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r86146‎ | r86147 | r86148 >
Date:22:51, 15 April 2011
Author:tparscal
Status:resolved (Comments)
Tags:
Comment:
Changed from using the info field to appending the event id when tracking save activity. Also added an info parameter pass through, now allowing any info to be logged through edits - which will be useful for logging which pages was edited.
Modified paths:
  • /trunk/extensions/ClickTracking/ClickTracking.hooks.php (modified) (history)

Diff [purge]

Index: trunk/extensions/ClickTracking/ClickTracking.hooks.php
@@ -220,36 +220,39 @@
221221 // Add clicktracking fields to form, if given
222222 $session = $wgRequest->getVal( 'clicktrackingsession' );
223223 $event = $wgRequest->getVal( 'clicktrackingevent' );
 224+ $info = $wgRequest->getVal( 'clicktrackinginfo' );
224225 if ( $session !== null && $event !== null ) {
225226 $editPage->editFormTextAfterContent .= Html::hidden( 'clicktrackingsession', $session );
226227 $editPage->editFormTextAfterContent .= Html::hidden( 'clicktrackingevent', $event );
 228+ $editPage->editFormTextAfterContent .= Html::hidden( 'clicktrackinginfo', $info );
227229 }
228230
229231 return true;
230232 }
231233
232234 public static function articleSave( $editpage ) {
233 - self::trackRequest( 'save-attempt' );
 235+ self::trackRequest( '-save-attempt' );
234236 return true;
235237 }
236238
237239 public static function articleSaveComplete( $article, $user, $text, $summary, $minoredit,
238240 $watchthis, $sectionanchor, $flags, $revision, $baseRevId ) {
239 - self::trackRequest( 'save-complete' );
 241+ self::trackRequest( '-save-complete' );
240242 return true;
241243 }
242244
243 - protected static function trackRequest( $info ) {
 245+ protected static function trackRequest( $suffix ) {
244246 global $wgRequest;
245247
246248 $session = $wgRequest->getVal( 'clicktrackingsession' );
247249 $event = $wgRequest->getVal( 'clicktrackingevent' );
 250+ $info = $wgRequest->getVal( 'clicktrackinginfo' );
248251 if ( $session !== null && $event !== null ) {
249252 $params = new FauxRequest( array(
250253 'action' => 'clicktracking',
251 - 'eventid' => $event,
 254+ 'eventid' => $event + $suffix,
252255 'token' => $session,
253 - 'additional' => $info,
 256+ 'info' => $info,
254257 ) );
255258 $api = new ApiMain( $params, true );
256259 $api->execute();

Follow-up revisions

RevisionCommit summaryAuthorDate
r86415Resolves r86147 - I've been coding too much JavaScript, it's bleeding over...tparscal17:44, 19 April 2011

Comments

#Comment by Catrope (talk | contribs)   23:27, 15 April 2011
+				'eventid' => $event + $suffix,

Did you test this? The concatenation operator in PHP is dot, not plus.

Status & tagging log