r97566 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r97565‎ | r97566 | r97567 >
Date:22:18, 19 September 2011
Author:wikinaut
Status:deferred (Comments)
Tags:
Comment:
follow up to r97447 : show OpenID registration timestamps in OpenID preference tab, if these are present
Modified paths:
  • /trunk/extensions/OpenID/OpenID.hooks.php (modified) (history)
  • /trunk/extensions/OpenID/OpenID.i18n.php (modified) (history)
  • /trunk/extensions/OpenID/OpenID.php (modified) (history)
  • /trunk/extensions/OpenID/README.OpenID-mediawiki-extension (modified) (history)
  • /trunk/extensions/OpenID/SpecialOpenID.body.php (modified) (history)

Diff [purge]

Index: trunk/extensions/OpenID/OpenID.i18n.php
@@ -122,6 +122,8 @@
123123 'openid-urls-desc' => 'OpenIDs associated with your account:',
124124 'openid-urls-url' => 'URL',
125125 'openid-urls-action' => 'Action',
 126+ 'openid-urls-registration' => 'Registration time',
 127+ 'openid-urls-registration-date-time' => '$1', # only translate this message to other languages if you have to change it
126128 'openid-urls-delete' => 'Delete',
127129 'openid-add-url' => 'Add a new OpenID',
128130
Index: trunk/extensions/OpenID/README.OpenID-mediawiki-extension
@@ -1,5 +1,5 @@
22 MediaWiki OpenID extension README.OpenID-mediawiki-extension file
3 -version 0.937-beta 20110019
 3+version 0.938-beta 20110920
44
55 Homepage and manual http://www.mediawiki.org/wiki/Extension:OpenID
66
@@ -476,6 +476,7 @@
477477 into that account now
478478
479479 == CHANGES ==
 480+* 0.938 list uoi_user_registration timestamp if present in openid-preference tab
480481 * 0.937 added uoi_user_registration timestamp field (bug30623)
481482 * 0.934 fixes
482483 bug 29543 After logging in with OpenID, user page link in the personal toolbar
Index: trunk/extensions/OpenID/OpenID.hooks.php
@@ -133,27 +133,54 @@
134134 }
135135
136136 private static function getInfoTable( $user ) {
137 - $urls = SpecialOpenID::getUserUrl( $user );
 137+ global $wgLang;
 138+ $openid_urls_registration = SpecialOpenID::getUserUrl( $user );
138139 $delTitle = SpecialPage::getTitleFor( 'OpenIDConvert', 'Delete' );
139140 $sk = $user->getSkin();
140141 $rows = '';
141 - foreach ( $urls as $url ) {
 142+ foreach ( $openid_urls_registration as $url_reg ) {
 143+
 144+ if ( !empty( $url_reg->uoi_user_registration ) ) { $registrationTime = wfMsgExt(
 145+ 'openid-urls-registration-date-time',
 146+ 'parsemag',
 147+ $wgLang->timeanddate( $url_reg->uoi_user_registration, true ),
 148+ $wgLang->date( $url_reg->uoi_user_registration, true ),
 149+ $wgLang->time( $url_reg->uoi_user_registration, true )
 150+ );
 151+ } else {
 152+ $registrationTime = '';
 153+ }
 154+
142155 $rows .= Xml::tags( 'tr', array(),
143156 Xml::tags( 'td',
144157 array(),
145 - Xml::element( 'a', array( 'href' => $url ), $url )
 158+ Xml::element( 'a', array( 'href' => $url_reg->uoi_openid ), $url_reg->uoi_openid )
146159 ) .
147160 Xml::tags( 'td',
148161 array(),
 162+ $registrationTime
 163+ ) .
 164+ Xml::tags( 'td',
 165+ array(),
149166 $sk->link( $delTitle, wfMsgHtml( 'openid-urls-delete' ),
150167 array(),
151 - array( 'url' => $url )
 168+ array( 'url' => $url_reg->uoi_openid )
152169 )
153170 )
154171 ) . "\n";
155172 }
156173 $info = Xml::tags( 'table', array( 'class' => 'wikitable' ),
157 - Xml::tags( 'tr', array(), Xml::element( 'th', array(), wfMsg( 'openid-urls-url' ) ) . Xml::element( 'th', array(), wfMsg( 'openid-urls-action' ) ) ) . "\n" .
 174+ Xml::tags( 'tr', array(),
 175+ Xml::element( 'th',
 176+ array(),
 177+ wfMsg( 'openid-urls-url' ) ) .
 178+ Xml::element( 'th',
 179+ array(),
 180+ wfMsg( 'openid-urls-registration' ) ) .
 181+ Xml::element( 'th',
 182+ array(),
 183+ wfMsg( 'openid-urls-action' ) )
 184+ ) . "\n" .
158185 $rows
159186 );
160187 $info .= $sk->link( SpecialPage::getTitleFor( 'OpenIDConvert' ), wfMsgHtml( 'openid-add-url' ) );
Index: trunk/extensions/OpenID/SpecialOpenID.body.php
@@ -327,8 +327,9 @@
328328 }
329329
330330 # Find the user with the given openid, if any
 331+ # return openid url and registration timestamp
331332 public static function getUserUrl( $user ) {
332 - $openid_urls = array();
 333+ $openid_urls_registration = array();
333334
334335 if ( $user instanceof User && $user->getId() != 0 ) {
335336 $dbr = wfGetDB( DB_SLAVE );
@@ -340,11 +341,11 @@
341342 );
342343
343344 foreach ( $res as $row ) {
344 - $openid_urls[] = $row->uoi_openid;
 345+ $openid_urls_registration[] = $row;
345346 }
346347 $res->free();
347348 }
348 - return $openid_urls;
 349+ return $openid_urls_registration;
349350 }
350351
351352 public static function getUserFromUrl( $openid ) {
Index: trunk/extensions/OpenID/OpenID.php
@@ -27,7 +27,7 @@
2828 exit( 1 );
2929 }
3030
31 -define( 'MEDIAWIKI_OPENID_VERSION', '0.937-beta 20110919' );
 31+define( 'MEDIAWIKI_OPENID_VERSION', '0.938-beta 20110920' );
