MediaWiki  master
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  'value' => 'page_title'
93  ],
94  'conds' => [
95  'll_title IS NULL',
96  'page_namespace' => MediaWikiServices::getInstance()->getNamespaceInfo()->
97  getContentNamespaces(),
98  'page_is_redirect' => 0
99  ],
100  'join_conds' => [ 'langlinks' => [ 'LEFT JOIN', 'll_from = page_id' ] ]
101  ];
102  if ( $this->prefix ) {
103  $dbr = wfGetDB( DB_REPLICA );
104  $query['conds'][] = 'page_title ' . $dbr->buildLike( $this->prefix, $dbr->anyString() );
105  }
106 
107  return $query;
108  }
109 
110  protected function getGroupName() {
111  return 'maintenance';
112  }
113 }
null for the local 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:1585
getContext()
Gets the context this SpecialPage is executed in.
$batch execute()
const NS_MAIN
Definition: Defines.php:60
Apache License January AND DISTRIBUTION Definitions License shall mean the terms and conditions for use
either a unescaped string or a HtmlArmor object after in associative array form externallinks including delete and has completed for all link tables whether this was an auto creation use $formDescriptor instead & $formDescriptor
Definition: hooks.txt:2061
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Special page lists pages without language links.
isCached()
Whether or not the output of the page in question is retrieved from the database cache.
Definition: QueryPage.php:233
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 MediaWikiServices
Definition: injection.txt:23
static factory( $displayFormat)
Construct a HTMLForm object for given display type.
Definition: HTMLForm.php:299
__construct( $name='Withoutinterwiki')
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
static capitalize( $text, $ns=NS_MAIN)
Capitalize a text string for a title if it belongs to a namespace that capitalizes.
Definition: Title.php:3161
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:271
Variant of QueryPage which formats the result as a simple link to the page.
const DB_REPLICA
Definition: defines.php:25
getRequest()
Get the WebRequest being used for this instance.