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