From 61f169c21b2953089ff20f0afe24fb76a2474619 Mon Sep 17 00:00:00 2001 From: Rob Church Date: Wed, 21 Jun 2006 00:18:55 +0000 Subject: [PATCH] Introduce 'FetchChangesList' hook; see docs/hooks.txt for more information --- RELEASE-NOTES | 1 + docs/hooks.txt | 6 ++++++ includes/ChangesList.php | 14 +++++++++++--- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES b/RELEASE-NOTES index fd5a1c45df..200a490482 100644 --- a/RELEASE-NOTES +++ b/RELEASE-NOTES @@ -526,6 +526,7 @@ Some default configuration options have changed: * (bug 6174) Remove redundant "emailforlost" message * (bug 6189) Show an error to an unprivilleged user trying to create account * (bug 6365) Show user information in the "old revision" navigation links +* Introduce 'FetchChangesList' hook; see docs/hooks.txt for more information == Compatibility == diff --git a/docs/hooks.txt b/docs/hooks.txt index a8c0ff1821..16db940d03 100644 --- a/docs/hooks.txt +++ b/docs/hooks.txt @@ -335,6 +335,12 @@ $from: address of sending user $subject: subject of the mail $text: text of the mail +'FetchChangesList': When fetching the ChangesList derivative for a particular user +&$user: User the list is being fetched for +&$skin: Skin object to be used with the list +&$list: List object (defaults to NULL, change it to an object instance and return +false override the list derivative used) + 'GetInternalURL': modify fully-qualified URLs used for squid cache purging $title: Title object of page $url: string value as output (out parameter, can modify) diff --git a/includes/ChangesList.php b/includes/ChangesList.php index 84aadb3e93..b2c1abe243 100644 --- a/includes/ChangesList.php +++ b/includes/ChangesList.php @@ -39,12 +39,20 @@ class ChangesList { $this->preCacheMessages(); } + /** + * Fetch an appropriate changes list class for the specified user + * Some users might want to use an enhanced list format, for instance + * + * @param $user User to fetch the list class for + * @return ChangesList derivative + */ function newFromUser( &$user ) { $sk =& $user->getSkin(); - if( $user->getOption('usenewrc') ) { - return new EnhancedChangesList( $sk ); + $list = NULL; + if( wfRunHooks( 'FetchChangesList', array( &$user, &$skin, &$list ) ) ) { + return $user->getOption( 'usenewrc' ) ? new EnhancedChangesList( $sk ) : new OldChangesList( $sk ); } else { - return new OldChangesList( $sk ); + return $list; } } -- 2.20.1