From: Aaron Schulz Date: Sun, 21 Dec 2008 21:31:06 +0000 (+0000) Subject: *Replace crappy BeforeWatchlist hook X-Git-Tag: 1.31.0-rc.0~43847 X-Git-Url: https://git.cyclocoop.org/%242?a=commitdiff_plain;h=87fbe10e1f9e787815db6f12e86f688ed3f383a0;p=lhc%2Fweb%2Fwiklou.git *Replace crappy BeforeWatchlist hook *Updated LQT accordingly *Will add flaggedrevs function to this shortly --- diff --git a/docs/hooks.txt b/docs/hooks.txt index 41f5587c0b..8f34d95dff 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -505,13 +505,6 @@ rendered inline in wiki pages or galleries in category pages. &$parser: Parser object &$ig: ImageGallery object -'BeforeWatchlist': Override watchlist display or add extra SQL clauses. -$nondefaults: Assoc array with the following keys: - days, hideOwn, hideBots, hideMinor, namespace -$wgUser: wgUser. -&$hookSql: a string which will be inserted without sanitation into the SQL query - used to get the watchlist, at the end of the WHERE part. - 'BlockIp': before an IP address or user is blocked $block: the Block object about to be saved $user: the user _doing_ the block (not the one being blocked) @@ -1239,7 +1232,7 @@ $list: list (array) of core special pages $opts: FormOptions for this request 'SpecialRecentChangesQuery': called when building sql query for SpecialRecentChanges -&$conds: array of where conditionals for query +&$conds: array of WHERE conditionals for query &$tables: array of tables to be queried &$join_conds: join conditions for the tables $opts: FormOptions for this request @@ -1258,6 +1251,12 @@ $term: string of search term 'SpecialVersionExtensionTypes': called when generating the extensions credits, use this to change the tables headers $extTypes: associative array of extensions types +'SpecialWatchlistQuery': called when building sql query for SpecialWatchlist +&$conds: array of WHERE conditionals for query +&$tables: array of tables to be queried +&$join_conds: join conditions for the tables +&$fields: array of query fields + 'TitleArrayFromResult': called when creating an TitleArray object from a database result &$titleArray: set this to an object to override the default object returned $res: database result used to create the object diff --git a/includes/specials/SpecialWatchlist.php b/includes/specials/SpecialWatchlist.php index a25ec25cb2..61dd6b3eea 100644 --- a/includes/specials/SpecialWatchlist.php +++ b/includes/specials/SpecialWatchlist.php @@ -128,17 +128,12 @@ function wfSpecialWatchlist( $par ) { wfAppendToArrayIfNotDefault( 'namespace', $nameSpace , $defaults, $nondefaults); wfAppendToArrayIfNotDefault( 'hidePatrolled', (int)$hidePatrolled, $defaults, $nondefaults ); - $hookSql = ""; - if( ! wfRunHooks('BeforeWatchlist', array($nondefaults, $wgUser, &$hookSql)) ) { - return; - } - - if($nitems == 0) { + if( $nitems == 0 ) { $wgOut->addWikiMsg( 'nowatchlist' ); return; } - if ( $days <= 0 ) { + if( $days <= 0 ) { $andcutoff = ''; } else { $andcutoff = "rc_timestamp > '".$dbr->timestamp( time() - intval( $days * 86400 ) )."'"; @@ -217,7 +212,8 @@ function wfSpecialWatchlist( $par ) { if( $andHideAnons ) $conds[] = $andHideAnons; if( $andHidePatrolled ) $conds[] = $andHidePatrolled; if( $nameSpaceClause ) $conds[] = $nameSpaceClause; - if( $hookSql ) $conds[] = $hookSql; + + wfRunHooks('SpecialWatchlistQuery', array(&$conds,&$tables,&$join_conds,&$fields) ); $res = $dbr->select( $tables, $fields, $conds, __METHOD__, $options, $join_conds ); $numRows = $dbr->numRows( $res );