96dcef20b52f073aabf6f27c4319238233cad62b
[lhc/web/wiklou.git] / includes / WikiCategoryPage.php
1 <?php
2 /**
3 * Special handling for category pages
4 */
5 class WikiCategoryPage extends WikiPage {
6
7 public function __construct( Title $title ) {
8 $this->mTitle = $title;
9 }
10
11 /**
12 * Don't return a 404 for categories in use.
13 * In use defined as: either the actual page exists
14 * or the category currently has members.
15 *
16 * @return bool
17 */
18 public function hasViewableContent() {
19 if ( parent::hasViewableContent() ) {
20 return true;
21 } else {
22 $cat = Category::newFromTitle( $this->mTitle );
23 // If any of these are not 0, then has members
24 if ( $cat->getPageCount()
25 || $cat->getSubcatCount()
26 || $cat->getFileCount()
27 ) {
28 return true;
29 }
30 }
31 return false;
32 }
33 }