MediaWiki  master
SpecialUncategorizedPages.php
Go to the documentation of this file.
1 <?php
27 
36  protected $requestedNamespace = false;
37 
39  private $namespaceInfo;
40 
47  public function __construct(
48  NamespaceInfo $namespaceInfo,
49  ILoadBalancer $loadBalancer,
50  LinkBatchFactory $linkBatchFactory,
51  LanguageConverterFactory $languageConverterFactory
52  ) {
53  parent::__construct( 'Uncategorizedpages' );
54  $this->namespaceInfo = $namespaceInfo;
55  $this->setDBLoadBalancer( $loadBalancer );
56  $this->setLinkBatchFactory( $linkBatchFactory );
57  $this->setLanguageConverter( $languageConverterFactory->getLanguageConverter( $this->getContentLanguage() ) );
58  }
59 
60  protected function sortDescending() {
61  return false;
62  }
63 
64  public function isExpensive() {
65  return true;
66  }
67 
68  public function isSyndicated() {
69  return false;
70  }
71 
72  public function execute( $par ) {
73  $this->addHelpLink( 'Help:Categories' );
74  parent::execute( $par );
75  }
76 
77  public function getQueryInfo() {
78  return [
79  'tables' => [ 'page', 'categorylinks' ],
80  'fields' => [
81  'namespace' => 'page_namespace',
82  'title' => 'page_title',
83  ],
84  // default for page_namespace is all content namespaces (if requestedNamespace is false)
85  // otherwise, page_namespace is requestedNamespace
86  'conds' => [
87  'cl_from IS NULL',
88  'page_namespace' => $this->requestedNamespace !== false
89  ? $this->requestedNamespace
90  : $this->namespaceInfo->getContentNamespaces(),
91  'page_is_redirect' => 0
92  ],
93  'join_conds' => [
94  'categorylinks' => [ 'LEFT JOIN', 'cl_from = page_id' ]
95  ]
96  ];
97  }
98 
99  protected function getOrderFields() {
100  // For some crazy reason ordering by a constant
101  // causes a filesort
102  if ( $this->requestedNamespace === false &&
103  count( $this->namespaceInfo->getContentNamespaces() ) > 1
104  ) {
105  return [ 'page_namespace', 'page_title' ];
106  }
107 
108  return [ 'page_title' ];
109  }
110 
111  protected function getGroupName() {
112  return 'maintenance';
113  }
114 }
An interface for creating language converters.
getLanguageConverter( $language=null)
Provide a LanguageConverter for given language.
This is a utility class for dealing with namespaces that encodes all the "magic" behaviors of them ba...
Variant of QueryPage which formats the result as a simple link to the page.
setLanguageConverter(ILanguageConverter $languageConverter)
setDBLoadBalancer(ILoadBalancer $loadBalancer)
Definition: QueryPage.php:916
setLinkBatchFactory(LinkBatchFactory $linkBatchFactory)
Definition: QueryPage.php:136
addHelpLink( $to, $overrideBaseUrl=false)
Adds help link with an icon via page indicators.
A special page looking for page without any category.
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
execute( $par)
This is the actual workhorse.
isExpensive()
Should this query page only be updated offline on large wikis?
__construct(NamespaceInfo $namespaceInfo, ILoadBalancer $loadBalancer, LinkBatchFactory $linkBatchFactory, LanguageConverterFactory $languageConverterFactory)
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
getOrderFields()
Subclasses return an array of fields to order by here.
isSyndicated()
Sometimes we don't want to build rss / atom feeds.
sortDescending()
Override to sort by increasing values.
Create and track the database connections and transactions for a given database cluster.