r89560 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r89559‎ | r89560 | r89561 >
Date:12:01, 6 June 2011
Author:robin
Status:ok
Tags:
Comment:
fix displayPrefix: parameters didn't work when preference was not a content project
Modified paths:
  • /trunk/extensions/WikimediaIncubator/IncubatorTest.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaIncubator/IncubatorTest.php
@@ -76,7 +76,7 @@
7777 if( !is_array( $titleparts ) || !isset( $titleparts[1] ) ) {
7878 $data['error'] = 'noslash';
7979 } else {
80 - $data['project'] = $titleparts[0][1]; // get the x from Wx/...
 80+ $data['project'] = ( isset( $titleparts[0][1] ) ? $titleparts[0][1] : '' ); // get the x from Wx/...
8181 $data['lang'] = $titleparts[1];
8282 $data['prefix'] = 'W'.$data['project'].'/'.$data['lang'];
8383 // check language code
@@ -125,12 +125,14 @@
126126 */
127127 static function displayPrefix( $project = '', $code = '' ) {
128128 global $wgUser, $wmincPref;
129 - if ( self::isContentProject() ) {
130 - // return the prefix
 129+ if ( ($project && $code) || self::isContentProject() ) {
 130+ // if parameters are set OR it falls back to user pref and
 131+ // he has a content project pref set -> return the prefix
131132 return 'W' . ( $project ? $project : $wgUser->getOption($wmincPref . '-project') ) .
132133 '/' . ( $code ? $code : $wgUser->getOption($wmincPref . '-code') ); // return the prefix
133134 } else {
134 - // still provide the value
 135+ // fall back to user pref with NO content pref set
 136+ // -> still provide the value (probably 'none' or 'inc')
135137 return $wgUser->getOption($wmincPref . '-project');
136138 }
137139 }

Follow-up revisions

RevisionCommit summaryAuthorDate
r895611.17wmf1: MFT r89560catrope12:18, 6 June 2011

Status & tagging log