The uncontroversial Liquid Threads hooks.

The hook SkinTemplateTabAction got left in from a previous attempted commit, but the documentation is added in this commit. The other new hooks here are ChangesListInsertArticleLink, MediaWikiPerformAction, and BeforeWatchlist.
This commit is contained in:
David McCabe 2007-11-06 01:16:25 +00:00
parent 0e2ae5d89c
commit 5549750977
6 changed files with 60 additions and 0 deletions

View file

@ -49,6 +49,12 @@ it from source control: http://www.mediawiki.org/wiki/Download_from_SVN
* LogLine hook added to allow formatting custom entries in Special:Log.
* Support for Iranian calendar
* (bug 1401) Allow hiding logged-in users, bots and patrolled pages on Special:Newpages
* ChangesListInsertArticleLink hook added for adding extra article info to RC.
* MediaWikiPerformAction hook added for diverting control after the main
globals have been set up but before any actions have been taken.
* BeforeWatchlist hook added for filtering or replacing watchlist.
* SkinTemplateTabAction hook added for altering the properties of tab links.
* OutputPage::getRedirect public method added.
=== Bug fixes in 1.12 ===

View file

@ -385,6 +385,13 @@ $out: OutputPage object
&$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)
@ -400,6 +407,14 @@ $output: OutputPage object in use
'CategoryPageView': before viewing a categorypage in CategoryPage::view
$catpage: CategoryPage instance
'ChangesListInsertArticleLink': Override or augment link to article in RC list.
&$this: ChangesList instance.
&$articlelink: HTML of link to article (already filled-in).
&$s: HTML of row that is being constructed.
&$rc: RecentChange instance.
$unpatrolled: Whether or not we are showing unpatrolled changes.
$watched: Whether or not the change is watched by the user.
'ContributionsToolLinks': Change tool links above Special:Contributions
$id: User identifier
$title: User page title
@ -580,6 +595,15 @@ $mathRenderer: instance of MathRenderer
$errmsg: error message, in HTML (string). Nonempty indicates failure
of rendering the formula
'MediaWikiPerformAction': Override MediaWiki::performAction().
Use this to do something completely different, after the basic
globals have been set up, but before ordinary actions take place.
$output: $wgOut
$article: $wgArticle
$title: $wgTitle
$user: $wgUser
$request: $wgRequest
'OutputPageBeforeHTML': a page has been processed by the parser and
the resulting HTML is about to be displayed.
$parserOutput: the parserOutput (object) that corresponds to the page
@ -671,6 +695,18 @@ for an example]
&$sktemplate: SkinTemplate object
&$tpl: Template engine object
'SkinTemplateTabAction': Override SkinTemplate::tabAction().
You can either create your own array, or alter the parameters for the normal one.
&$this: The SkinTemplate instance.
$title: Title instance for the page.
$message: Visible label of tab.
$selected: Whether this is a selected tab.
$checkEdit: Whether or not the action=edit query should be added if appropriate.
&$classes: Array of CSS classes to apply.
&$query: Query string to add to link.
&$text: Link text.
&$result: Complete assoc. array if you want to return true.
'SpecialContributionsBeforeMainOutput': Before the form on Special:Contributions
$id: User identifier

View file

@ -176,6 +176,9 @@ class ChangesList {
global $wgContLang;
$articlelink .= $wgContLang->getDirMark();
wfRunHooks('ChangesListInsertArticleLink',
array(&$this, &$articlelink, &$s, &$rc, $unpatrolled, $watched));
$s .= ' '.$articlelink;
}

View file

@ -63,6 +63,10 @@ class OutputPage {
$this->mRedirect = str_replace( "\n", '', $url );
$this->mRedirectCode = $responsecode;
}
public function getRedirect() {
return $this->mRedirect;
}
/**
* Set the HTTP status code to send with the output.

View file

@ -122,6 +122,11 @@ function wfSpecialWatchlist( $par ) {
wfAppendToArrayIfNotDefault( 'hideMinor', (int)$hideMinor, $defaults, $nondefaults );
wfAppendToArrayIfNotDefault('namespace', $nameSpace , $defaults, $nondefaults);
$hookSql = "";
if( ! wfRunHooks('BeforeWatchlist', array($nondefaults, $wgUser, &$hookSql)) ) {
return;
}
if ( $days <= 0 ) {
$andcutoff = '';
} else {
@ -193,6 +198,7 @@ function wfSpecialWatchlist( $par ) {
$andHideBots
$andHideMinor
$nameSpaceClause
$hookSql
ORDER BY rc_timestamp DESC
$limitWatchlist";

View file

@ -371,6 +371,11 @@ class MediaWiki {
wfProfileIn( 'MediaWiki::performAction' );
if ( !wfRunHooks('MediaWikiPerformAction', array($output, $article, $title, $user, $request)) ) {
wfProfileOut( 'MediaWiki::performAction' );
return;
}
$action = $this->getVal('Action');
if( in_array( $action, $this->getVal('DisabledActions',array()) ) ) {
/* No such action; this will switch to the default case */