r113588 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r113587‎ | r113588 | r113589 >
Date:20:51, 11 March 2012
Author:reedy
Status:reverted
Tags:gerritmigration 
Comment:
More documentation stubs

Fix Html::inputLabel to Xml::inputLabel

Fix up some deprecated code
Modified paths:
  • /trunk/extensions/AbuseFilter/AbuseFilter.class.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterView.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewDiff.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php (modified) (history)
  • /trunk/extensions/AbuseFilter/Views/AbuseFilterViewRevert.php (modified) (history)
  • /trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php (modified) (history)

Diff [purge]

Index: trunk/extensions/AbuseFilter/special/SpecialAbuseLog.php
@@ -111,6 +111,10 @@
112112 $this->getOutput()->addHTML( $output );
113113 }
114114
 115+ /**
 116+ * @param $id
 117+ * @return mixed
 118+ */
115119 function showHideForm( $id ) {
116120 if ( !$this->getUser()->isAllowed( 'abusefilter-hide-log' ) ) {
117121 $this->getOutput()->addWikiMsg( 'abusefilter-log-hide-forbidden' );
@@ -157,6 +161,10 @@
158162 $form->show();
159163 }
160164
 165+ /**
 166+ * @param $fields
 167+ * @return bool
 168+ */
161169 function saveHideForm( $fields ) {
162170 $logid = $this->getRequest()->getVal( 'hide' );
163171
@@ -223,6 +231,10 @@
224232 }
225233 }
226234
 235+ /**
 236+ * @param $id
 237+ * @return mixed
 238+ */
227239 function showDetails( $id ) {
228240 $out = $this->getOutput();
229241
@@ -252,7 +264,7 @@
253265 return;
254266 }
255267
256 - if ( $this->isHidden($row) && !self::canSeeHidden() ) {
 268+ if ( $this->isHidden( $row ) && !self::canSeeHidden() ) {
257269 $out->addWikiMsg( 'abusefilter-log-details-hidden' );
258270 return;
259271 }
@@ -333,6 +345,8 @@
334346 }
335347
336348 /**
 349+ * @param $filter_id null
 350+ * @param $filter_hidden null
337351 * @return bool
338352 */
339353 static function canSeeDetails( $filter_id = null, $filter_hidden = null ) {
@@ -366,9 +380,13 @@
367381 return $wgUser->isAllowed( 'abusefilter-hidden-log' );
368382 }
369383
 384+ /**
 385+ * @param $row
 386+ * @param $li bool
 387+ * @return String
 388+ */
