r53929 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r53928‎ | r53929 | r53930 >
Date:12:04, 29 July 2009
Author:catrope
Status:deferred
Tags:
Comment:
* OptIn: Remove text about new search interface, enabled globally
* OptIn: Remove blank option from dropdowns
* PrefStats: Add population script
* PrefStats: Show message when no prefs are being tracked
* PrefStats: Quote timestamps
* PrefStats: Register 'prefstats' rights, document a bit
Modified paths:
  • /trunk/extensions/UsabilityInitiative/OptIn/OptIn.i18n.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/PrefStats/PrefStats.i18n.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/PrefStats/PrefStats.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/PrefStats/SpecialPrefStats.php (modified) (history)
  • /trunk/extensions/UsabilityInitiative/PrefStats/populatePrefStats.php (added) (history)

Diff [purge]

Index: trunk/extensions/UsabilityInitiative/OptIn/SpecialOptIn.php
@@ -289,7 +289,6 @@
290290 $attrs['class'] = 'optin-need-other';
291291 }
292292 $retval .= Xml::openElement( 'select', $attrs );
293 - $retval .= Xml::option( '', '' );
294293 foreach ( $question['answers'] as $aid => $answer ) {
295294 $retval .= Xml::option(
296295 wfMsg( $answer ), $aid,
Index: trunk/extensions/UsabilityInitiative/OptIn/OptIn.i18n.php
@@ -104,11 +104,6 @@
105105 ;Edit toolbar improvements
106106 New-and-improved icons make it clearer what action each tool performs. Expandable sections reduce clutter while keeping infrequently used tools just a click away.
107107 The help section provides quick access to a reference for common uses of wiki-markup.
108 -<div style=\"clear:both;\"></div>
109 -
110 -[[File:UsabilitySearch.png|left]]
111 -;Improved search interface
112 -When using search, title matches are shown first, helping you to find the most relevant articles quickly. Search profiles make searching for different kinds of content easier, while the new advanced search interface makes light work of complex searches.
113108 <div style=\"clear:both;\"></div>",
114109 );
115110
Index: trunk/extensions/UsabilityInitiative/PrefStats/PrefStats.i18n.php
@@ -18,6 +18,7 @@
1919 'prefstats-list-intro' => 'Currently, the following preferences are being tracked.
2020 Click on one to view statistics about it.',
2121 'prefstats-list-elem' => '$1 = $2',
 22+ 'prefstats-noprefs' => 'No preferences are currently being tracked. Configure $wgPrefStatsTrackPrefs to track preferences.',
2223 );
2324
2425 /** Belarusian (Taraškievica orthography) (Беларуская (тарашкевіца))
Index: trunk/extensions/UsabilityInitiative/PrefStats/PrefStats.php
@@ -18,7 +18,10 @@
1919
2020 /* Configuration */
2121
22 -// .Set to false to disable tracking
 22+// For this extension to actually do anything, you need to configure
 23+// $wgPrefStatsTrackPrefs yourself.
 24+
 25+// Set to false to disable tracking
2326 $wgPrefStatsEnable = true;
2427
2528 // array('prefname' => 'value')
@@ -34,6 +37,9 @@
3538
3639 /* Setup */
3740
 41+// Right required to view Special:PrefStats
 42+$wgAvailableRights[] = 'prefstats';
 43+
3844 // Credits
3945 $wgExtensionCredits['other'][] = array(
4046 'path' => __FILE__,
Index: trunk/extensions/UsabilityInitiative/PrefStats/SpecialPrefStats.php
@@ -34,6 +34,10 @@
3535
3636 function displayTrackedPrefs() {
3737 global $wgOut, $wgUser, $wgPrefStatsTrackPrefs;
 38+ if ( !count( $wgPrefStatsTrackPrefs ) ) {
 39+ $wgOut->addWikiMsg( 'prefstats-noprefs' );
 40+ return;
 41+ }
3842 $wgOut->addWikiMsg( 'prefstats-list-intro' );
3943 $wgOut->addHTML( Xml::openElement( 'ul' ) );
4044 foreach ( $wgPrefStatsTrackPrefs as $pref => $value ) {
@@ -116,8 +120,8 @@
117121 $count2 = $dbr->selectField( 'prefstats', 'COUNT(*)', array(
118122 'ps_pref' => $pref,
119123 'ps_duration IS NULL',
120 - 'ps_start <' . $dbr->timestamp( $maxTS ),
121 - 'ps_start >=' . $dbr->timestamp( $minTS )
 124+ 'ps_start <' . $dbr->addQuotes( $dbr->timestamp( $maxTS ) ),
 125+ 'ps_start >=' . $dbr->addQuotes( $dbr->timestamp( $minTS ) )
122126 ), __METHOD__ );
123127 return $count1 + $count2;
124128 }
Index: trunk/extensions/UsabilityInitiative/PrefStats/populatePrefStats.php
@@ -0,0 +1,26 @@
 2+<?php
 3+/**
 4+ * This script populates the prefstats table
 5+ *
 6+ * @file
 7+ * @ingroup Extensions
 8+ */
 9+
 10+require_once( '../../../maintenance/commandLine.inc' );
 11+
 12+$dbw = wfGetDb( DB_MASTER );
 13+foreach ( $wgPrefStatsTrackPrefs as $pref => $value ) {
 14+ echo "Populating $pref=$value ... ";
 15+ $dbw->insertSelect( 'prefstats', 'user_properties', array(
 16+ 'ps_user' => 'up_user',
 17+ 'ps_pref' => 'up_property',
 18+ 'ps_value' => 'up_value',
 19+ 'ps_start' => $dbw->addQuotes( $dbw->timestamp( wfTimestamp() ) ),
 20+ 'ps_duration' => 0
 21+ ), array(
 22+ 'up_property' => $pref,
 23+ 'up_value' => $value
 24+ ), __METHOD__, array( 'IGNORE' )
 25+ );
 26+ echo "done\n";
 27+}

Status & tagging log