r92553 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r92552‎ | r92553 | r92554 >
Date:19:06, 19 July 2011
Author:robin
Status:ok
Tags:
Comment:
Revert self r92205 because that broke compatibility with 1.17; plus some formatting/documentation updates.
Modified paths:
  • /trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php (modified) (history)
  • /trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php (modified) (history)

Diff [purge]

Index: trunk/extensions/WikimediaIncubator/SpecialRandomByTest.php
@@ -1,26 +1,29 @@
22 <?php
33 /**
4 -* Special page to go to a random page in your test wiki
 4+ * Special page to go to a random page in your test wiki
 5+ * (or a specific wiki if it is defined through &testwiki=Wx/xx)
 6+ *
57 * @file
 8+ * @ingroup SpecialPage
 9+ * @author Robin Pepermans (SPQRobin)
610 */
711
8 -class SpecialRandomByTest extends RandomPage
9 -{
 12+class SpecialRandomByTest extends RandomPage {
1013 public function __construct() {
1114 global $wgUser, $wgRequest, $wmincPref, $wmincProjectSite;
1215 $target = $wgRequest->getVal( 'testwiki' );
1316 $target = IncubatorTest::analyzePrefix( $target );
14 - $project = ( isset( $target['project'] ) ? $target['project'] : '' );
15 - $lang = ( isset( $target['lang'] ) ? $target['lang'] : '' );
16 - if( IncubatorTest::isContentProject() || ($project && $lang) ) {
 17+ $project = isset( $target['project'] ) ? $target['project'] : '';
 18+ $lang = isset( $target['lang'] ) ? $target['lang'] : '';
 19+ if( IncubatorTest::isContentProject() || ( $project && $lang ) ) {
1720 $dbr = wfGetDB( DB_SLAVE );
1821 $this->extra[] = 'page_title' .
1922 $dbr->buildLike( IncubatorTest::displayPrefix( $project, $lang ) . '/', $dbr->anyString() );
20 - } elseif($wgUser->getOption($wmincPref . '-project') == $wmincProjectSite['short'] ) {
 23+ } elseif( $wgUser->getOption($wmincPref . '-project') == $wmincProjectSite['short'] ) {
2124 global $wgVersion;
22 - // only works above MW 1.17
 25+ # only works above MW 1.17
2326 if( version_compare($wgVersion, '1.17', '>') ) {
24 - // project or help namespace
 27+ # project or help namespace
2528 $this->extra['page_namespace'] = array( 4, 12 );
2629 }
2730 }
Index: trunk/extensions/WikimediaIncubator/SpecialViewUserLang.php
@@ -7,10 +7,11 @@
88 * Based on code from extension LookupUser made by Tim Starling
99 *
1010 * @file
 11+ * @ingroup SpecialPage
 12+ * @author Robin Pepermans (SPQRobin)
1113 */
1214
13 -class SpecialViewUserLang extends SpecialPage
14 -{
 15+class SpecialViewUserLang extends SpecialPage {
1516 public function __construct() {
1617 parent::__construct( 'ViewUserLang', 'viewuserlang' );
1718 }
@@ -23,7 +24,6 @@
2425 */
2526 public function execute( $subpage ) {
2627 global $wgRequest, $wgUser;
27 -
2828
2929 $this->setHeaders();
3030
@@ -67,7 +67,7 @@
6868 * @param $target Mixed: user whose language and test wiki we're looking up
6969 */
7070 function showInfo( $target ) {
71 - global $wgOut, $wmincPref, $wmincProjectSite;
 71+ global $wgOut, $wmincPref, $wmincProjectSite, $wgUser;
7272 $user = User::newFromName( $target );
7373 $name = $user->getName();
7474 $id = $user->getId();
@@ -81,7 +81,7 @@
8282 $usercode = $user->getOption( $wmincPref . '-code' );
8383 $prefix = IncubatorTest::displayPrefix( $userproject, $usercode );
8484 if ( IncubatorTest::isContentProject( $userproject ) ) {
85 - $testwiki = Linker::link( Title::newFromText( $prefix ) );
 85+ $testwiki = $wgUser->getSkin()->link( Title::newFromText( $prefix ) );
8686 } elseif ( $prefix == $wmincProjectSite['short'] ) {
8787 $testwiki = htmlspecialchars( $wmincProjectSite['name'] );
8888 } else {
@@ -90,7 +90,7 @@
9191 $wgOut->addHtml(
9292 Xml::openElement( 'ul' ) .
9393 '<li>' . wfMsgHtml( 'username' ) . ' ' .
94 - Linker::userLink( $id, $name ) . Linker::userToolLinks( $id, $name, true ) . '</li>' .
 94+ $wgUser->getSkin()->userLink( $id, $name ) . $wgUser->getSkin()->userToolLinks( $id, $name, true ) . '</li>' .
9595 '<li>' . wfMsgHtml( 'loginlanguagelabel', $langNames[$user->getOption( 'language' )] .
9696 ' (' . $user->getOption( 'language' ) . ')' ) . '</li>' .
9797 '<li>' . wfMsgHtml( 'wminc-testwiki' ) . ' ' . $testwiki . '</li>' .

Past revisions this follows-up on

RevisionCommit summaryAuthorDate
r92205Use Linker::link*() functionsrobin21:56, 14 July 2011

Status & tagging log