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