r54833 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r54832‎ | r54833 | r54834 >
Date:00:32, 12 August 2009
Author:nimishg
Status:resolved (Comments)
Tags:
Comment:
fixed issues from r54821
Modified paths:
  • /trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.php (modified) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.hooks.php
@@ -11,7 +11,7 @@
1212
1313 /* Static Functions */
1414 public static function schema() {
15 - global $wgExtNewTables, $wgExtNewFields;
 15+ global $wgExtNewTables;
1616
1717 $wgExtNewTables[] = array(
1818 'click_tracking',
@@ -29,26 +29,23 @@
3030 * @param $contribs contributions the user has made (or NULL if user not logged in)
3131 * @return true if the event was stored in the DB
3232 */
33 - public static function trackEvent($is_logged_in, $namespace, $event_id, $contribs=-1){
 33+ public static function trackEvent($is_logged_in, $namespace, $event_id, $contribs=0){
3434
3535 $dbw = wfGetDB( DB_MASTER );
36 - if ($contribs < 0) { //meaning the user is not logged in
37 - $contribs = "NULL";
38 - }
39 -
 36+
4037 $dbw->begin();
4138 // Builds insert information
 39+
4240 $data = array(
43 - 'is_logged_in' => $is_logged_in,
 41+ 'is_logged_in' => (bool) $is_logged_in,
4442 'namespace' => (int) $namespace,
4543 'event_id' => (int) $event_id,
46 - 'user_contribs' => $contribs
 44+ 'user_contribs' => ($is_logged_in?$contribs:null)
4745 );
4846
4947 $db_status = $dbw->insert('click_tracking', $data, __METHOD__);
5048 $dbw->commit();
5149 return $db_status;
5250 }
53 -
54 -
 51+
5552 }
\ No newline at end of file
Index: trunk/extensions/UsabilityInitiative/ClickTracking/ClickTracking.php
@@ -18,8 +18,6 @@
1919
2020 /* Configuration */
2121
22 -$wgClickTrackStyleVersion = 1;
23 -
2422 //functions should check if this is set before logging clicktrack events
2523 $wgClickTrackEnabled = true;
2624
@@ -29,8 +27,7 @@
3028 'name' => 'Click Tracking',
3129 'author' => 'Nimish Gautam',
3230 'version' => '0.1.1',
33 - 'url' => 'http://www.mediawiki.org/wiki/Extension:UsabilityInitiative',
34 - 'descriptionmsg' => 'clicktracking-desc',
 31+ 'url' => 'http://www.mediawiki.org/wiki/Extension:UsabilityInitiative'
3532 );
3633
3734 // Includes parent extension
@@ -41,4 +38,3 @@
4239 dirname( __FILE__ ) . '/ClickTracking.hooks.php';
4340
4441 $wgHooks['LoadExtensionSchemaUpdates'][] = 'ClickTrackingHooks::schema';
45 -

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r54821Created backend for click trackingnimishg22:45, 11 August 2009

Comments

#Comment by Catrope (talk | contribs)   08:19, 12 August 2009
($is_logged_in?$contribs:null)

As you may have noticed, we use lots of spaces in our coding style. Please space this as:

( $is_logged_in ? $contribs : null )
-	'descriptionmsg' => 'clicktracking-desc',

This way the extension has no description at all. I recommend re-adding this line and adding an i18n file, which you're gonna need anyway if the extension contains any translatable text anywhere else.

Status & tagging log