diff options
author | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
---|---|---|
committer | Pierre Schmitz <pierre@archlinux.de> | 2011-12-03 13:29:22 +0100 |
commit | ca32f08966f1b51fcb19460f0996bb0c4048e6fe (patch) | |
tree | ec04cc15b867bc21eedca904cea9af0254531a11 /includes/WikiCategoryPage.php | |
parent | a22fbfc60f36f5f7ee10d5ae6fe347340c2ee67c (diff) |
Update to MediaWiki 1.18.0
* also update ArchLinux skin to chagnes in MonoBook
* Use only css to hide our menu bar when printing
Diffstat (limited to 'includes/WikiCategoryPage.php')
-rw-r--r-- | includes/WikiCategoryPage.php | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/includes/WikiCategoryPage.php b/includes/WikiCategoryPage.php new file mode 100644 index 00000000..42c2a6ce --- /dev/null +++ b/includes/WikiCategoryPage.php @@ -0,0 +1,37 @@ +<?php +/** + * Special handling for category pages + */ +class WikiCategoryPage extends WikiPage { + /** + * Constructor from a page id + * @param $id Int article ID to load + */ + public static function newFromID( $id ) { + $t = Title::newFromID( $id ); + # @todo FIXME: Doesn't inherit right + return $t == null ? null : new self( $t ); + # return $t == null ? null : new static( $t ); // PHP 5.3 + } + + /** + * Don't return a 404 for categories in use. + * In use defined as: either the actual page exists + * or the category currently has members. + */ + public function hasViewableContent() { + if ( parent::hasViewableContent() ) { + return true; + } else { + $cat = Category::newFromTitle( $this->mTitle ); + // If any of these are not 0, then has members + if ( $cat->getPageCount() + || $cat->getSubcatCount() + || $cat->getFileCount() + ) { + return true; + } + } + return false; + } +} |