Index: trunk/phase3/docs/hooks.txt |
— | — | @@ -505,13 +505,6 @@ |
506 | 506 | &$parser: Parser object |
507 | 507 | &$ig: ImageGallery object |
508 | 508 | |
509 | | -'BeforeWatchlist': Override watchlist display or add extra SQL clauses. |
510 | | -$nondefaults: Assoc array with the following keys: |
511 | | - days, hideOwn, hideBots, hideMinor, namespace |
512 | | -$wgUser: wgUser. |
513 | | -&$hookSql: a string which will be inserted without sanitation into the SQL query |
514 | | - used to get the watchlist, at the end of the WHERE part. |
515 | | - |
516 | 509 | 'BlockIp': before an IP address or user is blocked |
517 | 510 | $block: the Block object about to be saved |
518 | 511 | $user: the user _doing_ the block (not the one being blocked) |
— | — | @@ -1239,7 +1232,7 @@ |
1240 | 1233 | $opts: FormOptions for this request |
1241 | 1234 | |
1242 | 1235 | 'SpecialRecentChangesQuery': called when building sql query for SpecialRecentChanges |
1243 | | -&$conds: array of where conditionals for query |
| 1236 | +&$conds: array of WHERE conditionals for query |
1244 | 1237 | &$tables: array of tables to be queried |
1245 | 1238 | &$join_conds: join conditions for the tables |
1246 | 1239 | $opts: FormOptions for this request |
— | — | @@ -1258,6 +1251,12 @@ |
1259 | 1252 | 'SpecialVersionExtensionTypes': called when generating the extensions credits, use this to change the tables headers |
1260 | 1253 | $extTypes: associative array of extensions types |
1261 | 1254 | |
| 1255 | +'SpecialWatchlistQuery': called when building sql query for SpecialWatchlist |
| 1256 | +&$conds: array of WHERE conditionals for query |
| 1257 | +&$tables: array of tables to be queried |
| 1258 | +&$join_conds: join conditions for the tables |
| 1259 | +&$fields: array of query fields |
| 1260 | + |
1262 | 1261 | 'TitleArrayFromResult': called when creating an TitleArray object from a database result |
1263 | 1262 | &$titleArray: set this to an object to override the default object returned |
1264 | 1263 | $res: database result used to create the object |
Index: trunk/phase3/includes/specials/SpecialWatchlist.php |
— | — | @@ -128,17 +128,12 @@ |
129 | 129 | wfAppendToArrayIfNotDefault( 'namespace', $nameSpace , $defaults, $nondefaults); |
130 | 130 | wfAppendToArrayIfNotDefault( 'hidePatrolled', (int)$hidePatrolled, $defaults, $nondefaults ); |
131 | 131 | |
132 | | - $hookSql = ""; |
133 | | - if( ! wfRunHooks('BeforeWatchlist', array($nondefaults, $wgUser, &$hookSql)) ) { |
134 | | - return; |
135 | | - } |
136 | | - |
137 | | - if($nitems == 0) { |
| 132 | + if( $nitems == 0 ) { |
138 | 133 | $wgOut->addWikiMsg( 'nowatchlist' ); |
139 | 134 | return; |
140 | 135 | } |
141 | 136 | |
142 | | - if ( $days <= 0 ) { |
| 137 | + if( $days <= 0 ) { |
143 | 138 | $andcutoff = ''; |
144 | 139 | } else { |
145 | 140 | $andcutoff = "rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'"; |
— | — | @@ -217,8 +212,9 @@ |
218 | 213 | if( $andHideAnons ) $conds[] = $andHideAnons; |
219 | 214 | if( $andHidePatrolled ) $conds[] = $andHidePatrolled; |
220 | 215 | if( $nameSpaceClause ) $conds[] = $nameSpaceClause; |
221 | | - if( $hookSql ) $conds[] = $hookSql; |
222 | 216 | |
| 217 | + wfRunHooks('SpecialWatchlistQuery', array(&$conds,&$tables,&$join_conds,&$fields) ); |
| 218 | + |
223 | 219 | $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds ); |
224 | 220 | $numRows = $dbr->numRows( $res ); |
225 | 221 | |
Index: trunk/extensions/LiquidThreads/LqtFunctions.php |
— | — | @@ -63,15 +63,15 @@ |
64 | 64 | efThreadTableHelper($st, $indent + 1); |
65 | 65 | } |
66 | 66 | |
67 | | -function wfLqtBeforeWatchlistHook( $options, $user, &$hook_sql ) { |
68 | | - global $wgOut; |
| 67 | +function wfLqtBeforeWatchlistHook( &$conds, &$tables, &$join_conds, &$fields ) { |
| 68 | + global $wgOut, $wgUser; |
69 | 69 | |
70 | | - $hook_sql = "AND page_namespace != " . NS_LQT_THREAD; |
| 70 | + $conds[] = "page_namespace != " . NS_LQT_THREAD; |
71 | 71 | |
72 | | - $talkpage_messages = NewMessages::newUserMessages($user); |
| 72 | + $talkpage_messages = NewMessages::newUserMessages($wgUser); |
73 | 73 | $tn = count($talkpage_messages); |
74 | 74 | |
75 | | - $watch_messages = NewMessages::watchedThreadsForUser($user); |
| 75 | + $watch_messages = NewMessages::watchedThreadsForUser($wgUser); |
76 | 76 | $wn = count($watch_messages); |
77 | 77 | |
78 | 78 | if( $tn == 0 && $wn == 0 ) |
Index: trunk/extensions/LiquidThreads/LiquidThreads.php |
— | — | @@ -36,7 +36,7 @@ |
37 | 37 | $wgExtensionMessagesFiles['LiquidThreads'] = $dir . 'Lqt.i18n.php'; |
38 | 38 | $wgExtensionAliasesFiles['LiquidThreads'] = $dir . 'Lqt.alias.php'; |
39 | 39 | |
40 | | -$wgHooks['BeforeWatchlist'][] = 'wfLqtBeforeWatchlistHook'; |
| 40 | +$wgHooks['SpecialWatchlistQuery'][] = 'wfLqtBeforeWatchlistHook'; |
41 | 41 | $wgHooks['MediaWikiPerformAction'][] = 'LqtDispatch::tryPage'; |
42 | 42 | $wgHooks['SpecialMovepageAfterMove'][] = 'LqtDispatch::onPageMove'; |
43 | 43 | $wgHooks['LinkerMakeLinkObj'][] = 'LqtDispatch::makeLinkObj'; |