MediaWiki  1.32.0
SpecialInterwiki.php
Go to the documentation of this file.
1 <?php
2 
4 
13  public function __construct() {
14  parent::__construct( 'Interwiki' );
15  }
16 
17  public function doesWrites() {
18  return true;
19  }
20 
26  function getDescription() {
27  return $this->msg( $this->canModify() ?
28  'interwiki' : 'interwiki-title-norights' )->plain();
29  }
30 
31  public function getSubpagesForPrefixSearch() {
32  // delete, edit both require the prefix parameter.
33  return [ 'add' ];
34  }
35 
41  public function execute( $par ) {
42  $this->setHeaders();
43  $this->outputHeader();
44 
45  $out = $this->getOutput();
46  $request = $this->getRequest();
47 
48  $out->addModuleStyles( 'ext.interwiki.specialpage' );
49 
50  $action = $par ?: $request->getVal( 'action', $par );
51  $return = $this->getPageTitle();
52 
53  switch ( $action ) {
54  case 'delete':
55  case 'edit':
56  case 'add':
57  if ( $this->canModify( $out ) ) {
58  $this->showForm( $action );
59  }
60  $out->returnToMain( false, $return );
61  break;
62  case 'submit':
63  if ( !$this->canModify( $out ) ) {
64  // Error msg added by canModify()
65  } elseif ( !$request->wasPosted() ||
66  !$this->getUser()->matchEditToken( $request->getVal( 'wpEditToken' ) )
67  ) {
68  // Prevent cross-site request forgeries
69  $out->addWikiMsg( 'sessionfailure' );
70  } else {
71  $this->doSubmit();
72  }
73  $out->returnToMain( false, $return );
74  break;
75  default:
76  $this->showList();
77  break;
78  }
79  }
80 
87  public function canModify( $out = false ) {
88  global $wgInterwikiCache;
89  if ( !$this->getUser()->isAllowed( 'interwiki' ) ) {
90  // Check permissions
91  if ( $out ) {
92  throw new PermissionsError( 'interwiki' );
93  }
94 
95  return false;
96  } elseif ( $wgInterwikiCache ) {
97  // Editing the interwiki cache is not supported
98  if ( $out ) {
99  $out->addWikiMsg( 'interwiki-cached' );
100  }
101 
102  return false;
103  } elseif ( wfReadOnly() ) {
104  throw new ReadOnlyError;
105  }
106 
107  return true;
108  }
109 
113  protected function showForm( $action ) {
114  $request = $this->getRequest();
115 
116  $prefix = $request->getVal( 'prefix' );
117  $wpPrefix = '';
118  $label = [ 'class' => 'mw-label' ];
119  $input = [ 'class' => 'mw-input' ];
120 
121  if ( $action === 'delete' ) {
122  $topmessage = $this->msg( 'interwiki_delquestion', $prefix )->text();
123  $intromessage = $this->msg( 'interwiki_deleting', $prefix )->escaped();
124  $wpPrefix = Html::hidden( 'wpInterwikiPrefix', $prefix );
125  $button = 'delete';
126  $formContent = '';
127  } elseif ( $action === 'edit' ) {
128  $dbr = wfGetDB( DB_REPLICA );
129  $row = $dbr->selectRow( 'interwiki', '*', [ 'iw_prefix' => $prefix ], __METHOD__ );
130 
131  if ( !$row ) {
132  $this->error( 'interwiki_editerror', $prefix );
133  return;
134  }
135 
136  $prefix = $prefixElement = $row->iw_prefix;
137  $defaulturl = $row->iw_url;
138  $trans = $row->iw_trans;
139  $local = $row->iw_local;
140  $wpPrefix = Html::hidden( 'wpInterwikiPrefix', $row->iw_prefix );
141  $topmessage = $this->msg( 'interwiki_edittext' )->text();
142  $intromessage = $this->msg( 'interwiki_editintro' )->escaped();
143  $button = 'edit';
144  } elseif ( $action === 'add' ) {
145  $prefix = $request->getVal( 'wpInterwikiPrefix', $request->getVal( 'prefix' ) );
146  $prefixElement = Xml::input( 'wpInterwikiPrefix', 20, $prefix,
147  [ 'tabindex' => 1, 'id' => 'mw-interwiki-prefix', 'maxlength' => 20 ] );
148  $local = $request->getCheck( 'wpInterwikiLocal' );
149  $trans = $request->getCheck( 'wpInterwikiTrans' );
150  $defaulturl = $request->getVal( 'wpInterwikiURL', $this->msg( 'interwiki-defaulturl' )->text() );
151  $topmessage = $this->msg( 'interwiki_addtext' )->text();
152  $intromessage = $this->msg( 'interwiki_addintro' )->escaped();
153  $button = 'interwiki_addbutton';
154  }
155 
156  if ( $action === 'add' || $action === 'edit' ) {
157  $formContent = Html::rawElement( 'tr', null,
158  Html::element( 'td', $label, $this->msg( 'interwiki-prefix-label' )->text() ) .
159  Html::rawElement( 'td', null, '<code>' . $prefixElement . '</code>' )
160  ) . Html::rawElement(
161  'tr',
162  null,
164  'td',
165  $label,
166  Xml::label( $this->msg( 'interwiki-local-label' )->text(), 'mw-interwiki-local' )
167  ) .
169  'td',
170  $input,
171  Xml::check( 'wpInterwikiLocal', $local, [ 'id' => 'mw-interwiki-local' ] )
172  )
173  ) . Html::rawElement( 'tr', null,
175  'td',
176  $label,
177  Xml::label( $this->msg( 'interwiki-trans-label' )->text(), 'mw-interwiki-trans' )
178  ) .
180  'td',
181  $input, Xml::check( 'wpInterwikiTrans', $trans, [ 'id' => 'mw-interwiki-trans' ] ) )
182  ) . Html::rawElement( 'tr', null,
184  'td',
185  $label,
186  Xml::label( $this->msg( 'interwiki-url-label' )->text(), 'mw-interwiki-url' )
187  ) .
188  Html::rawElement( 'td', $input, Xml::input( 'wpInterwikiURL', 60, $defaulturl,
189  [ 'tabindex' => 1, 'maxlength' => 200, 'id' => 'mw-interwiki-url' ] ) )
190  );
191  }
192 
193  $form = Xml::fieldset( $topmessage, Html::rawElement(
194  'form',
195  [
196  'id' => "mw-interwiki-{$action}form",
197  'method' => 'post',
198  'action' => $this->getPageTitle()->getLocalURL( [
199  'action' => 'submit',
200  'prefix' => $prefix
201  ] )
202  ],
203  Html::rawElement( 'p', null, $intromessage ) .
204  Html::rawElement( 'table', [ 'id' => "mw-interwiki-{$action}" ],
205  $formContent . Html::rawElement( 'tr', null,
206  Html::rawElement( 'td', $label, Xml::label( $this->msg( 'interwiki_reasonfield' )->text(),
207  "mw-interwiki-{$action}reason" ) ) .
208  Html::rawElement( 'td', $input, Xml::input( 'wpInterwikiReason', 60, '',
209  [ 'tabindex' => 1, 'id' => "mw-interwiki-{$action}reason", 'maxlength' => 200 ] ) )
210  ) . Html::rawElement( 'tr', null,
211  Html::rawElement( 'td', null, '' ) .
212  Html::rawElement( 'td', [ 'class' => 'mw-submit' ],
213  Xml::submitButton( $this->msg( $button )->text(), [ 'id' => 'mw-interwiki-submit' ] ) )
214  ) . $wpPrefix .
215  Html::hidden( 'wpEditToken', $this->getUser()->getEditToken() ) .
216  Html::hidden( 'wpInterwikiAction', $action )
217  )
218  ) );
219  $this->getOutput()->addHTML( $form );
220  }
221 
222  protected function doSubmit() {
223  global $wgContLang;
224 
225  $request = $this->getRequest();
226  $prefix = $request->getVal( 'wpInterwikiPrefix' );
227  $do = $request->getVal( 'wpInterwikiAction' );
228  // Show an error if the prefix is invalid (only when adding one).
229  // Invalid characters for a title should also be invalid for a prefix.
230  // Whitespace, ':', '&' and '=' are invalid, too.
231  // (Bug 30599).
232  global $wgLegalTitleChars;
233  $validPrefixChars = preg_replace( '/[ :&=]/', '', $wgLegalTitleChars );
234  if ( $do === 'add' && preg_match( "/\s|[^$validPrefixChars]/", $prefix ) ) {
235  $this->error( 'interwiki-badprefix', htmlspecialchars( $prefix ) );
236  $this->showForm( $do );
237  return;
238  }
239  $reason = $request->getText( 'wpInterwikiReason' );
240  $selfTitle = $this->getPageTitle();
241  $lookup = MediaWikiServices::getInstance()->getInterwikiLookup();
242  $dbw = wfGetDB( DB_MASTER );
243  switch ( $do ) {
244  case 'delete':
245  $dbw->delete( 'interwiki', [ 'iw_prefix' => $prefix ], __METHOD__ );
246 
247  if ( $dbw->affectedRows() === 0 ) {
248  $this->error( 'interwiki_delfailed', $prefix );
249  $this->showForm( $do );
250  } else {
251  $this->getOutput()->addWikiMsg( 'interwiki_deleted', $prefix );
252  $log = new LogPage( 'interwiki' );
253  $log->addEntry( 'iw_delete', $selfTitle, $reason, [ $prefix ] );
254  $lookup->invalidateCache( $prefix );
255  }
256  break;
258  case 'add':
259  $prefix = $wgContLang->lc( $prefix );
260  case 'edit':
261  $theurl = $request->getVal( 'wpInterwikiURL' );
262  $local = $request->getCheck( 'wpInterwikiLocal' ) ? 1 : 0;
263  $trans = $request->getCheck( 'wpInterwikiTrans' ) ? 1 : 0;
264  $data = [
265  'iw_prefix' => $prefix,
266  'iw_url' => $theurl,
267  'iw_local' => $local,
268  'iw_trans' => $trans
269  ];
270 
271  if ( $prefix === '' || $theurl === '' ) {
272  $this->error( 'interwiki-submit-empty' );
273  $this->showForm( $do );
274  return;
275  }
276 
277  // Simple URL validation: check that the protocol is one of
278  // the supported protocols for this wiki.
279  // (bug 30600)
280  if ( !wfParseUrl( $theurl ) ) {
281  $this->error( 'interwiki-submit-invalidurl' );
282  $this->showForm( $do );
283  return;
284  }
285 
286  if ( $do === 'add' ) {
287  $dbw->insert( 'interwiki', $data, __METHOD__, 'IGNORE' );
288  } else { // $do === 'edit'
289  $dbw->update( 'interwiki', $data, [ 'iw_prefix' => $prefix ], __METHOD__, 'IGNORE' );
290  }
291 
292  // used here: interwiki_addfailed, interwiki_added, interwiki_edited
293  if ( $dbw->affectedRows() === 0 ) {
294  $this->error( "interwiki_{$do}failed", $prefix );
295  $this->showForm( $do );
296  } else {
297  $this->getOutput()->addWikiMsg( "interwiki_{$do}ed", $prefix );
298  $log = new LogPage( 'interwiki' );
299  $log->addEntry( 'iw_' . $do, $selfTitle, $reason, [ $prefix, $theurl, $trans, $local ] );
300  $lookup->invalidateCache( $prefix );
301  }
302  break;
303  }
304  }
305 
306  protected function showList() {
307  global $wgInterwikiCentralDB, $wgInterwikiViewOnly;
308  $canModify = $this->canModify();
309 
310  // Build lists
311  $lookup = MediaWikiServices::getInstance()->getInterwikiLookup();
312  $iwPrefixes = $lookup->getAllPrefixes( null );
313  $iwGlobalPrefixes = [];
314  if ( $wgInterwikiCentralDB !== null && $wgInterwikiCentralDB !== wfWikiID() ) {
315  // Fetch list from global table
316  $dbrCentralDB = wfGetDB( DB_REPLICA, [], $wgInterwikiCentralDB );
317  $res = $dbrCentralDB->select( 'interwiki', '*', false, __METHOD__ );
318  $retval = [];
319  foreach ( $res as $row ) {
320  $row = (array)$row;
321  if ( !Language::fetchLanguageName( $row['iw_prefix'] ) ) {
322  $retval[] = $row;
323  }
324  }
325  $iwGlobalPrefixes = $retval;
326  }
327 
328  // Split out language links
329  $iwLocalPrefixes = [];
330  $iwLanguagePrefixes = [];
331  foreach ( $iwPrefixes as $iwPrefix ) {
332  if ( Language::fetchLanguageName( $iwPrefix['iw_prefix'] ) ) {
333  $iwLanguagePrefixes[] = $iwPrefix;
334  } else {
335  $iwLocalPrefixes[] = $iwPrefix;
336  }
337  }
338 
339  // Page intro content
340  $this->getOutput()->addWikiMsg( 'interwiki_intro' );
341 
342  // Add 'view log' link when possible
343  if ( $wgInterwikiViewOnly === false ) {
344  $logLink = $this->getLinkRenderer()->makeLink(
345  SpecialPage::getTitleFor( 'Log', 'interwiki' ),
346  $this->msg( 'interwiki-logtext' )->text()
347  );
348  $this->getOutput()->addHTML( '<p class="mw-interwiki-log">' . $logLink . '</p>' );
349  }
350 
351  // Add 'add' link
352  if ( $canModify ) {
353  if ( count( $iwGlobalPrefixes ) !== 0 ) {
354  $addtext = $this->msg( 'interwiki-addtext-local' )->text();
355  } else {
356  $addtext = $this->msg( 'interwiki_addtext' )->text();
357  }
358  $addlink = $this->getLinkRenderer()->makeKnownLink(
359  $this->getPageTitle( 'add' ), $addtext );
360  $this->getOutput()->addHTML(
361  '<p class="mw-interwiki-addlink">' . $addlink . '</p>' );
362  }
363 
364  $this->getOutput()->addWikiMsg( 'interwiki-legend' );
365 
366  if ( ( !is_array( $iwPrefixes ) || count( $iwPrefixes ) === 0 ) &&
367  ( !is_array( $iwGlobalPrefixes ) || count( $iwGlobalPrefixes ) === 0 )
368  ) {
369  // If the interwiki table(s) are empty, display an error message
370  $this->error( 'interwiki_error' );
371  return;
372  }
373 
374  // Add the global table
375  if ( count( $iwGlobalPrefixes ) !== 0 ) {
376  $this->getOutput()->addHTML(
377  '<h2 id="interwikitable-global">' .
378  $this->msg( 'interwiki-global-links' )->parse() .
379  '</h2>'
380  );
381  $this->getOutput()->addWikiMsg( 'interwiki-global-description' );
382 
383  // $canModify is false here because this is just a display of remote data
384  $this->makeTable( false, $iwGlobalPrefixes );
385  }
386 
387  // Add the local table
388  if ( count( $iwLocalPrefixes ) !== 0 ) {
389  if ( count( $iwGlobalPrefixes ) !== 0 ) {
390  $this->getOutput()->addHTML(
391  '<h2 id="interwikitable-local">' .
392  $this->msg( 'interwiki-local-links' )->parse() .
393  '</h2>'
394  );
395  $this->getOutput()->addWikiMsg( 'interwiki-local-description' );
396  } else {
397  $this->getOutput()->addHTML(
398  '<h2 id="interwikitable-local">' .
399  $this->msg( 'interwiki-links' )->parse() .
400  '</h2>'
401  );
402  $this->getOutput()->addWikiMsg( 'interwiki-description' );
403  }
404  $this->makeTable( $canModify, $iwLocalPrefixes );
405  }
406 
407  // Add the language table
408  if ( count( $iwLanguagePrefixes ) !== 0 ) {
409  $this->getOutput()->addHTML(
410  '<h2 id="interwikitable-language">' .
411  $this->msg( 'interwiki-language-links' )->parse() .
412  '</h2>'
413  );
414  $this->getOutput()->addWikiMsg( 'interwiki-language-description' );
415 
416  $this->makeTable( $canModify, $iwLanguagePrefixes );
417  }
418  }
419 
420  protected function makeTable( $canModify, $iwPrefixes ) {
421  // Output the existing Interwiki prefixes table header
422  $out = '';
424  'table',
425  [ 'class' => 'mw-interwikitable wikitable sortable body' ]
426  ) . "\n";
427  $out .= Html::openElement( 'tr', [ 'class' => 'interwikitable-header' ] ) .
428  Html::element( 'th', null, $this->msg( 'interwiki_prefix' )->text() ) .
429  Html::element( 'th', null, $this->msg( 'interwiki_url' )->text() ) .
430  Html::element( 'th', null, $this->msg( 'interwiki_local' )->text() ) .
431  Html::element( 'th', null, $this->msg( 'interwiki_trans' )->text() ) .
432  ( $canModify ?
434  'th',
435  [ 'class' => 'unsortable' ],
436  $this->msg( 'interwiki_edit' )->text()
437  ) :
438  ''
439  );
440  $out .= Html::closeElement( 'tr' ) . "\n";
441 
442  $selfTitle = $this->getPageTitle();
443 
444  // Output the existing Interwiki prefixes table rows
445  foreach ( $iwPrefixes as $iwPrefix ) {
446  $out .= Html::openElement( 'tr', [ 'class' => 'mw-interwikitable-row' ] );
447  $out .= Html::element( 'td', [ 'class' => 'mw-interwikitable-prefix' ],
448  $iwPrefix['iw_prefix'] );
449  $out .= Html::element(
450  'td',
451  [ 'class' => 'mw-interwikitable-url' ],
452  $iwPrefix['iw_url']
453  );
454  $attribs = [ 'class' => 'mw-interwikitable-local' ];
455  // Green background for cells with "yes".
456  if ( isset( $iwPrefix['iw_local'] ) && $iwPrefix['iw_local'] ) {
457  $attribs['class'] .= ' mw-interwikitable-local-yes';
458  }
459  // The messages interwiki_0 and interwiki_1 are used here.
460  $contents = isset( $iwPrefix['iw_local'] ) ?
461  $this->msg( 'interwiki_' . $iwPrefix['iw_local'] )->text() :
462  '-';
463  $out .= Html::element( 'td', $attribs, $contents );
464  $attribs = [ 'class' => 'mw-interwikitable-trans' ];
465  // Green background for cells with "yes".
466  if ( isset( $iwPrefix['iw_trans'] ) && $iwPrefix['iw_trans'] ) {
467  $attribs['class'] .= ' mw-interwikitable-trans-yes';
468  }
469  // The messages interwiki_0 and interwiki_1 are used here.
470  $contents = isset( $iwPrefix['iw_trans'] ) ?
471  $this->msg( 'interwiki_' . $iwPrefix['iw_trans'] )->text() :
472  '-';
473  $out .= Html::element( 'td', $attribs, $contents );
474 
475  // Additional column when the interwiki table can be modified.
476  if ( $canModify ) {
477  $out .= Html::rawElement( 'td', [ 'class' => 'mw-interwikitable-modify' ],
478  $this->getLinkRenderer()->makeKnownLink(
479  $selfTitle,
480  $this->msg( 'edit' )->text(),
481  [],
482  [ 'action' => 'edit', 'prefix' => $iwPrefix['iw_prefix'] ]
483  ) .
484  $this->msg( 'comma-separator' ) .
485  $this->getLinkRenderer()->makeKnownLink(
486  $selfTitle,
487  $this->msg( 'delete' )->text(),
488  [],
489  [ 'action' => 'delete', 'prefix' => $iwPrefix['iw_prefix'] ]
490  )
491  );
492  }
493  $out .= Html::closeElement( 'tr' ) . "\n";
494  }
495  $out .= Html::closeElement( 'table' );
496 
497  $this->getOutput()->addHTML( $out );
498  }
499 
500  protected function error() {
501  $args = func_get_args();
502  $this->getOutput()->wrapWikiMsg( "<p class='error'>$1</p>", $args );
503  }
504 
505  protected function getGroupName() {
506  return 'wiki';
507  }
508 }
ReadOnlyError
Show an error when the wiki is locked/read-only and the user tries to do something that requires writ...
Definition: ReadOnlyError.php:28
SpecialPage\getPageTitle
getPageTitle( $subpage=false)
Get a self-referential title object.
Definition: SpecialPage.php:678
Language\fetchLanguageName
static fetchLanguageName( $code, $inLanguage=self::AS_AUTONYMS, $include=self::ALL)
Definition: Language.php:940
SpecialPage\msg
msg( $key)
Wrapper around wfMessage that sets the current context.
Definition: SpecialPage.php:796
SpecialPage\getOutput
getOutput()
Get the OutputPage being used for this instance.
Definition: SpecialPage.php:725
$wgLegalTitleChars
$wgLegalTitleChars
Allowed title characters – regex character class Don't change this unless you know what you're doing.
Definition: DefaultSettings.php:3930
Xml\label
static label( $label, $id, $attribs=[])
Convenience function to build an HTML form label.
Definition: Xml.php:360
captcha-old.count
count
Definition: captcha-old.py:249
$wgInterwikiCache
bool array string $wgInterwikiCache
Interwiki cache, either as an associative array or a path to a constant database (....
Definition: DefaultSettings.php:3977
wfReadOnly
wfReadOnly()
Check whether the wiki is in read-only mode.
Definition: GlobalFunctions.php:1237
SpecialPage\getTitleFor
static getTitleFor( $name, $subpage=false, $fragment='')
Get a localised Title object for a specified special page name If you don't need a full Title object,...
Definition: SpecialPage.php:82
SpecialInterwiki\__construct
__construct()
Constructor - sets up the new special page.
Definition: SpecialInterwiki.php:13
$res
$res
Definition: database.txt:21
PermissionsError
Show an error when a user tries to do something they do not have the necessary permissions for.
Definition: PermissionsError.php:28
SpecialInterwiki\makeTable
makeTable( $canModify, $iwPrefixes)
Definition: SpecialInterwiki.php:420
SpecialInterwiki\doSubmit
doSubmit()
Definition: SpecialInterwiki.php:222
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
$dbr
$dbr
Definition: testCompression.php:50
Xml\fieldset
static fieldset( $legend=false, $content=false, $attribs=[])
Shortcut for creating fieldsets.
Definition: Xml.php:611
Html\closeElement
static closeElement( $element)
Returns "</$element>".
Definition: Html.php:310
wfParseUrl
wfParseUrl( $url)
parse_url() work-alike, but non-broken.
Definition: GlobalFunctions.php:814
SpecialInterwiki\getDescription
getDescription()
Different description will be shown on Special:SpecialPage depending on whether the user can modify t...
Definition: SpecialInterwiki.php:26
SpecialInterwiki\doesWrites
doesWrites()
Indicates whether this special page may perform database writes.
Definition: SpecialInterwiki.php:17
SpecialInterwiki\showForm
showForm( $action)
Definition: SpecialInterwiki.php:113
wfGetDB
wfGetDB( $db, $groups=[], $wiki=false)
Get a Database object.
Definition: GlobalFunctions.php:2693
$input
if(is_array( $mode)) switch( $mode) $input
Definition: postprocess-phan.php:141
Xml\check
static check( $name, $checked=false, $attribs=[])
Convenience function to build an HTML checkbox.
Definition: Xml.php:325
$attribs
null means default in associative array with keys and values unescaped Should be merged with default with a value of false meaning to suppress the attribute in associative array with keys and values unescaped noclasses just before the function returns a value If you return an< a > element with HTML attributes $attribs and contents $html will be returned If you return $ret will be returned and may include noclasses after processing & $attribs
Definition: hooks.txt:2036
LogPage
Class to simplify the use of log pages.
Definition: LogPage.php:33
use
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
Definition: MIT-LICENSE.txt:10
SpecialInterwiki\showList
showList()
Definition: SpecialInterwiki.php:306
SpecialPage\setHeaders
setHeaders()
Sets headers - this should be called from the execute() method of all derived classes!
Definition: SpecialPage.php:531
SpecialPage\getUser
getUser()
Shortcut to get the User executing this instance.
Definition: SpecialPage.php:735
DB_REPLICA
const DB_REPLICA
Definition: defines.php:25
DB_MASTER
const DB_MASTER
Definition: defines.php:26
array
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
SpecialInterwiki\error
error()
Definition: SpecialInterwiki.php:500
$request
do that in ParserLimitReportFormat instead use this to modify the parameters of the image all existing parser cache entries will be invalid To avoid you ll need to handle that somehow(e.g. with the RejectParserCacheValue hook) because MediaWiki won 't do it for you. & $defaults also a ContextSource after deleting those rows but within the same transaction you ll probably need to make sure the header is varied on $request
Definition: hooks.txt:2675
Html\hidden
static hidden( $name, $value, array $attribs=[])
Convenience function to produce an input element with type=hidden.
Definition: Html.php:795
wfWikiID
wfWikiID()
Get an ASCII string identifying this wiki This is used as a prefix in memcached keys.
Definition: GlobalFunctions.php:2644
SpecialPage
Parent class for all special pages.
Definition: SpecialPage.php:36
$retval
please add to it if you re going to add events to the MediaWiki code where normally authentication against an external auth plugin would be creating a account incomplete not yet checked for validity & $retval
Definition: hooks.txt:244
SpecialInterwiki
Implements Special:Interwiki.
Definition: SpecialInterwiki.php:9
SpecialPage\getRequest
getRequest()
Get the WebRequest being used for this instance.
Definition: SpecialPage.php:715
SpecialInterwiki\execute
execute( $par)
Show the special page.
Definition: SpecialInterwiki.php:41
SpecialPage\getLinkRenderer
getLinkRenderer()
Definition: SpecialPage.php:908
text
This list may contain false positives That usually means there is additional text with links below the first Each row contains links to the first and second as well as the first line of the second redirect text
Definition: All_system_messages.txt:1267
$args
if( $line===false) $args
Definition: cdb.php:64
as
This document is intended to provide useful advice for parties seeking to redistribute MediaWiki to end users It s targeted particularly at maintainers for Linux since it s been observed that distribution packages of MediaWiki often break We ve consistently had to recommend that users seeking support use official tarballs instead of their distribution s and this often solves whatever problem the user is having It would be nice if this could such as
Definition: distributors.txt:9
Html\openElement
static openElement( $element, $attribs=[])
Identical to rawElement(), but has no third parameter and omits the end tag (and the self-closing '/'...
Definition: Html.php:252
Html\rawElement
static rawElement( $element, $attribs=[], $contents='')
Returns an HTML element in a string.
Definition: Html.php:210
SpecialInterwiki\getGroupName
getGroupName()
Under which header this special page is listed in Special:SpecialPages See messages 'specialpages-gro...
Definition: SpecialInterwiki.php:505
Xml\input
static input( $name, $size=false, $value=false, $attribs=[])
Convenience function to build an HTML text input field.
Definition: Xml.php:276
Html\element
static element( $element, $attribs=[], $contents='')
Identical to rawElement(), but HTML-escapes $contents (like Xml::element()).
Definition: Html.php:232
MediaWikiServices
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
SpecialInterwiki\canModify
canModify( $out=false)
Returns boolean whether the user can modify the data.
Definition: SpecialInterwiki.php:87
$wgContLang
$wgContLang
Definition: Setup.php:809
SpecialPage\outputHeader
outputHeader( $summaryMessageKey='')
Outputs a summary message on top of special pages Per default the message key is the canonical name o...
Definition: SpecialPage.php:633
SpecialInterwiki\getSubpagesForPrefixSearch
getSubpagesForPrefixSearch()
Return an array of subpages that this special page will accept for prefix searches.
Definition: SpecialInterwiki.php:31
Xml\submitButton
static submitButton( $value, $attribs=[])
Convenience function to build an HTML submit button When $wgUseMediaWikiUIEverywhere is true it will ...
Definition: Xml.php:461
$out
this hook is for auditing only or null if authentication failed before getting that far or null if we can t even determine that probably a stub it is not rendered in wiki pages or galleries in category pages allow injecting custom HTML after the section Any uses of the hook need to handle escaping see BaseTemplate::getToolbox and BaseTemplate::makeListItem for details on the format of individual items inside of this array or by returning and letting standard HTTP rendering take place modifiable or by returning false and taking over the output $out
Definition: hooks.txt:813