MediaWiki  1.33.1
WikiCategoryPage.php
Go to the documentation of this file.
1 <?php
26 class WikiCategoryPage extends WikiPage {
27 
35  public function hasViewableContent() {
36  if ( parent::hasViewableContent() ) {
37  return true;
38  } else {
39  $cat = Category::newFromTitle( $this->mTitle );
40  // If any of these are not 0, then has members
41  if ( $cat->getPageCount()
42  || $cat->getSubcatCount()
43  || $cat->getFileCount()
44  ) {
45  return true;
46  }
47  }
48  return false;
49  }
50 
58  public function isHidden() {
59  $pageId = $this->getTitle()->getArticleID();
60  $pageProps = PageProps::getInstance()->getProperties( $this->getTitle(), 'hiddencat' );
61 
62  return isset( $pageProps[$pageId] );
63  }
64 
72  public function isExpectedUnusedCategory() {
73  $pageId = $this->getTitle()->getArticleID();
74  $pageProps = PageProps::getInstance()->getProperties( $this->getTitle(), 'expectunusedcategory' );
75 
76  return isset( $pageProps[$pageId] );
77  }
78 }
WikiPage
Class representing a MediaWiki article and history.
Definition: WikiPage.php:45
WikiCategoryPage\isExpectedUnusedCategory
isExpectedUnusedCategory()
Checks if a category is expected to be an unused category.
Definition: WikiCategoryPage.php:72
php
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
Definition: injection.txt:35
WikiCategoryPage
Special handling for category pages.
Definition: WikiCategoryPage.php:26
PageProps\getInstance
static getInstance()
Definition: PageProps.php:66
WikiPage\getTitle
getTitle()
Get the title object of the article.
Definition: WikiPage.php:294
Category\newFromTitle
static newFromTitle( $title)
Factory function.
Definition: Category.php:146
WikiCategoryPage\hasViewableContent
hasViewableContent()
Don't return a 404 for categories in use.
Definition: WikiCategoryPage.php:35
WikiCategoryPage\isHidden
isHidden()
Checks if a category is hidden.
Definition: WikiCategoryPage.php:58