Extension:SplitCategoryPage

From MediaWiki.org

Jump to: navigation, search
Manual on MediaWiki Extensions
List of MediaWiki Extensions
SplitCategoryPage

Release status: experimental

Implementation Page action
Description Extract subcategories on Category page.
Author(s) Jim Hu
Version 0.1 (2007-02-22)
MediaWiki 1.8.3
Download SplitCategoryPage.php
Example GONUTS
Hooks used

CategoryPageView

Contents

[edit] Rationale and Features

SplitCategoryPage.php was written to address two problems with the standard Category Page

  • Bug 1211: In categories with large numbers of articles, subcategories are not displayed unless they fall alphabetically within the chunk of articles being viewed. This can give the user a false sense that a subcategory does not exist.
  • Bug 1212 The number of subcategories and articles shown in the Category Page is the number being viewed, not the total number in the Category.
  • I also didn't like where the paging links are placed when there are subcategories.

SplitCategoryPage.php addresses these problems using obvious but flawed approaches that are discussed in the discussion of both bugs. It uses COUNT(*) to get the correct numbers of subcategories and articles, and it queries the database twice to get all subcategories and a chunk of the articles. For these reasons, SplitCategoryPage.php is significantly slower than the regular Category page. For some applications, however, this speed tradeoff is worth taking, because the display of subcategories is critical to the structure of the wiki. For example, see GONUTS a Gene Ontology Normal Usage Tracking System.

[edit] Status

So far, SplitCategoryPage.php has only been tested with MediaWiki 1.8.3. Help testing this extension on other versions will be appreciated!

[edit] Installation

Unfortunately, SplitCategoryPage.php installation does require one minor hack to the original CategoryPage.php file.

  • Place SplitCategoryPage.php in your extensions directory
  • In ../includes/CategoryPage.php, add require_once("$IP/includes/Article.php"); after
if( !defined( 'MEDIAWIKI' ) )
     die( 1 );

[edit] Alternatives

It may be possible to make a faster version of this functionality using a number of approaches:

  • keeping track of subcategory and article counts in a table and modifying these every time an article is created or saved
  • building a denormalized table containing information from categorylinks and page.

[edit] See also

Personal tools