r101096 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r101095‎ | r101096 | r101097 >
Date:23:55, 27 October 2011
Author:mah
Status:ok
Tags:
Comment:
Fixes Bug #6793 — “New Variable __NEWSECTIONS__ like __TOC__” by
adding Nx.devnull's patch that adds a hook needed by
Extension:PlaceNewSection.
Modified paths:
  • /trunk/phase3/CREDITS (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/WikiPage.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -1475,6 +1475,13 @@
14761476 Change $result and return false to give a definitive answer, otherwise
14771477 the built-in rate limiting checks are used, if enabled.
14781478
 1479+'PlaceNewSection': Override placement of new sections.
 1480+$wikipage : WikiPage object
 1481+$oldtext : the text of the article before editing
 1482+$subject : subject of the new section
 1483+&$text : text of the new section
 1484+Return false and put the merged text into $text to override the default behavior.
 1485+
14791486 'PrefixSearchBackend': Override the title prefix search used for OpenSearch and
14801487 AJAX search suggestions. Put results into &$results outparam and return false.
14811488 $ns : array of int namespace keys to search in
Index: trunk/phase3/CREDITS
@@ -139,6 +139,7 @@
140140 * Nathan Larson
141141 * nephele
142142 * Nik
 143+* Nx.devnull
143144 * Nikolaos S. Karastathis
144145 * Olaf Lenz
145146 * Paul Copperman
Index: trunk/phase3/includes/WikiPage.php
@@ -977,9 +977,11 @@
978978 if ( $section == 'new' ) {
979979 # Inserting a new section
980980 $subject = $summary ? wfMsgForContent( 'newsectionheaderdefaultlevel', $summary ) . "\n\n" : '';
981 - $text = strlen( trim( $oldtext ) ) > 0
 981+ if ( wfRunHooks( 'PlaceNewSection', array( $this, $oldtext, $subject, &$text ) ) ) {
 982+ $text = strlen( trim( $oldtext ) ) > 0
982983 ? "{$oldtext}\n\n{$subject}{$text}"
983984 : "{$subject}{$text}";
 985+ }
984986 } else {
985987 # Replacing an existing section; roll out the big guns
986988 global $wgParser;

Status & tagging log