On Fri, Aug 26, 2011 at 12:35, Zach H. <[email protected]> wrote:
> Hello all,
>
> I have created a internal MediaWiki instances holding Knowledge Base
> articles, I am using 4 namespaces (HOWTO, INFO, RTS, TSHOOT) for holding the
> different types of Knowledge Base articles. Previous to 1.17 Categories
> where sorted alphabetically but did include the namespace in the sort, this
> was/is fine as it puts all like type articles together. Now post 1.17 the
> namespace is ignored on the sort and my categories are a mess, is it
> possible to either A) go back to the old method of sorting, or B) Remove the
> namespaces from the titles as listed in the category ? (i think this is
> unlikely but never hurts to ask)
>
>
> TIA
>
> Zach H.

See comments 10, 11 and 17:
https://bugzilla.wikimedia.org/show_bug.cgi?id=29680#c11

You'll need a newer MediaWiki than 1.17 (something that includes
r91510 <http://www.mediawiki.org/wiki/Special:Code/MediaWiki/91510>)
or to patch in that rev to your local copy of 1.17. (the attachment
seems to apply fine with a few harmless warnings e.g. "Hunk #1
succeeded at 4236 (offset -11 lines).")

Then put these 5 lines in the bottom of LocalSettings.php

$wgHooks['GetDefaultSortkey'][] = 'wfFixSortorder';
function wfFixSortorder( $title, &$sortkey ) {
 $sortkey = $title->getPrefixedText();
 return true;
}

And run this script:
http://www.mediawiki.org/wiki/Manual:RefreshLinks.php . If that
doesn't fix it then try
http://www.mediawiki.org/wiki/Manual:Update.php per comment 17 on that
bug linked above?

No guarantee this will work (I haven't tested it) but it seems to have
for the guy in that bug. As always, make a DB backup first.
<http://www.mediawiki.org/wiki/Manual:Backing_up_a_wiki>

-Jeremy
Index: trunk/phase3/docs/hooks.txt
===================================================================
--- trunk/phase3/docs/hooks.txt (revision 91509)
+++ trunk/phase3/docs/hooks.txt (revision 91510)
@@ -862,6 +862,10 @@
 &$cookies: array of cookies name, add a value to it if you want to add a cookie
        that have to vary cache options
 
+'GetDefaultSortkey': Override the default sortkey for a page.
+$title: Title object that we need to get a sortkey for
+&$sortkey: Sortkey to use.
+
 'GetFullURL': modify fully-qualified URLs used in redirects/export/offsite data
 $title: Title object of page
 $url: string value as output (out parameter, can modify)
Index: trunk/phase3/RELEASE-NOTES
===================================================================
--- trunk/phase3/RELEASE-NOTES
+++ trunk/phase3/RELEASE-NOTES
@@ -300,6 +300,8 @@
   the footers of skins.
 * $wgFileCacheDepth can be used to set the depth of the subdirectory hierarchy.
   used for the file cache. Default value is 2, which matches former behavior.
+* (bug 29680) Add GetDefaultSortkey hook to override the default sortkey.
+  (patched locally using upstream mediawiki.org r91510)
 
 === Bug fixes in 1.17 ===

Index: trunk/phase3/includes/Title.php
===================================================================
--- trunk/phase3/includes/Title.php     (revision 91509)
+++ trunk/phase3/includes/Title.php     (revision 91510)
@@ -4247,6 +4247,12 @@
         */
        public function getCategorySortkey( $prefix = '' ) {
                $unprefixed = $this->getText();
+
+               // Anything that uses this hook should only depend
+               // on the Title object passed in, and should probably
+               // tell the users to run updateCollations.php --force
+               // in order to re-sort existing category relations.
+               wfRunHooks( 'GetDefaultSortkey', array( $this, &$unprefixed ) );
                if ( $prefix !== '' ) {
                        # Separate with a line feed, so the unprefixed part is 
only used as
                        # a tiebreaker when two pages have the exact same 
prefix.
_______________________________________________
MediaWiki-l mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-l

Reply via email to