3232
3333 $path = dirname( __FILE__ );
3434 set_include_path( implode( PATH_SEPARATOR, array( $path ) ) . PATH_SEPARATOR . get_include_path() );

Follow-up revisions

RevisionCommit summaryAuthorDate
r97578follow up to r97566 - adding message documentation for new message texts (ide...wikinaut23:41, 19 September 2011
r97618Ignore new message key from r97566 for translatewiki.netraymond11:25, 20 September 2011
r97619Followup r97618: Make new message optional instead ignore for translatewiki.n...raymond11:30, 20 September 2011
r97770follow up to r97447 r97566 . changed function name getUserUrl to getUserOpenI...wikinaut23:18, 21 September 2011

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r97447v0.937 added uoi_user_registration timestamp when a new OpenID identity is ad...wikinaut23:55, 18 September 2011

Comments

#Comment by Wikinaut (talk | contribs)   22:57, 19 September 2011

removed follow-up r97570 because this is apparently unrelated to r97566

#Comment by Siebrand (talk | contribs)   23:13, 19 September 2011

Please add I18n#Message_documentation for newly added UI messages. Thanks.

#Comment by Wikinaut (talk | contribs)   23:43, 19 September 2011

see r97578 . I used Template:Identical notation, because the new texts are the same

#Comment by Wikinaut (talk | contribs)   22:34, 21 September 2011

there's nothing to be fixed, it works and uses the same as SpecialPreference.php when showing the registration timestamp when a user has registered.

#Comment by Brion VIBBER (talk | contribs)   22:37, 21 September 2011

SpecialOpenID::getUserUrl() seems to return not a URL, but an array of some sort of row objects. This is a kind of icky-looking interface...

#Comment by Brion VIBBER (talk | contribs)   22:40, 21 September 2011

Looks like r52236 turned it from returning a URL to return an array of URLs, which is already a bad-looking api change. Should at least rename it to getUserUrls() (plural!)... but if we're now returning user_openid records, then it probably should be getUserOpenIDs() or something.

#Comment by Wikinaut (talk | contribs)   22:40, 21 September 2011

Brion, I already contacted you to show me a better way, but you were not able to answer (2 days ago). Please can you let me know, what I should improve (and I will do immediately)

#Comment by Brion VIBBER (talk | contribs)   22:41, 21 September 2011

Sorry, must have missed that msg. :) Notes above -- changing the function name should make me reasonably happy with it. :D

Status & tagging log