MediaWiki REL1_35
SpecialWithoutInterwiki.php
Go to the documentation of this file.
1<?php
26
33 private $prefix = '';
34
35 public function __construct( $name = 'Withoutinterwiki' ) {
36 parent::__construct( $name );
37 }
38
39 public function execute( $par ) {
40 $prefix = $this->getRequest()->getVal( 'prefix', $par );
41 $this->prefix = $prefix !== null ? Title::capitalize( $prefix, NS_MAIN ) : '';
42 parent::execute( $par );
43 }
44
45 protected function getPageHeader() {
46 # Do not show useless input form if special page is cached
47 if ( $this->isCached() ) {
48 return '';
49 }
50
51 $formDescriptor = [
52 'prefix' => [
53 'label-message' => 'allpagesprefix',
54 'name' => 'prefix',
55 'id' => 'wiprefix',
56 'type' => 'text',
57 'size' => 20,
58 'default' => $this->prefix
59 ]
60 ];
61
62 $htmlForm = HTMLForm::factory( 'ooui', $formDescriptor, $this->getContext() );
63 $htmlForm->setWrapperLegend( '' )
64 ->setSubmitTextMsg( 'withoutinterwiki-submit' )
65 ->setMethod( 'get' )
66 ->prepareForm()
67 ->displayForm( false );
68 }
69
70 protected function sortDescending() {
71 return false;
72 }
73
74 protected function getOrderFields() {
75 return [ 'page_namespace', 'page_title' ];
76 }
77
78 public function isExpensive() {
79 return true;
80 }
81
82 public function isSyndicated() {
83 return false;
84 }
85
86 public function getQueryInfo() {
87 $query = [
88 'tables' => [ 'page', 'langlinks' ],
89 'fields' => [
90 'namespace' => 'page_namespace',
91 'title' => 'page_title',
92 ],
93 'conds' => [
94 'll_title IS NULL',
95 'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
96 getContentNamespaces(),
97 'page_is_redirect' => 0
98 ],
99 'join_conds' => [ 'langlinks' => [ 'LEFT JOIN', 'll_from = page_id' ] ]
100 ];
101 if ( $this->prefix ) {
103 $query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
104 }
105
106 return $query;
107 }
108
109 protected function getGroupName() {
110 return 'maintenance';
111 }
112}
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
MediaWikiServices is the service locator for the application scope of MediaWiki.
Variant of QueryPage which formats the result as a simple link to the page.
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
getContext()
Gets the context this SpecialPage is executed in.
getRequest()
Get the WebRequest being used for this instance.
Special page lists pages without language links.
sortDescending()
Override to sort by increasing values.
getOrderFields()
Subclasses return an array of fields to order by here.
__construct( $name='Withoutinterwiki')
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
getPageHeader()
The content returned by this function will be output before any result.
execute( $par)
This is the actual workhorse.
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
isSyndicated()
Sometime we don't want to build rss / atom feeds.
const NS_MAIN
Definition Defines.php:70
const DB_REPLICA
Definition defines.php:25