Aus Free Software
Version vom 14. November 2014, 20:02 Uhr von Mati (Diskussion | Beiträge)
(Unterschied) ← Nächstältere Version | Aktuelle Version (Unterschied) | Nächstjüngere Version → (Unterschied)
Zur Navigation springen Zur Suche springen

What it is for

This (trivial) patch to CategoryPage.php causes the namespace to no longer be shown in the list of pages on a category-page.

What it changes

The function makeSizeLinkObj is used to create the html-link. The function is overloaded with the third parameter being an optional link-text. The patch causes CategoryPage.php to pass the unprefixed text to be passed as a link-text.

Download & Apply

The display-patch for various versions of mediawiki can be found at https://github.com/mathiasertl/MediaWiki-patches in the CategoryPage.php directory. Note that, in order to be independent of the Sortkey-patch, this patch is generated without context since MediaWiki-version 1.14.0. This means that you have to be extra-careful to use the right version of this patch. If the exact same MediaWiki-version is not available or you have applied other patches that changed the line numbers before this patch, please refer to the Manual patching-section.

Now you only have to apply the patch. On any Unix-like operating system (like GNU/Linux) you can use the patch-Utility to apply it:

mati@pluto:~/mediawiki-1.14.0/includes $ patch < Display_1.14.0.patch
patching file CategoryPage.php

This example assumes that you are in the "includes/"-directory located in your MediaWiki-installation and you have downloaded the patch into the current directory.

Manual patching

This patch is rather trivial and can be easily applied by hand:

  • Open includes/CategoryPage.php with an editor
  • Locate the function addPage. That function is only a few lines long. To get the approximate location, you can refer to patches with a similar or the same version.
  • In that function there is a call to makeSizeLinkObj. That function uses two parameters but in fact has an optional third parameter that defines a link-text. In our case, that parameter is $title->getText().
  • So to summarize, the old line looks like this:
: $this->getSkin()->makeSizeLinkObj( $pageLength, $title );
while the new line looks like this:
: $this->getSkin()->makeSizeLinkObj( $pageLength, $title, $title->getText() );

Generating the patch

This is more of chapter for me, the patch-maintainer: To generate this patch, use diff -U 0 CategoryPage.php.orig CategoryPage.php.