370389 function formatRow( $row, $li = true ) {
371390 $user = $this->getUser();
372 - $sk = $this->getSkin();
373391 $lang = $this->getLanguage();
374392
375393 $actionLinks = array();
@@ -382,9 +400,9 @@
383401 }
384402
385403 if ( !$row->afl_wiki ) {
386 - $pageLink = $sk->link( $title );
 404+ $pageLink = Linker::link( $title );
387405 if ( $row->afl_rev_id ) {
388 - $diffLink = $sk->link( $title,
 406+ $diffLink = Linker::link( $title,
389407 wfMessage('abusefilter-log-diff')->parse(), array(),
390408 array( 'diff' => 'prev', 'oldid' => $row->afl_rev_id ) );
391409 }
@@ -403,8 +421,8 @@
404422
405423 if ( !$row->afl_wiki ) {
406424 // Local user
407 - $userLink = $sk->userLink( $row->afl_user, $row->afl_user_text ) .
408 - $sk->userToolLinks( $row->afl_user, $row->afl_user_text );
 425+ $userLink = Linker::userLink( $row->afl_user, $row->afl_user_text ) .
 426+ Linker::userToolLinks( $row->afl_user, $row->afl_user_text );
409427 } else {
410428 $userLink = WikiMap::foreignUserLink( $row->afl_wiki, $row->afl_user_text );
411429 $userLink .= ' (' . WikiMap::getWikiName( $row->afl_wiki ) . ')';
@@ -440,11 +458,11 @@
441459
442460 if ( self::canSeeDetails( $row->afl_filter, $filter_hidden ) ) {
443461 $examineTitle = SpecialPage::getTitleFor( 'AbuseFilter', 'examine/log/' . $row->afl_id );
444 - $detailsLink = $sk->makeKnownLinkObj(
 462+ $detailsLink = Linker::makeKnownLinkObj(
445463 $this->getTitle($row->afl_id),
446464 wfMsg( 'abusefilter-log-detailslink' )
447465 );
448 - $examineLink = $sk->link(
 466+ $examineLink = Linker::link(
449467 $examineTitle,
450468 wfMsgExt( 'abusefilter-changeslist-examine', 'parseinline' ),
451469 array()
@@ -457,7 +475,7 @@
458476 $actionLinks[] = $diffLink;
459477
460478 if ( $user->isAllowed( 'abusefilter-hide-log' ) ) {
461 - $hideLink = $sk->link(
 479+ $hideLink = Linker::link(
462480 $this->getTitle(),
463481 wfMsg( 'abusefilter-log-hidelink' ),
464482 array(),
@@ -474,11 +492,11 @@
475493 'Special:AbuseFilter/' . $globalIndex );
476494
477495 $linkText = wfMessage( 'abusefilter-log-detailedentry-global' )->numParams( $globalIndex )->escaped();
478 - $filterLink = $sk->makeExternalLink( $globalURL, $linkText );
 496+ $filterLink = Linker::makeExternalLink( $globalURL, $linkText );
479497 } else {
480498 $title = SpecialPage::getTitleFor( 'AbuseFilter', $row->afl_filter );
481499 $linkText = wfMessage( 'abusefilter-log-detailedentry-local' )->numParams( $row->afl_filter )->escaped();
482 - $filterLink = $sk->link( $title, $linkText );
 500+ $filterLink = Linker::link( $title, $linkText );
483501 }
484502 $description = wfMsgExt( 'abusefilter-log-detailedentry-meta',
485503 array( 'parseinline', 'replaceafter' ),
@@ -501,7 +519,7 @@
502520 $timestamp,
503521 $userLink,
504522 $row->afl_action,
505 - $sk->link( $title ),
 523+ Linker::link( $title ),
506524 $actions_taken,
507525 $parsed_comments
508526 )
@@ -537,7 +555,7 @@
538556 /**
539557 * Given a log entry row, decides whether or not it can be viewed by the public.
540558 *
541 - * @param $row The abuse_filter_log row object.
 559+ * @param $row object The abuse_filter_log row object.
542560 *
543561 * @return Mixed true if the item is explicitly hidden, false if it is not.
544562 * The string 'implicit' if it is hidden because the corresponding revision is hidden.
@@ -566,6 +584,11 @@
567585 */
568586 public $mConds;
569587
 588+ /**
 589+ * @param $form
 590+ * @param array $conds
 591+ * @param bool $details
 592+ */
570593 function __construct( $form, $conds = array(), $details = false ) {
571594 $this->mForm = $form;
572595 $this->mConds = $conds;
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewDiff.php
@@ -94,7 +94,7 @@
9595 'history/' . $this->mFilter . '/item/' . $other['meta']['history_id'] );
9696 global $wgOut;
9797 $wgOut->redirect( $t->getFullURL() );
98 - return;
 98+ return null;
9999 }
100100
101101 } elseif ( $spec == 'next' && !in_array( $otherSpec, $dependentSpecs ) ) {
@@ -117,7 +117,7 @@
118118 'history/' . $this->mFilter . '/item/' . $other['meta']['history_id'] );
119119 global $wgOut;
120120 $wgOut->redirect( $t->getFullURL() );
121 - return;
 121+ return null;
122122 }
123123 }
124124
@@ -148,6 +148,11 @@
149149 );
150150 }
151151
 152+ /**
 153+ * @param $timestamp
 154+ * @param $history_id
 155+ * @return string
 156+ */
152157 function formatVersionLink( $timestamp, $history_id ) {
153158 $filter = $this->mFilter;
154159 $text = $this->getLanguage()->timeanddate( $timestamp, true );
@@ -158,6 +163,9 @@
159164 return $link;
160165 }
161166
 167+ /**
 168+ * @return string
 169+ */
162170 function formatDiff() {
163171 $oldVersion = $this->mOldVersion;
164172 $newVersion = $this->mNewVersion;
@@ -249,6 +257,10 @@
250258 return $html;
251259 }
252260
 261+ /**
 262+ * @param $actions
 263+ * @return array
 264+ */
253265 function stringifyActions( $actions ) {
254266 $lines = array();
255267
@@ -264,6 +276,10 @@
265277 return $lines;
266278 }
267279
 280+ /**
 281+ * @param $msg
 282+ * @return String
 283+ */
268284 function getHeaderRow( $msg ) {
269285 $html = wfMsgExt( $msg, 'parseinline' );
270286 $html = Xml::tags( 'th', array( 'colspan' => 3 ), $html );
@@ -272,6 +288,13 @@
273289 return $html;
274290 }
275291
 292+ /**
 293+ * @param $msg
 294+ * @param $old
 295+ * @param $new
 296+ * @param string $format
 297+ * @return string
 298+ */
276299 function getSimpleRow( $msg, $old, $new, $format = 'wikitext' ) {
277300 $row = '';
278301
@@ -300,6 +323,12 @@
301324 return Xml::tags( 'tr', null, $row ) . "\n";
302325 }
303326
 327+ /**
 328+ * @param $msg
 329+ * @param $old
 330+ * @param $new
 331+ * @return string
 332+ */
304333 function getMultiLineRow( $msg, $old, $new ) {
305334 if ( !is_array( $old ) ) {
306335 $old = explode( "\n", preg_replace( "/\\\r\\\n?/", "\n", $old ) );
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterView.php
@@ -53,6 +53,12 @@
5454 }
5555
5656 class AbuseFilterChangesList extends OldChangesList {
 57+
 58+ /**
 59+ * @param $s
 60+ * @param $rc
 61+ * @param $classes array
 62+ */
5763 public function insertExtra( &$s, &$rc, &$classes ) {
5864 $examineParams = empty( $rc->examineParams ) ? array() : $rc->examineParams;
5965
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewHistory.php
@@ -118,7 +118,6 @@
119119 }
120120
121121 function formatValue( $name, $value ) {
122 - $sk = $this->getSkin();
123122 $lang = $this->getLanguage();
124123
125124 $row = $this->mCurrentRow;
@@ -130,12 +129,12 @@
131130 case 'afh_timestamp':
132131 $title = SpecialPage::getTitleFor( 'AbuseFilter',
133132 'history/' . $row->afh_filter . '/item/' . $row->afh_id );
134 - $formatted = $sk->link( $title, $lang->timeanddate( $row->afh_timestamp, true ) );
 133+ $formatted = Linker::link( $title, $lang->timeanddate( $row->afh_timestamp, true ) );
135134 break;
136135 case 'afh_user_text':
137136 $formatted =
138 - $sk->userLink( $row->afh_user, $row->afh_user_text ) . ' ' .
139 - $sk->userToolLinks( $row->afh_user, $row->afh_user_text );
 137+ Linker::userLink( $row->afh_user, $row->afh_user_text ) . ' ' .
 138+ Linker::userToolLinks( $row->afh_user, $row->afh_user_text );
140139 break;
141140 case 'afh_public_comments':
142141 $formatted = $this->getOutput()->parse( $value );
@@ -158,12 +157,12 @@
159158 break;
160159 case 'afh_filter':
161160 $title = $this->mPage->getTitle( strval( $value ) );
162 - $formatted = $sk->link( $title, $value );
 161+ $formatted = Linker::link( $title, $value );
163162 break;
164163 case 'afh_id':
165164 $title = $this->mPage->getTitle(
166165 'history/' . $row->afh_filter . "/diff/prev/$value" );
167 - $formatted = $sk->link( $title, wfMsgExt( 'abusefilter-history-diff', 'parseinline' ) );
 166+ $formatted = Linker::link( $title, wfMsgExt( 'abusefilter-history-diff', 'parseinline' ) );
168167 break;
169168 default:
170169 $formatted = "Unable to format $name";
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewEdit.php
@@ -240,6 +240,12 @@
241241 }
242242 }
243243
 244+ /**
 245+ * @param $error
 246+ * @param $filter
 247+ * @param $history_id null
 248+ * @return bool|String
 249+ */
244250 function buildFilterEditor( $error, $filter, $history_id = null ) {
245251 if ( $filter === null ) {
246252 return false;
@@ -249,14 +255,13 @@
250256 $out = $this->getOutput();
251257 $lang = $this->getLanguage();
252258 $user = $this->getUser();
253 - $sk = $this->getSkin();
254259
255260 // Load from request OR database.
256261 list( $row, $actions ) = $this->loadRequest( $filter, $history_id );
257262
258263 if ( !$row ) {
259264 $out->addWikiMsg( 'abusefilter-edit-badfilter' );
260 - $out->addHTML( $sk->link( $this->getTitle(), wfMsg( 'abusefilter-return' ) ) );
 265+ $out->addHTML( Linker::link( $this->getTitle(), wfMsg( 'abusefilter-return' ) ) );
261266 return;
262267 }
263268
@@ -301,7 +306,7 @@
302307 $count_display = wfMsgExt( 'abusefilter-hitcount', array( 'parseinline' ),
303308 $lang->formatNum( $count )
304309 );
305 - $hitCount = $sk->makeKnownLinkObj(
 310+ $hitCount = Linker::makeKnownLinkObj(
306311 SpecialPage::getTitleFor( 'AbuseLog' ),
307312 $count_display,
308313 'wpSearchFilter=' . $row->af_id
@@ -387,7 +392,7 @@
388393 if ( $filter != 'new' && $user->isAllowed( 'abusefilter-revert' ) ) {
389394 $tools .= Xml::tags(
390395 'p', null,
391 - $sk->link(
 396+ Linker::link(
392397 $this->getTitle( 'revert/' . $filter ),
393398 wfMsg( 'abusefilter-edit-revert' )
394399 )
@@ -398,15 +403,15 @@
399404 // Test link
400405 $tools .= Xml::tags(
401406 'p', null,
402 - $sk->link(
 407+ Linker::link(
403408 $this->getTitle( "test/$filter" ),
404409 wfMsgExt( 'abusefilter-edit-test-link', 'parseinline' )
405410 )
406411 );
407412 // Last modification details
408413 $userLink =
409 - $sk->userLink( $row->af_user, $row->af_user_text ) .
410 - $sk->userToolLinks( $row->af_user, $row->af_user_text );
 414+ Linker::userLink( $row->af_user, $row->af_user_text ) .
 415+ Linker::userToolLinks( $row->af_user, $row->af_user_text );
411416 $userName = $row->af_user_text;
412417 $fields['abusefilter-edit-lastmod'] =
413418 wfMsgExt(
@@ -421,7 +426,7 @@
422427 );
423428 $history_display = wfMsgExt( 'abusefilter-edit-viewhistory', array( 'parseinline' ) );
424429 $fields['abusefilter-edit-history'] =
425 - $sk->makeKnownLinkObj( $this->getTitle( 'history/' . $filter ), $history_display );
 430+ Linker::makeKnownLinkObj( $this->getTitle( 'history/' . $filter ), $history_display );
426431 }
427432
428433 // Add export
@@ -463,6 +468,11 @@
464469 return $output;
465470 }
466471
 472+ /**
 473+ * @param $row
 474+ * @param $actions
 475+ * @return string
 476+ */
467477 function buildConsequenceEditor( $row, $actions ) {
468478 global $wgAbuseFilterAvailableActions;
469479
@@ -481,6 +491,12 @@
482492 return $output;
483493 }
484494
 495+ /**
 496+ * @param $action
 497+ * @param $set
 498+ * @param $parameters
 499+ * @return string
 500+ */
485501 function buildConsequenceSelector( $action, $set, $parameters ) {
486502 global $wgAbuseFilterAvailableActions;
487503
@@ -641,6 +657,10 @@
642658 }
643659 }
644660
 661+ /**
 662+ * @param $warnMsg
 663+ * @return string
 664+ */
645665 function getExistingSelector( $warnMsg ) {
646666 $existingSelector = new XmlSelect(
647667 'wpFilterWarnMessage',
@@ -678,6 +698,10 @@
679699 return $existingSelector->getHTML();
680700 }
681701
 702+ /**
 703+ * @param $id
 704+ * @return array|null
 705+ */
682706 function loadFilterData( $id ) {
683707 if ( $id == 'new' ) {
684708 $obj = new stdClass;
@@ -737,6 +761,11 @@
738762 return array( $row, $actions );
739763 }
740764
 765+ /**
 766+ * @param $filter
 767+ * @param null $history_id
 768+ * @return array|null
 769+ */
741770 function loadRequest( $filter, $history_id = null ) {
742771 static $row = null;
743772 static $actions = null;
@@ -837,6 +866,10 @@
838867 return array( $row, $actions );
839868 }
840869
 870+ /**
 871+ * @param $id
 872+ * @return array
 873+ */
841874 function loadHistoryItem( $id ) {
842875 $dbr = wfGetDB( DB_SLAVE );
843876
Index: trunk/extensions/AbuseFilter/Views/AbuseFilterViewRevert.php
@@ -9,7 +9,6 @@
1010
1111 $user = $this->getUser();
1212 $out = $this->getOutput();
13 - $sk = $this->getSkin();
1413
1514 if ( !$user->isAllowed( 'abusefilter-revert' ) ) {
1615 throw new PermissionsError( 'abusefilter-revert' );
@@ -67,11 +66,11 @@
6867 array( 'parseinline', 'replaceafter' ),
6968 array(
7069 $lang->timeanddate( $result['timestamp'], true ),
71 - $sk->userLink( $result['userid'], $result['user'] ),
 70+ Linker::userLink( $result['userid'], $result['user'] ),
7271 $result['action'],
73 - $sk->link( $result['title'] ),
 72+ Linker::link( $result['title'] ),
7473 $lang->commaList( $displayActions ),
75 - $sk->link(
 74+ Linker::link(
7675 SpecialPage::getTitleFor( 'AbuseLog' ),
7776 wfMsgNoTrans( 'abusefilter-log-detailslink' ),
7877 array(),
@@ -90,7 +89,7 @@
9190 Html::hidden( 'title', $this->getTitle( "revert/$filter" )->getPrefixedText() ) .
9291 Html::hidden( 'wpPeriodStart', $this->origPeriodStart ) .
9392 Html::hidden( 'wpPeriodEnd', $this->origPeriodEnd ) .
94 - Html::inputLabel(
 93+ Xml::inputLabel(
9594 wfMsg( 'abusefilter-revert-reasonfield' ),
9695 'wpReason', 'wpReason', 45
9796 ) .
Index: trunk/extensions/AbuseFilter/AbuseFilter.class.php
@@ -990,7 +990,7 @@
991991 *
992992 * @param $stored_dump
993993 *
994 - * @return object
 994+ * @return object|AbuseFilterVariableHolder
995995 */
996996 public static function loadVarDump( $stored_dump ) {
997997 wfProfileIn( __METHOD__ );

Follow-up revisions

RevisionCommit summaryAuthorDate
r114396Revert r111217 (unreviewed rev in AbuseFilter) and its dependencies r113585, ...catrope19:41, 21 March 2012

Status & tagging log