MediaWiki  1.34.0
SpecialWithoutInterwiki.php
Go to the documentation of this file.
1 <?php
26 
33  private $prefix = '';
34 
35  function __construct( $name = 'Withoutinterwiki' ) {
36  parent::__construct( $name );
37  }
38 
39  function execute( $par ) {
40  $this->prefix = Title::capitalize(
41  $this->getRequest()->getVal( 'prefix', $par ), NS_MAIN );
42  parent::execute( $par );
43  }
44 
45  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  function sortDescending() {
71  return false;
72  }
73 
74  function getOrderFields() {
75  return [ 'page_namespace', 'page_title' ];
76  }
77 
78  function isExpensive() {
79  return true;
80  }
81 
82  function isSyndicated() {
83  return false;
84  }
85 
86  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 ) {
102  $dbr = wfGetDB( DB_REPLICA );
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 }
SpecialWithoutInterwiki\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialWithoutInterwiki.php:109
SpecialWithoutInterwiki\isExpensive
isExpensive()
Is this query expensive (for some definition of expensive)? Then we don't let it run in miser mode.
Definition: SpecialWithoutInterwiki.php:78
MediaWiki\MediaWikiServices
MediaWikiServices is the service locator for the application scope of MediaWiki.
Definition: MediaWikiServices.php:117
PageQueryPage
Variant of QueryPage which formats the result as a simple link to the page.
Definition: PageQueryPage.php:33
$dbr
$dbr
Definition: testCompression.php:50
NS_MAIN
const NS_MAIN
Definition: Defines.php:60
QueryPage\isCached
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
Definition: QueryPage.php:258
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2575
SpecialWithoutInterwiki\sortDescending
sortDescending()
Override to sort by increasing values.
Definition: SpecialWithoutInterwiki.php:70
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
SpecialPage\getContext
getContext()
Gets the context this SpecialPage is executed in.
Definition: SpecialPage.php:692
SpecialWithoutInterwiki\__construct
__construct( $name='Withoutinterwiki')
Definition: SpecialWithoutInterwiki.php:35
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:709
SpecialWithoutInterwiki\$prefix
$prefix
Definition: SpecialWithoutInterwiki.php:33
Title\capitalize
static capitalize( $text, $ns=NS_MAIN)
Capitalize a text string for a title if it belongs to a namespace that capitalizes.
Definition: Title.php:3280
SpecialWithoutInterwiki\isSyndicated
isSyndicated()
Sometime we don't want to build rss / atom feeds.
Definition: SpecialWithoutInterwiki.php:82
SpecialWithoutInterwiki\getPageHeader
getPageHeader()
The content returned by this function will be output before any result.
Definition: SpecialWithoutInterwiki.php:45
SpecialWithoutInterwiki\getQueryInfo
getQueryInfo()
Subclasses return an SQL query here, formatted as an array with the following keys: tables => Table(s...
Definition: SpecialWithoutInterwiki.php:86
SpecialWithoutInterwiki\execute
execute( $par)
This is the actual workhorse.
Definition: SpecialWithoutInterwiki.php:39
SpecialWithoutInterwiki\getOrderFields
getOrderFields()
Subclasses return an array of fields to order by here.
Definition: SpecialWithoutInterwiki.php:74
SpecialWithoutInterwiki
Special page lists pages without language links.
Definition: SpecialWithoutInterwiki.php:32
HTMLForm\factory
static factory( $displayFormat,... $arguments)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:303