r91510 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r91509‎ | r91510 | r91511 >
Date:00:38, 6 July 2011
Author:bawolff
Status:ok
Tags:
Comment:
(bug 29680, bug 22911) Add GetDeaultSortkey hook in order to override default sortkey used on pages (default is {{PAGENAME}})

Some people want it to default to subpage or to fullpagename this hook would let
them do what they want :)
Modified paths:
  • /trunk/phase3/RELEASE-NOTES-1.19 (modified) (history)
  • /trunk/phase3/docs/hooks.txt (modified) (history)
  • /trunk/phase3/includes/Title.php (modified) (history)

Diff [purge]

Index: trunk/phase3/docs/hooks.txt
@@ -862,6 +862,10 @@
863863 &$cookies: array of cookies name, add a value to it if you want to add a cookie
864864 that have to vary cache options
865865
 866+'GetDefaultSortkey': Override the default sortkey for a page.
 867+$title: Title object that we need to get a sortkey for
 868+&$sortkey: Sortkey to use.
 869+
866870 'GetFullURL': modify fully-qualified URLs used in redirects/export/offsite data
867871 $title: Title object of page
868872 $url: string value as output (out parameter, can modify)
Index: trunk/phase3/RELEASE-NOTES-1.19
@@ -67,6 +67,7 @@
6868 * (bug 5800) Added $formCallback as a parameter to the hook
6969 EditPage::showEditForm:initial
7070 * (bug 29723) mw.util.wikiGetlink() now defaults to wgPageName.
 71+* (bug 29680) Add GetDefaultSortkey hook to override the default sortkey.
7172
7273 === Bug fixes in 1.19 ===
7374 * (bug 28868) Show total pages in the subtitle of an image on the
Index: trunk/phase3/includes/Title.php
@@ -4247,6 +4247,12 @@
42484248 */
42494249 public function getCategorySortkey( $prefix = '' ) {
42504250 $unprefixed = $this->getText();
 4251+
 4252+ // Anything that uses this hook should only depend
 4253+ // on the Title object passed in, and should probably
 4254+ // tell the users to run updateCollations.php --force
 4255+ // in order to re-sort existing category relations.
 4256+ wfRunHooks( 'GetDefaultSortkey', array( $this, &$unprefixed ) );
42514257 if ( $prefix !== '' ) {
42524258 # Separate with a line feed, so the unprefixed part is only used as
42534259 # a tiebreaker when two pages have the exact same prefix.

Follow-up revisions

RevisionCommit summaryAuthorDate
r95382Commit new extension - Allows making the default sortkey part of the subpage ...bawolff06:56, 24 August 2011

Status & tagging log