MediaWiki  1.31.0
MediaWikiTitleCodec.php
Go to the documentation of this file.
1 <?php
26 
42  protected $language;
43 
47  protected $genderCache;
48 
52  protected $localInterwikis;
53 
57  protected $interwikiLookup;
58 
67  ) {
68  $this->language = $language;
69  $this->genderCache = $genderCache;
70  $this->localInterwikis = (array)$localInterwikis;
71  $this->interwikiLookup = $interwikiLookup ?:
72  MediaWikiServices::getInstance()->getInterwikiLookup();
73  }
74 
84  public function getNamespaceName( $namespace, $text ) {
85  if ( $this->language->needsGenderDistinction() &&
87  ) {
88  // NOTE: we are assuming here that the title text is a user name!
89  $gender = $this->genderCache->getGenderOf( $text, __METHOD__ );
90  $name = $this->language->getGenderNsText( $namespace, $gender );
91  } else {
92  $name = $this->language->getNsText( $namespace );
93  }
94 
95  if ( $name === false ) {
96  throw new InvalidArgumentException( 'Unknown namespace ID: ' . $namespace );
97  }
98 
99  return $name;
100  }
101 
114  public function formatTitle( $namespace, $text, $fragment = '', $interwiki = '' ) {
115  if ( $namespace !== false ) {
116  // Try to get a namespace name, but fallback
117  // to empty string if it doesn't exist
118  try {
119  $nsName = $this->getNamespaceName( $namespace, $text );
120  } catch ( InvalidArgumentException $e ) {
121  $nsName = '';
122  }
123 
124  if ( $namespace !== 0 ) {
125  $text = $nsName . ':' . $text;
126  }
127  }
128 
129  if ( $fragment !== '' ) {
130  $text = $text . '#' . $fragment;
131  }
132 
133  if ( $interwiki !== '' ) {
134  $text = $interwiki . ':' . $text;
135  }
136 
137  $text = str_replace( '_', ' ', $text );
138 
139  return $text;
140  }
141 
152  public function parseTitle( $text, $defaultNamespace ) {
153  // NOTE: this is an ugly cludge that allows this class to share the
154  // code for parsing with the old Title class. The parser code should
155  // be refactored to avoid this.
156  $parts = $this->splitTitleString( $text, $defaultNamespace );
157 
158  // Relative fragment links are not supported by TitleValue
159  if ( $parts['dbkey'] === '' ) {
160  throw new MalformedTitleException( 'title-invalid-empty', $text );
161  }
162 
163  return new TitleValue(
164  $parts['namespace'],
165  $parts['dbkey'],
166  $parts['fragment'],
167  $parts['interwiki']
168  );
169  }
170 
178  public function getText( LinkTarget $title ) {
179  return $this->formatTitle( false, $title->getText(), '' );
180  }
181 
189  public function getPrefixedText( LinkTarget $title ) {
190  return $this->formatTitle(
191  $title->getNamespace(),
192  $title->getText(),
193  '',
194  $title->getInterwiki()
195  );
196  }
197 
204  public function getPrefixedDBkey( LinkTarget $target ) {
205  $key = '';
206  if ( $target->isExternal() ) {
207  $key .= $target->getInterwiki() . ':';
208  }
209  // Try to get a namespace name, but fallback
210  // to empty string if it doesn't exist
211  try {
212  $nsName = $this->getNamespaceName(
213  $target->getNamespace(),
214  $target->getText()
215  );
216  } catch ( InvalidArgumentException $e ) {
217  $nsName = '';
218  }
219 
220  if ( $target->getNamespace() !== 0 ) {
221  $key .= $nsName . ':';
222  }
223 
224  $key .= $target->getText();
225 
226  return strtr( $key, ' ', '_' );
227  }
228 
236  public function getFullText( LinkTarget $title ) {
237  return $this->formatTitle(
238  $title->getNamespace(),
239  $title->getText(),
240  $title->getFragment(),
241  $title->getInterwiki()
242  );
243  }
244 
265  public function splitTitleString( $text, $defaultNamespace = NS_MAIN ) {
266  $dbkey = str_replace( ' ', '_', $text );
267 
268  # Initialisation
269  $parts = [
270  'interwiki' => '',
271  'local_interwiki' => false,
272  'fragment' => '',
273  'namespace' => $defaultNamespace,
274  'dbkey' => $dbkey,
275  'user_case_dbkey' => $dbkey,
276  ];
277 
278  # Strip Unicode bidi override characters.
279  # Sometimes they slip into cut-n-pasted page titles, where the
280  # override chars get included in list displays.
281  $dbkey = preg_replace( '/\xE2\x80[\x8E\x8F\xAA-\xAE]/S', '', $dbkey );
282 
283  # Clean up whitespace
284  # Note: use of the /u option on preg_replace here will cause
285  # input with invalid UTF-8 sequences to be nullified out in PHP 5.2.x,
286  # conveniently disabling them.
287  $dbkey = preg_replace(
288  '/[ _\xA0\x{1680}\x{180E}\x{2000}-\x{200A}\x{2028}\x{2029}\x{202F}\x{205F}\x{3000}]+/u',
289  '_',
290  $dbkey
291  );
292  $dbkey = trim( $dbkey, '_' );
293 
294  if ( strpos( $dbkey, UtfNormal\Constants::UTF8_REPLACEMENT ) !== false ) {
295  # Contained illegal UTF-8 sequences or forbidden Unicode chars.
296  throw new MalformedTitleException( 'title-invalid-utf8', $text );
297  }
298 
299  $parts['dbkey'] = $dbkey;
300 
301  # Initial colon indicates main namespace rather than specified default
302  # but should not create invalid {ns,title} pairs such as {0,Project:Foo}
303  if ( $dbkey !== '' && $dbkey[0] == ':' ) {
304  $parts['namespace'] = NS_MAIN;
305  $dbkey = substr( $dbkey, 1 ); # remove the colon but continue processing
306  $dbkey = trim( $dbkey, '_' ); # remove any subsequent whitespace
307  }
308 
309  if ( $dbkey == '' ) {
310  throw new MalformedTitleException( 'title-invalid-empty', $text );
311  }
312 
313  # Namespace or interwiki prefix
314  $prefixRegexp = "/^(.+?)_*:_*(.*)$/S";
315  do {
316  $m = [];
317  if ( preg_match( $prefixRegexp, $dbkey, $m ) ) {
318  $p = $m[1];
319  $ns = $this->language->getNsIndex( $p );
320  if ( $ns !== false ) {
321  # Ordinary namespace
322  $dbkey = $m[2];
323  $parts['namespace'] = $ns;
324  # For Talk:X pages, check if X has a "namespace" prefix
325  if ( $ns == NS_TALK && preg_match( $prefixRegexp, $dbkey, $x ) ) {
326  if ( $this->language->getNsIndex( $x[1] ) ) {
327  # Disallow Talk:File:x type titles...
328  throw new MalformedTitleException( 'title-invalid-talk-namespace', $text );
329  } elseif ( $this->interwikiLookup->isValidInterwiki( $x[1] ) ) {
330  # Disallow Talk:Interwiki:x type titles...
331  throw new MalformedTitleException( 'title-invalid-talk-namespace', $text );
332  }
333  }
334  } elseif ( $this->interwikiLookup->isValidInterwiki( $p ) ) {
335  # Interwiki link
336  $dbkey = $m[2];
337  $parts['interwiki'] = $this->language->lc( $p );
338 
339  # Redundant interwiki prefix to the local wiki
340  foreach ( $this->localInterwikis as $localIW ) {
341  if ( 0 == strcasecmp( $parts['interwiki'], $localIW ) ) {
342  if ( $dbkey == '' ) {
343  # Empty self-links should point to the Main Page, to ensure
344  # compatibility with cross-wiki transclusions and the like.
345  $mainPage = Title::newMainPage();
346  return [
347  'interwiki' => $mainPage->getInterwiki(),
348  'local_interwiki' => true,
349  'fragment' => $mainPage->getFragment(),
350  'namespace' => $mainPage->getNamespace(),
351  'dbkey' => $mainPage->getDBkey(),
352  'user_case_dbkey' => $mainPage->getUserCaseDBKey()
353  ];
354  }
355  $parts['interwiki'] = '';
356  # local interwikis should behave like initial-colon links
357  $parts['local_interwiki'] = true;
358 
359  # Do another namespace split...
360  continue 2;
361  }
362  }
363 
364  # If there's an initial colon after the interwiki, that also
365  # resets the default namespace
366  if ( $dbkey !== '' && $dbkey[0] == ':' ) {
367  $parts['namespace'] = NS_MAIN;
368  $dbkey = substr( $dbkey, 1 );
369  $dbkey = trim( $dbkey, '_' );
370  }
371  }
372  # If there's no recognized interwiki or namespace,
373  # then let the colon expression be part of the title.
374  }
375  break;
376  } while ( true );
377 
378  $fragment = strstr( $dbkey, '#' );
379  if ( false !== $fragment ) {
380  $parts['fragment'] = str_replace( '_', ' ', substr( $fragment, 1 ) );
381  $dbkey = substr( $dbkey, 0, strlen( $dbkey ) - strlen( $fragment ) );
382  # remove whitespace again: prevents "Foo_bar_#"
383  # becoming "Foo_bar_"
384  $dbkey = preg_replace( '/_*$/', '', $dbkey );
385  }
386 
387  # Reject illegal characters.
388  $rxTc = self::getTitleInvalidRegex();
389  $matches = [];
390  if ( preg_match( $rxTc, $dbkey, $matches ) ) {
391  throw new MalformedTitleException( 'title-invalid-characters', $text, [ $matches[0] ] );
392  }
393 
394  # Pages with "/./" or "/../" appearing in the URLs will often be un-
395  # reachable due to the way web browsers deal with 'relative' URLs.
396  # Also, they conflict with subpage syntax. Forbid them explicitly.
397  if (
398  strpos( $dbkey, '.' ) !== false &&
399  (
400  $dbkey === '.' || $dbkey === '..' ||
401  strpos( $dbkey, './' ) === 0 ||
402  strpos( $dbkey, '../' ) === 0 ||
403  strpos( $dbkey, '/./' ) !== false ||
404  strpos( $dbkey, '/../' ) !== false ||
405  substr( $dbkey, -2 ) == '/.' ||
406  substr( $dbkey, -3 ) == '/..'
407  )
408  ) {
409  throw new MalformedTitleException( 'title-invalid-relative', $text );
410  }
411 
412  # Magic tilde sequences? Nu-uh!
413  if ( strpos( $dbkey, '~~~' ) !== false ) {
414  throw new MalformedTitleException( 'title-invalid-magic-tilde', $text );
415  }
416 
417  # Limit the size of titles to 255 bytes. This is typically the size of the
418  # underlying database field. We make an exception for special pages, which
419  # don't need to be stored in the database, and may edge over 255 bytes due
420  # to subpage syntax for long titles, e.g. [[Special:Block/Long name]]
421  $maxLength = ( $parts['namespace'] != NS_SPECIAL ) ? 255 : 512;
422  if ( strlen( $dbkey ) > $maxLength ) {
423  throw new MalformedTitleException( 'title-invalid-too-long', $text,
424  [ Message::numParam( $maxLength ) ] );
425  }
426 
427  # Normally, all wiki links are forced to have an initial capital letter so [[foo]]
428  # and [[Foo]] point to the same place. Don't force it for interwikis, since the
429  # other site might be case-sensitive.
430  $parts['user_case_dbkey'] = $dbkey;
431  if ( $parts['interwiki'] === '' ) {
432  $dbkey = Title::capitalize( $dbkey, $parts['namespace'] );
433  }
434 
435  # Can't make a link to a namespace alone... "empty" local links can only be
436  # self-links with a fragment identifier.
437  if ( $dbkey == '' && $parts['interwiki'] === '' ) {
438  if ( $parts['namespace'] != NS_MAIN ) {
439  throw new MalformedTitleException( 'title-invalid-empty', $text );
440  }
441  }
442 
443  // Allow IPv6 usernames to start with '::' by canonicalizing IPv6 titles.
444  // IP names are not allowed for accounts, and can only be referring to
445  // edits from the IP. Given '::' abbreviations and caps/lowercaps,
446  // there are numerous ways to present the same IP. Having sp:contribs scan
447  // them all is silly and having some show the edits and others not is
448  // inconsistent. Same for talk/userpages. Keep them normalized instead.
449  if ( $parts['namespace'] == NS_USER || $parts['namespace'] == NS_USER_TALK ) {
450  $dbkey = IP::sanitizeIP( $dbkey );
451  }
452 
453  // Any remaining initial :s are illegal.
454  if ( $dbkey !== '' && ':' == $dbkey[0] ) {
455  throw new MalformedTitleException( 'title-invalid-leading-colon', $text );
456  }
457 
458  # Fill fields
459  $parts['dbkey'] = $dbkey;
460 
461  return $parts;
462  }
463 
473  public static function getTitleInvalidRegex() {
474  static $rxTc = false;
475  if ( !$rxTc ) {
476  # Matching titles will be held as illegal.
477  $rxTc = '/' .
478  # Any character not allowed is forbidden...
479  '[^' . Title::legalChars() . ']' .
480  # URL percent encoding sequences interfere with the ability
481  # to round-trip titles -- you can't link to them consistently.
482  '|%[0-9A-Fa-f]{2}' .
483  # XML/HTML character references produce similar issues.
484  '|&[A-Za-z0-9\x80-\xff]+;' .
485  '|&#[0-9]+;' .
486  '|&#x[0-9A-Fa-f]+;' .
487  '/S';
488  }
489 
490  return $rxTc;
491  }
492 }
MediaWikiTitleCodec\getPrefixedText
getPrefixedText(LinkTarget $title)
Definition: MediaWikiTitleCodec.php:189
MediaWiki\Linker\LinkTarget\getInterwiki
getInterwiki()
The interwiki component of this LinkTarget.
MediaWikiTitleCodec
A codec for MediaWiki page titles.
Definition: MediaWikiTitleCodec.php:38
MediaWiki\Linker\LinkTarget\getText
getText()
Returns the link in text form, without namespace prefix or fragment.
MWNamespace\hasGenderDistinction
static hasGenderDistinction( $index)
Does the namespace (potentially) have different aliases for different genders.
Definition: MWNamespace.php:449
is
We use the convention $dbr for read and $dbw for write to help you keep track of whether the database object is a the world will explode Or to be a subsequent write query which succeeded on the master may fail when replicated to the slave due to a unique key collision Replication on the slave will stop and it may take hours to repair the database and get it back online Setting read_only in my cnf on the slave will avoid this but given the dire we prefer to have as many checks as possible We provide a but the wrapper functions like please read the documentation for except in special pages derived from QueryPage It s a common pitfall for new developers to submit code containing SQL queries which examine huge numbers of rows Remember that COUNT * is(N), counting rows in atable is like counting beans in a bucket.------------------------------------------------------------------------ Replication------------------------------------------------------------------------The largest installation of MediaWiki, Wikimedia, uses a large set ofslave MySQL servers replicating writes made to a master MySQL server. Itis important to understand the issues associated with this setup if youwant to write code destined for Wikipedia.It 's often the case that the best algorithm to use for a given taskdepends on whether or not replication is in use. Due to our unabashedWikipedia-centrism, we often just use the replication-friendly version, but if you like, you can use wfGetLB() ->getServerCount() > 1 tocheck to see if replication is in use.===Lag===Lag primarily occurs when large write queries are sent to the master.Writes on the master are executed in parallel, but they are executed inserial when they are replicated to the slaves. The master writes thequery to the binlog when the transaction is committed. The slaves pollthe binlog and start executing the query as soon as it appears. They canservice reads while they are performing a write query, but will not readanything more from the binlog and thus will perform no more writes. Thismeans that if the write query runs for a long time, the slaves will lagbehind the master for the time it takes for the write query to complete.Lag can be exacerbated by high read load. MediaWiki 's load balancer willstop sending reads to a slave when it is lagged by more than 30 seconds.If the load ratios are set incorrectly, or if there is too much loadgenerally, this may lead to a slave permanently hovering around 30seconds lag.If all slaves are lagged by more than 30 seconds, MediaWiki will stopwriting to the database. All edits and other write operations will berefused, with an error returned to the user. This gives the slaves achance to catch up. Before we had this mechanism, the slaves wouldregularly lag by several minutes, making review of recent editsdifficult.In addition to this, MediaWiki attempts to ensure that the user seesevents occurring on the wiki in chronological order. A few seconds of lagcan be tolerated, as long as the user sees a consistent picture fromsubsequent requests. This is done by saving the master binlog positionin the session, and then at the start of each request, waiting for theslave to catch up to that position before doing any reads from it. Ifthis wait times out, reads are allowed anyway, but the request isconsidered to be in "lagged slave mode". Lagged slave mode can bechecked by calling wfGetLB() ->getLaggedSlaveMode(). The onlypractical consequence at present is a warning displayed in the pagefooter.===Lag avoidance===To avoid excessive lag, queries which write large numbers of rows shouldbe split up, generally to write one row at a time. Multi-row INSERT ...SELECT queries are the worst offenders should be avoided altogether.Instead do the select first and then the insert.===Working with lag===Despite our best efforts, it 's not practical to guarantee a low-lagenvironment. Lag will usually be less than one second, but mayoccasionally be up to 30 seconds. For scalability, it 's very importantto keep load on the master low, so simply sending all your queries tothe master is not the answer. So when you have a genuine need forup-to-date data, the following approach is advised:1) Do a quick query to the master for a sequence number or timestamp 2) Run the full query on the slave and check if it matches the data you gotfrom the master 3) If it doesn 't, run the full query on the masterTo avoid swamping the master every time the slaves lag, use of thisapproach should be kept to a minimum. In most cases you should just readfrom the slave and let the user deal with the delay.------------------------------------------------------------------------ Lock contention------------------------------------------------------------------------Due to the high write rate on Wikipedia(and some other wikis), MediaWiki developers need to be very careful to structure their writesto avoid long-lasting locks. By default, MediaWiki opens a transactionat the first query, and commits it before the output is sent. Locks willbe held from the time when the query is done until the commit. So youcan reduce lock time by doing as much processing as possible before youdo your write queries.Often this approach is not good enough, and it becomes necessary toenclose small groups of queries in their own transaction. Use thefollowing syntax:$dbw=wfGetDB(DB_MASTER
Title\newMainPage
static newMainPage()
Create a new Title for the Main Page.
Definition: Title.php:586
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
MediaWikiTitleCodec\getTitleInvalidRegex
static getTitleInvalidRegex()
Returns a simple regex that will match on characters and sequences invalid in titles.
Definition: MediaWikiTitleCodec.php:473
GenderCache
Caches user genders when needed to use correct namespace aliases.
Definition: GenderCache.php:31
MediaWikiTitleCodec\splitTitleString
splitTitleString( $text, $defaultNamespace=NS_MAIN)
Normalizes and splits a title string.
Definition: MediaWikiTitleCodec.php:265
$name
Allows to change the fields on the form that will be generated $name
Definition: hooks.txt:302
MediaWiki\Linker\LinkTarget\isExternal
isExternal()
Whether this LinkTarget has an interwiki component.
MediaWikiTitleCodec\getNamespaceName
getNamespaceName( $namespace, $text)
Definition: MediaWikiTitleCodec.php:84
MediaWikiTitleCodec\parseTitle
parseTitle( $text, $defaultNamespace)
Parses the given text and constructs a TitleValue.
Definition: MediaWikiTitleCodec.php:152
MediaWikiTitleCodec\getFullText
getFullText(LinkTarget $title)
Definition: MediaWikiTitleCodec.php:236
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
NS_MAIN
const NS_MAIN
Definition: Defines.php:65
NS_SPECIAL
const NS_SPECIAL
Definition: Defines.php:54
MediaWiki\Linker\LinkTarget\getNamespace
getNamespace()
Get the namespace index.
processing
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 after processing
Definition: hooks.txt:1987
$title
namespace and then decline to actually register it file or subcat img or subcat $title
Definition: hooks.txt:934
UtfNormal
Unicode normalization routines for working with UTF-8 strings.
Definition: UtfNormal.php:48
$matches
$matches
Definition: NoLocalSettings.php:24
not
if not
Definition: COPYING.txt:307
MediaWiki\Interwiki\InterwikiLookup
Service interface for looking up Interwiki records.
Definition: InterwikiLookup.php:31
MediaWikiTitleCodec\formatTitle
formatTitle( $namespace, $text, $fragment='', $interwiki='')
Definition: MediaWikiTitleCodec.php:114
MediaWikiTitleCodec\$localInterwikis
string[] $localInterwikis
Definition: MediaWikiTitleCodec.php:52
TitleParser
A title parser service for MediaWiki.
Definition: TitleParser.php:33
MediaWikiTitleCodec\__construct
__construct(Language $language, GenderCache $genderCache, $localInterwikis=[], $interwikiLookup=null)
Definition: MediaWikiTitleCodec.php:65
URL
design txt This is a brief overview of the new design More thorough and up to date information is available on the documentation wiki at etc Handles the details of getting and saving to the user table of the and dealing with sessions and cookies OutputPage Encapsulates the entire HTML page that will be sent in response to any server request It is used by calling its functions to add in any and then calling but I prefer the flexibility This should also do the output encoding The system allocates a global one in $wgOut Title Represents the title of an and does all the work of translating among various forms such as plain URL
Definition: design.txt:25
any
they could even be mouse clicks or menu items whatever suits your program You should also get your if any
Definition: COPYING.txt:326
NS_USER_TALK
const NS_USER_TALK
Definition: Defines.php:68
$e
div flags Integer display flags(NO_ACTION_LINK, NO_EXTRA_USER_LINKS) 'LogException' returning false will NOT prevent logging $e
Definition: hooks.txt:2163
MediaWikiTitleCodec\$interwikiLookup
InterwikiLookup $interwikiLookup
Definition: MediaWikiTitleCodec.php:57
language
and that you know you can do these things To protect your we need to make restrictions that forbid anyone to deny you these rights or to ask you to surrender the rights These restrictions translate to certain responsibilities for you if you distribute copies of the or if you modify it For if you distribute copies of such a whether gratis or for a you must give the recipients all the rights that you have You must make sure that receive or can get the source code And you must show them these terms so they know their rights We protect your rights with two distribute and or modify the software for each author s protection and we want to make certain that everyone understands that there is no warranty for this free software If the software is modified by someone else and passed we want its recipients to know that what they have is not the so that any problems introduced by others will not reflect on the original authors reputations any free program is threatened constantly by software patents We wish to avoid the danger that redistributors of a free program will individually obtain patent in effect making the program proprietary To prevent we have made it clear that any patent must be licensed for everyone s free use or not licensed at all The precise terms and conditions for distribution and modification follow GNU GENERAL PUBLIC LICENSE TERMS AND CONDITIONS FOR DISTRIBUTION AND MODIFICATION This License applies to any program or other work which contains a notice placed by the copyright holder saying it may be distributed under the terms of this General Public License The refers to any such program or and a work based on the Program means either the Program or any derivative work under copyright a work containing the Program or a portion of either verbatim or with modifications and or translated into another language(Hereinafter, translation is included without limitation in the term "modification".) Each licensee is addressed as "you". Activities other than copying
UTF8_REPLACEMENT
const UTF8_REPLACEMENT
Definition: UtfNormalDefines.php:145
MediaWikiTitleCodec\$genderCache
GenderCache $genderCache
Definition: MediaWikiTitleCodec.php:47
IP\sanitizeIP
static sanitizeIP( $ip)
Convert an IP into a verbose, uppercase, normalized form.
Definition: IP.php:152
MediaWikiTitleCodec\getText
getText(LinkTarget $title)
Definition: MediaWikiTitleCodec.php:178
MalformedTitleException
MalformedTitleException is thrown when a TitleParser is unable to parse a title string.
Definition: MalformedTitleException.php:25
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:3594
TitleFormatter
A title formatter service for MediaWiki.
Definition: TitleFormatter.php:34
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
MediaWikiTitleCodec\getPrefixedDBkey
getPrefixedDBkey(LinkTarget $target)
Definition: MediaWikiTitleCodec.php:204
NS_USER
const NS_USER
Definition: Defines.php:67
NS_TALK
const NS_TALK
Definition: Defines.php:66
Title\legalChars
static legalChars()
Get a regex character class describing the legal characters in a link.
Definition: Title.php:623
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
MediaWiki\Linker\LinkTarget
Definition: LinkTarget.php:26
Language
Internationalisation code.
Definition: Language.php:35
MediaWikiTitleCodec\$language
Language $language
Definition: MediaWikiTitleCodec.php:42
array
the array() calling protocol came about after MediaWiki 1.4rc1.
TitleValue
Represents a page (or page fragment) title within MediaWiki.
Definition: TitleValue.php:35