r31453 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r31452‎ | r31453 | r31454 >
Date:14:14, 2 March 2008
Author:catrope
Status:old
Tags:
Comment:
(bug 12542) Adding a bunch of hooks to SpecialListusers.php, modified patch by Daniel Friesen
Modified paths:
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/SpecialListusers.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -962,6 +962,26 @@
963963 'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
964964 $id: User identifier
965965
 966+'SpecialListusersDefaultQuery': called right before the end of UsersPager::getDefaultQuery()
 967+$pager: The UsersPager instance
 968+$query: The query array to be returned
 969+
 970+'SpecialListusersFormatRow': called right before the end of UsersPager::formatRow()
 971+$item: HTML to be returned. Will be wrapped in <li></li> after the hook finishes
 972+$row: Database row object
 973+
 974+'SpecialListusersHeader': called before closing the <fieldset> in UsersPager::getPageHeader()
 975+$pager: The UsersPager instance
 976+$out: The header HTML
 977+
 978+'SpecialListusersHeaderForm': called before adding the submit button in UsersPager::getPageHeader()
 979+$pager: The UsersPager instance
 980+$out: The header HTML
 981+
 982+'SpecialListusersQueryInfo': called right before the end of UsersPager::getQueryInfo()
 983+$pager: The UsersPager instance
 984+$query: The query array to be returned
 985+
966986 'SpecialMovepageAfterMove': called after moving a page
967987 $movePage: MovePageForm object
968988 $oldTitle: old title (object)
Index: trunk/phase3/includes/SpecialListusers.php
@@ -68,7 +68,7 @@
6969
7070 list ($user,$user_groups,$ipblocks) = wfGetDB()->tableNamesN('user','user_groups','ipblocks');
7171
72 - return array(
 72+ $query = array(
7373 'tables' => " $user LEFT JOIN $user_groups ON user_id=ug_user LEFT JOIN $ipblocks ON user_id=ipb_user AND ipb_auto=0 ",
7474 'fields' => array('user_name',
7575 'MAX(user_id) AS user_id',
@@ -78,6 +78,8 @@
7979 'conds' => $conds
8080 );
8181
 82+ wfRunHooks( 'SpecialListusersQueryInfo', array( $this, &$query ) );
 83+ return $query;
8284 }
8385
8486 function formatRow( $row ) {
@@ -94,8 +96,10 @@
9597 } else {
9698 $groups = '';
9799 }
98 -
99 - return '<li>' . wfSpecialList( $name, $groups ) . '</li>';
 100+
 101+ $item = wfSpecialList( $name, $groups );
 102+ wfRunHooks( 'SpecialListusersFormatRow', array( &$item, $row ) );
 103+ return "<li>{$item}</li>";
100104 }
101105
102106 function getBody() {
@@ -136,11 +140,14 @@
137141 $out .= Xml::option( User::getGroupName( $group ), $group, $group == $this->requestedGroup );
138142 $out .= Xml::closeElement( 'select' ) . ' ';
139143
 144+ wfRunHooks( 'SpecialListusersHeaderForm', array( $this, &$out ) );
 145+
140146 # Submit button and form bottom
141147 if( $this->mLimit )
142148 $out .= Xml::hidden( 'limit', $this->mLimit );
143 - $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) ) .
144 - '</fieldset>' .
 149+ $out .= Xml::submitButton( wfMsg( 'allpagessubmit' ) );
 150+ wfRunHooks( 'SpecialListusersHeader', array( $this, &$out ) );
 151+ $out .= '</fieldset>' .
145152 Xml::closeElement( 'form' );
146153
147154 return $out;
@@ -156,6 +163,7 @@
157164 $query['group'] = $this->requestedGroup;
158165 if( $this->requestedUser != '' )
159166 $query['username'] = $this->requestedUser;
 167+ wfRunHooks( 'SpecialListusersDefaultQuery', array( $this, &$query ) );
160168 return $query;
161169 }
162170
@@ -213,5 +221,3 @@
214222
215223 $wgOut->addHTML( $s );
216224 }
217 -
218 -

Follow-up revisions

RevisionCommit summaryAuthorDate
r34197Adding missing RELEASE-NOTE....dantman07:53, 4 May 2008

Status & tagging log