MediaWiki  master
Title Class Reference

Represents a title within MediaWiki. More...

Inheritance diagram for Title:
Collaboration diagram for Title:

Public Member Functions

 __clone ()
 
 __sleep ()
 
 __toString ()
 Return a string representation of this title. More...
 
 __wakeup ()
 
 areCascadeProtectionSourcesLoaded ()
 Determines whether cascading protection sources have already been loaded from the database. More...
 
 areRestrictionsCascading ()
 Returns cascading restrictions for the current article. More...
 
 areRestrictionsLoaded ()
 Accessor for mRestrictionsLoaded. More...
 
 canExist ()
 Can this title represent a page in the wiki's database? More...
 
 canHaveTalkPage ()
 Can this title have a corresponding talk page? More...
 
 canUseNoindex ()
 Whether the magic words INDEX and NOINDEX function for this page. More...
 
 createFragmentTarget ( $fragment)
 Creates a new Title for a different fragment of the same page. More...
 
 deleteTitleProtection ()
 Remove any title protection due to page existing. More...
 
 equals (object $other)
 Compares with another Title. More...
 
 estimateRevisionCount ()
 Get the approximate revision count of this page. More...
 
 exists ( $flags=0)
 Check if page exists. More...
 
 fixSpecialName ()
 If the Title refers to a special page alias which is not the local default, resolve the alias, and localise the name as necessary. More...
 
 flushRestrictions ()
 Flush the protection cache in this object and force reload from the database. More...
 
 getAllRestrictions ()
 Accessor/initialisation for mRestrictions. More...
 
 getArticleID ( $flags=0)
 Get the article ID for this Title from the link cache, adding it if necessary. More...
 
 getBacklinkCache ()
 Get a backlink cache object. More...
 
 getBaseText ()
 Get the base page name without a namespace, i.e. More...
 
 getBaseTitle ()
 Get the base page name title, i.e. More...
 
 getBrokenLinksFrom ()
 Get an array of Title objects referring to non-existent articles linked from this page. More...
 
 getCanonicalURL ( $query='', $query2=false)
 Get the URL for a canonical link, for use in things like IRC and e-mail notifications. More...
 
 getCascadeProtectionSources ( $getPages=true)
 Cascading protection: Get the source of any cascading restrictions on this page. More...
 
 getCategorySortkey ( $prefix='')
 Returns the raw sort key to be used for categories, with the specified prefix. More...
 
 getCdnUrls ()
 Get a list of URLs to purge from the CDN cache when this page changes. More...
 
 getContentModel ( $flags=0)
 Get the page's content model id, see the CONTENT_MODEL_XXX constants. More...
 
 getDBkey ()
 Get the main part with underscores. More...
 
 getDefaultMessageText ()
 Get the default (plain) message contents for an page that overrides an interface message key. More...
 
 getDefaultNamespace ()
 Get the default namespace index, for when there is no namespace. More...
 
 getDeletedEditsCount ()
 Is there a version of this page in the deletion archive? More...
 
 getEditNotices ( $oldid=0)
 Get a list of rendered edit notices for this page. More...
 
 getEditURL ()
 Get the edit URL for this Title. More...
 
 getFragment ()
 Get the Title fragment (i.e. More...
 
 getFragmentForURL ()
 Get the fragment in URL form, including the "#" character if there is one. More...
 
 getFullText ()
 Get the prefixed title with spaces, plus any fragment (part beginning with '#') More...
 
 getFullURL ( $query='', $query2=false, $proto=PROTO_RELATIVE)
 Get a real URL referring to this title, with interwiki link and fragment. More...
 
 getFullUrlForRedirect ( $query='', $proto=PROTO_CURRENT)
 Get a url appropriate for making redirects based on an untrusted url arg. More...
 
 getId ( $wikiId=self::LOCAL)
 Returns the page ID. More...
 
 getInternalURL ( $query='', $query2=false)
 Get the URL form for an internal link. More...
 
 getInterwiki ()
 Get the interwiki prefix. More...
 
 getLatestRevID ( $flags=0)
 What is the page_latest field for this page? More...
 
 getLength ( $flags=0)
 What is the length of this page? Uses link cache, adding it if necessary. More...
 
 getLinksFrom ( $options=[], $table='pagelinks', $prefix='pl')
 Get an array of Title objects linked from this Title Also stores the IDs in the link cache. More...
 
 getLinksTo ( $options=[], $table='pagelinks', $prefix='pl')
 Get an array of Title objects linking to this Title Also stores the IDs in the link cache. More...
 
 getLinkURL ( $query='', $query2=false, $proto=false)
 Get a URL that's the simplest URL that will be valid to link, locally, to the current Title. More...
 
 getLocalURL ( $query='', $query2=false)
 Get a URL with no fragment or server name (relative URL) from a Title object. More...
 
 getNamespace ()
 Get the namespace index, i.e. More...
 
 getNamespaceKey ( $prepend='nstab-')
 Generate strings used for xml 'id' names in monobook tabs. More...
 
 getNotificationTimestamp (User $user)
 Get the timestamp when this page was updated since the user last saw it. More...
 
 getNsText ()
 Get the namespace text. More...
 
 getOtherPage ()
 Get the other title for this page, if this is a subject page get the talk page, if it is a subject page get the talk page. More...
 
 getPageLanguage ()
 Get the language in which the content of this page is written in wikitext. More...
 
 getPageViewLanguage ()
 Get the language in which the content of this page is written when viewed by user. More...
 
 getParentCategories ()
 Get categories to which this Title belongs and return an array of categories' names. More...
 
 getParentCategoryTree ( $children=[])
 Get a tree of parent categories. More...
 
 getPartialURL ()
 Get the URL-encoded form of the main part. More...
 
 getPrefixedDBkey ()
 Get the prefixed database key form. More...
 
 getPrefixedText ()
 Get the prefixed title with spaces. More...
 
 getPrefixedURL ()
 Get a URL-encoded title (not an actual URL) including interwiki. More...
 
 getRedirectsHere ( $ns=null)
 Get all extant redirects to this Title. More...
 
 getRestrictionExpiry ( $action)
 Get the expiry time for the restriction against a given action. More...
 
 getRestrictions ( $action)
 Accessor/initialisation for mRestrictions. More...
 
 getRestrictionTypes ()
 Returns restriction types for the current Title. More...
 
 getRootText ()
 Get the root page name text without a namespace, i.e. More...
 
 getRootTitle ()
 Get the root page name title, i.e. More...
 
 getSkinFromConfigSubpage ()
 Trim down a .css, .json, or .js subpage title to get the corresponding skin name. More...
 
 getSubjectNsText ()
 Get the namespace text of the subject (rather than talk) page. More...
 
 getSubjectPage ()
 Get a title object associated with the subject page of this talk page. More...
 
 getSubpage ( $text)
 Get the title for a subpage of the current page. More...
 
 getSubpages ( $limit=-1)
 Get all subpages of this page. More...
 
 getSubpageText ()
 Get the lowest-level subpage name, i.e. More...
 
 getSubpageUrlForm ()
 Get a URL-encoded form of the subpage text. More...
 
 getTalkNsText ()
 Get the namespace text of the talk page. More...
 
 getTalkPage ()
 Get a Title object associated with the talk page of this article. More...
 
 getTalkPageIfDefined ()
 Get a Title object associated with the talk page of this article, if such a talk page can exist. More...
 
 getTemplateLinksFrom ( $options=[])
 Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache. More...
 
 getTemplateLinksTo ( $options=[])
 Get an array of Title objects using this Title as a template Also stores the IDs in the link cache. More...
 
 getText ()
 Get the text form (spaces not underscores) of the main part. More...
 
 getTitleProtection ()
 Is this title subject to title protection? Title protection is the one applied against creation of such title. More...
 
 getTitleValue ()
 Get a TitleValue object representing this Title. More...
 
 getTouched ( $db=null)
 Get the last touched timestamp. More...
 
 getTransWikiID ()
 Returns the DB name of the distant wiki which owns the object. More...
 
 getWikiId ()
 Returns false to indicate that this Title belongs to the local wiki. More...
 
 hasContentModel ( $id)
 Convenience method for checking a title's content model name. More...
 
 hasDeletedEdits ()
 Is there a version of this page in the deletion archive? More...
 
 hasFragment ()
 Check if a Title fragment is set. More...
 
 hasSourceText ()
 Does this page have source text? More...
 
 hasSubjectNamespace ( $ns)
 Returns true if the title has the same subject namespace as the namespace specified. More...
 
 hasSubpages ()
 Does this have subpages? (Warning, usually requires an extra DB query.) More...
 
 inNamespace ( $ns)
 Returns true if the title is inside the specified namespace. More...
 
 inNamespaces (... $namespaces)
 Returns true if the title is inside one of the specified namespaces. More...
 
 invalidateCache ( $purgeTime=null)
 Updates page_touched for this page; called from LinksUpdate.php. More...
 
 isAlwaysKnown ()
 Should links to this title be shown as potentially viewable (i.e. More...
 
 isBigDeletion ()
 Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. More...
 
 isCascadeProtected ()
 Cascading protection: Return true if cascading restrictions apply to this page, false if not. More...
 
 isContentPage ()
 Is this Title in a namespace which contains content? In other words, is this a content page, for the purposes of calculating statistics, etc? More...
 
 isConversionTable ()
 Is this a conversion table for the LanguageConverter? More...
 
 isDeleted ()
 Is there a version of this page in the deletion archive? More...
 
 isDeletedQuick ()
 Is there a version of this page in the deletion archive? More...
 
 isExternal ()
 Is this Title interwiki? More...
 
 isKnown ()
 Does this title refer to a page that can (or might) be meaningfully viewed? In particular, this function may be used to determine if links to the title should be rendered as "bluelinks" (as opposed to "redlinks" to non-existent pages). More...
 
 isLocal ()
 Determine whether the object refers to a page within this project (either this wiki or a wiki with a local interwiki, see https://www.mediawiki.org/wiki/Manual:Interwiki_table#iw_local ) More...
 
 isMainPage ()
 Is this the mainpage? More...
 
 isMovable ()
 Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable. More...
 
 isNamespaceProtected (User $user)
 Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection. More...
 
 isNewPage ()
 Check if this is a new page. More...
 
 isProtected ( $action='')
 Does the title correspond to a protected article? More...
 
 isRawHtmlMessage ()
 Is this a message which can contain raw HTML? More...
 
 isRedirect ( $flags=0)
 Is this an article that is a redirect page? Uses link cache, adding it if necessary. More...
 
 isSameLinkAs (LinkTarget $other)
 
 isSamePageAs (PageReference $other)
 
 isSemiProtected ( $action='edit')
 Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels? More...
 
 isSingleRevRedirect ()
 Locks the page row and check if this page is single revision redirect. More...
 
 isSiteConfigPage ()
 Could this MediaWiki namespace page contain custom CSS, JSON, or JavaScript for the global UI. More...
 
 isSiteCssConfigPage ()
 Is this a sitewide CSS "config" page? More...
 
 isSiteJsConfigPage ()
 Is this a sitewide JS "config" page? More...
 
 isSiteJsonConfigPage ()
 Is this a sitewide JSON "config" page? More...
 
 isSpecial ( $name)
 Returns true if this title resolves to the named special page. More...
 
 isSpecialPage ()
 Returns true if this is a special page. More...
 
 isSubpage ()
 Is this a subpage? More...
 
 isSubpageOf (Title $title)
 Check if this title is a subpage of another title. More...
 
 isTalkPage ()
 Is this a talk page of some sort? More...
 
 isTrans ()
 Determine whether the object refers to a page within this project and is transcludable. More...
 
 isUserConfigPage ()
 Is this a "config" (.css, .json, or .js) sub-page of a user page? More...
 
 isUserCssConfigPage ()
 Is this a CSS "config" sub-page of a user page? More...
 
 isUserJsConfigPage ()
 Is this a JS "config" sub-page of a user page? More...
 
 isUserJsonConfigPage ()
 Is this a JSON "config" sub-page of a user page? More...
 
 isValid ()
 Returns true if the title is a valid link target, and that it has been properly normalized. More...
 
 isValidRedirectTarget ()
 Check if this Title is a valid redirect target. More...
 
 isWikitextPage ()
 Does that page contain wikitext, or it is JS, CSS or whatever? More...
 
 loadFromRow ( $row)
 Load Title object fields from a DB row. More...
 
 loadRestrictions ( $oldFashionedRestrictions=null, $flags=0)
 Load restrictions from the page_restrictions table. More...
 
 loadRestrictionsFromRows ( $rows, $oldFashionedRestrictions=null)
 Compiles list of active page restrictions from both page table (pre 1.10) and page_restrictions table for this existing page. More...
 
 pageCond ()
 Get an associative array for selecting this title from the "page" table. More...
 
 purgeSquid ()
 Purge all applicable CDN URLs. More...
 
 resetArticleID ( $id)
 Inject a page ID, reset DB-loaded fields, and clear the link cache for this title. More...
 
 setContentModel ( $model)
 Set a proposed content model for the page for permissions checking. More...
 
 setFragment ( $fragment)
 Set the fragment for this title. More...
 
 toPageIdentity ()
 Returns the page represented by this Title as a ProperPageIdentity. More...
 
 toPageRecord ( $flags=0)
 Returns the page represented by this Title as a ProperPageRecord. More...
 
 touchLinks ()
 Update page_touched timestamps and send CDN purge messages for pages linking to this title. More...
 
 wasLocalInterwiki ()
 Was this a local interwiki link? More...
 
- Public Member Functions inherited from Page\PageIdentity
 exists ()
 Checks if the page currently exists. More...
 
- Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity
 assertWiki ( $wikiId)
 Throws if $wikiId is different from the return value of getWikiId(). More...
 

Static Public Member Functions

static capitalize ( $text, $ns=NS_MAIN)
 Capitalize a text string for a title if it belongs to a namespace that capitalizes. More...
 
static castFromLinkTarget ( $linkTarget)
 Same as newFromLinkTarget, but if passed null, returns null. More...
 
static castFromPageIdentity (?PageIdentity $pageIdentity)
 Return a Title for a given PageIdentity. More...
 
static castFromPageReference (?PageReference $pageReference)
 Return a Title for a given Reference. More...
 
static clearCaches ()
 
static compare ( $a, $b)
 Callback for usort() to do title sorts by (namespace, title) More...
 
static convertByteClassToUnicodeClass ( $byteClass)
 Utility method for converting a character sequence from bytes to Unicode. More...
 
static getFilteredRestrictionTypes ( $exists=true)
 Get a filtered list of all restriction types supported by this wiki. More...
 
static legalChars ()
 Get a regex character class describing the legal characters in a link. More...
 
static makeName ( $ns, $title, $fragment='', $interwiki='', $canonicalNamespace=false)
 Make a prefixed DB key from a DB key and a namespace index. More...
 
static makeTitle ( $ns, $title, $fragment='', $interwiki='')
 Create a new Title from a namespace index and a DB key. More...
 
static makeTitleSafe ( $ns, $title, $fragment='', $interwiki='')
 Create a new Title from a namespace index and a DB key. More...
 
static newFromDBkey ( $key)
 Create a new Title from a prefixed DB key. More...
 
static newFromID ( $id, $flags=0)
 Create a new Title from an article ID. More...
 
static newFromIDs ( $ids)
 Make an array of titles from an array of IDs. More...
 
static newFromLinkTarget (LinkTarget $linkTarget, $forceClone='')
 Returns a Title given a LinkTarget. More...
 
static newFromRow ( $row)
 Make a Title object from a DB row. More...
 
static newFromText ( $text, $defaultNamespace=NS_MAIN)
 Create a new Title from text, such as what one would find in a link. More...
 
static newFromTextThrow ( $text, $defaultNamespace=NS_MAIN)
 Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null. More...
 
static newFromTitleValue (TitleValue $titleValue, $forceClone='')
 Returns a Title given a TitleValue. More...
 
static newFromURL ( $url)
 THIS IS NOT THE FUNCTION YOU WANT. More...
 
static newMainPage (MessageLocalizer $localizer=null)
 Create a new Title for the Main Page. More...
 
static purgeExpiredRestrictions ()
 Purge expired restrictions from the page_restrictions table. More...
 

Public Attributes

const GAID_FOR_UPDATE = 512
 Used to be GAID_FOR_UPDATE define(). More...
 
const NEW_CLONE = 'clone'
 Flag for use with factory methods like newFromLinkTarget() that have a $forceClone parameter. More...
 
- Public Attributes inherited from IDBAccessObject
const READ_NONE = -1
 Constants for object loading bitfield flags (higher => higher QoS) More...
 

Static Protected Member Functions

static getSelectFields ()
 Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries. More...
 

Private Member Functions

 __construct ()
 
 assertProperPage ()
 Code that requires this Title to be a "proper page" in the sense defined by PageIdentity should call this method. More...
 
 findSubpageDivider ( $text, $dir)
 Finds the first or last subpage divider (slash) in the string. More...
 
 getDbPageLanguageCode ()
 Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false. More...
 
 getLanguageConverter ( $language)
 Shorthand for getting a Language Converter for specific language. More...
 
 getPageLanguageConverter ()
 Shorthand for getting a Language Converter for page's language. More...
 
 hasSubpagesEnabled ()
 Whether this Title's namespace has subpages enabled. More...
 
 lazyFillContentModel ( $model)
 If the content model field is not frozen then update it with a retrieved value. More...
 
 loadFieldFromDB ( $field, $flags)
 
 prefix ( $name)
 Prefix some arbitrary text with the namespace or interwiki prefix of this object. More...
 
 secureAndSplit ( $text, $defaultNamespace=null)
 Secure and split - main initialisation function for this object. More...
 
 uncache ()
 Removes this instance from the internal title cache, so it can be modified in-place without polluting the cache (see T281337). More...
 
 warnIfPageCannotExist (Title $title, $method)
 

Static Private Member Functions

static fixUrlQueryArgs ( $query, $query2=false)
 Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args get{Canonical,Full,Link,Local,Internal}URL methods accepted an optional second argument named variant. More...
 
static getInterwikiLookup ()
 B/C kludge: provide an InterwikiLookup for use by Title. More...
 
static getTitleCache ()
 
static getTitleFormatter ()
 B/C kludge: provide a TitleParser for use by Title. More...
 
static normalizeFragment ( $fragment)
 Normalizes fragment part of the title. More...
 

Private Attributes

const CACHE_MAX = 1000
 Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles. More...
 

Static Private Attributes

static MapCacheLRU null $titleCache = null
 

Private member variables

Please use the accessor functions instead.

Access: internal
bool $mLocalInterwiki = false
 Was this Title created from a string with a local interwiki prefix? More...
 
bool string $mContentModel = false
 ID of the page's content model, i.e. More...
 
bool $mForcedContentModel = false
 If a content model was forced via setContentModel() this will be true to avoid having other code paths reset it. More...
 
int $mEstimateRevisions
 Estimated number of revisions; null of not loaded. More...
 
bool $mHasSubpages
 Whether a page has any subpages. More...
 
array null $mPageLanguage
 The (string) language code of the page's language and content code. More...
 
string bool null $mDbPageLanguage = false
 The page language code from the database, null if not saved in the database or false if not loaded, yet. More...
 
TitleValue null $mTitleValue = null
 Was this Title created from a string with a local interwiki prefix? More...
 
bool null $mIsBigDeletion = null
 Would deleting this page be a big deletion? More...
 
bool null $mIsValid = null
 Is the title known to be valid? More...
 
string null $mInstanceCacheKey = null
 The key of this instance in the internal Title instance cache. More...
 
string $mTextform = ''
 
string $mUrlform = ''
 
string $mDbkeyform = ''
 
int $mNamespace = NS_MAIN
 
string $mInterwiki = ''
 
string $mFragment = ''
 
int $mArticleID = -1
 Article ID, fetched from the link cache on demand. More...
 
string null $prefixedText = null
 Text form including namespace/interwiki, initialised on demand. More...
 
int $mDefaultNamespace = NS_MAIN
 Namespace index when there is no namespace. More...
 
null bool $mRedirect = null
 Is the article at this title a redirect? More...
 
bool int $mLatestID = false
 ID of most recent revision. More...
 
int $mLength = -1
 The page length, 0 for special pages. More...
 

Detailed Description

Represents a title within MediaWiki.

Optionally may contain an interwiki designation or namespace.

Note
This class can fetch various kinds of data from the database; however, it does so inefficiently.
Consider using a TitleValue object instead. TitleValue is more lightweight and does not rely on global state or the database.

Definition at line 47 of file Title.php.

Constructor & Destructor Documentation

◆ __construct()

Title::__construct ( )
private

Definition at line 244 of file Title.php.

Member Function Documentation

◆ __clone()

Title::__clone ( )

Definition at line 4166 of file Title.php.

◆ __sleep()

Title::__sleep ( )
Returns
array

Definition at line 4149 of file Title.php.

◆ __toString()

Title::__toString ( )

Return a string representation of this title.

Returns
string Representation of this title

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1909 of file Title.php.

References getPrefixedText().

◆ __wakeup()

Title::__wakeup ( )

Definition at line 4160 of file Title.php.

References wfUrlencode().

◆ areCascadeProtectionSourcesLoaded()

Title::areCascadeProtectionSourcesLoaded ( )

Determines whether cascading protection sources have already been loaded from the database.

Deprecated:
since 1.37, use RestrictionStore::areCascadeProtectionSourcesLoaded instead
Returns
bool
Since
1.23

Definition at line 2540 of file Title.php.

◆ areRestrictionsCascading()

Title::areRestrictionsCascading ( )

Returns cascading restrictions for the current article.

Deprecated:
since 1.37, use RestrictionStore::areRestrictionsCascading instead
Returns
bool

Definition at line 2636 of file Title.php.

◆ areRestrictionsLoaded()

Title::areRestrictionsLoaded ( )

Accessor for mRestrictionsLoaded.

Deprecated:
since 1.37, use RestrictionStore::areRestrictionsLoaded instead
Returns
bool Whether or not the page's restrictions have already been loaded from the database
Since
1.23

Definition at line 2580 of file Title.php.

◆ assertProperPage()

Title::assertProperPage ( )
private

Code that requires this Title to be a "proper page" in the sense defined by PageIdentity should call this method.

For the purpose of the Title class, a proper page is one that can exist in the page table. That is, a Title represents a proper page if canExist() returns true.

See also
canExist()
Exceptions
PreconditionException

Definition at line 4217 of file Title.php.

References canExist().

Referenced by getId(), toPageIdentity(), and toPageRecord().

◆ canExist()

Title::canExist ( )

Can this title represent a page in the wiki's database?

Titles can exist as pages in the database if they are valid, and they are not Special pages, interwiki links, or fragment-only links.

See also
isValid()
Returns
bool true if and only if this title can be used to perform an edit.

Implements Page\PageIdentity.

Definition at line 1226 of file Title.php.

References getNamespace(), getText(), isExternal(), isValid(), and NS_MAIN.

Referenced by assertProperPage(), RequestContext\canUseWikiPage(), getArticleID(), and UppercaseTitlesForUnicodeTransition\mungeTitle().

◆ canHaveTalkPage()

Title::canHaveTalkPage ( )

Can this title have a corresponding talk page?

False for relative section links (with getText() === ''), interwiki links (with getInterwiki() !== ''), and pages in NS_SPECIAL.

See also
NamespaceInfo::canHaveTalkPage
Since
1.30
Returns
bool True if this title either is a talk page or can have a talk page associated.

Definition at line 1212 of file Title.php.

Referenced by getOtherPage(), and getTalkPageIfDefined().

◆ canUseNoindex()

Title::canUseNoindex ( )

Whether the magic words INDEX and NOINDEX function for this page.

Returns
bool

Definition at line 3898 of file Title.php.

References $wgExemptFromUserRobotsControl.

◆ capitalize()

static Title::capitalize (   $text,
  $ns = NS_MAIN 
)
static

Capitalize a text string for a title if it belongs to a namespace that capitalizes.

Parameters
string$textContaining title to capitalize
int$nsNamespace index, defaults to NS_MAIN
Returns
string Containing capitalized title

Definition at line 3023 of file Title.php.

Referenced by CategoryPager\__construct(), UploadBase\checkBadFileName(), and SpecialWithoutInterwiki\execute().

◆ castFromLinkTarget()

◆ castFromPageIdentity()

◆ castFromPageReference()

◆ clearCaches()

static Title::clearCaches ( )
static

◆ compare()

static Title::compare (   $a,
  $b 
)
static

Callback for usort() to do title sorts by (namespace, title)

Parameters
LinkTarget | PageReference$a
LinkTarget | PageReference$b
Returns
int Result of string comparison, or namespace comparison

Definition at line 883 of file Title.php.

Referenced by ApiQueryInfo\execute().

◆ convertByteClassToUnicodeClass()

static Title::convertByteClassToUnicodeClass (   $byteClass)
static

Utility method for converting a character sequence from bytes to Unicode.

Primary usecase being converting $wgLegalTitleChars to a sequence usable in javascript, as PHP uses UTF-8 bytes where javascript uses Unicode code units.

Parameters
string$byteClass
Returns
string

Definition at line 750 of file Title.php.

◆ createFragmentTarget()

Title::createFragmentTarget (   $fragment)

Creates a new Title for a different fragment of the same page.

Since
1.27
Parameters
string$fragment
Returns
Title

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1828 of file Title.php.

References getText(), and makeTitle().

Referenced by SpecialWhatLinksHere\listItem().

◆ deleteTitleProtection()

Title::deleteTitleProtection ( )

Remove any title protection due to page existing.

Deprecated:
since 1.37, do not use (this is only for WikiPage::onArticleCreate)

Definition at line 2462 of file Title.php.

◆ equals()

Title::equals ( object  $other)

Compares with another Title.

A Title object is considered equal to another Title if it has the same text, the same interwiki prefix, and the same namespace.

Note
This is different from isSameLinkAs(), which also compares the fragment part, and from isSamePageAs(), which takes into account the page ID.

@phpcs:disable MediaWiki.Commenting.FunctionComment.ObjectTypeHintParam

Parameters
object$other
Returns
bool true if $other is a Title and refers to the same page.

Definition at line 3459 of file Title.php.

References getDBkey(), getInterwiki(), and getNamespace().

Referenced by getLocalURL(), inNamespace(), isMainPage(), MediaWiki\Block\Restriction\PageRestriction\matches(), and MediaWiki\Storage\DerivedPageDataUpdater\prepareContent().

◆ estimateRevisionCount()

Title::estimateRevisionCount ( )

Get the approximate revision count of this page.

Returns
int

Definition at line 3431 of file Title.php.

References $dbr, $mEstimateRevisions, DB_REPLICA, Page\PageIdentity\exists(), getArticleID(), and wfGetDB().

◆ exists()

Title::exists (   $flags = 0)

Check if page exists.

For historical reasons, this function simply checks for the existence of the title in the page table, and will thus return false for interwiki links, special pages and the like. If you want to know if a title can be meaningfully viewed, you should probably call the isKnown() method instead.

Parameters
int$flagsEither a bitfield of class READ_* constants or GAID_FOR_UPDATE
Returns
bool

Definition at line 3532 of file Title.php.

References getArticleID(), and Hooks\runner().

Referenced by SpecialUpload\getUploadForm(), and UppercaseTitlesForUnicodeTransition\mungeTitle().

◆ findSubpageDivider()

Title::findSubpageDivider (   $text,
  $dir 
)
private

Finds the first or last subpage divider (slash) in the string.

Any leading sequence of slashes is ignored, since it does not divide two parts of the string. Considering leading slashes dividers would result in empty root title or base title (T229443).

Note that trailing slashes are considered dividers, and empty subpage names are allowed.

Parameters
string$text
int$dir-1 for the last or +1 for the first divider.
Returns
false|int

Definition at line 1941 of file Title.php.

Referenced by getBaseText(), getRootText(), getSkinFromConfigSubpage(), and getSubpageText().

◆ fixSpecialName()

Title::fixSpecialName ( )

If the Title refers to a special page alias which is not the local default, resolve the alias, and localise the name as necessary.

Otherwise, return $this

Returns
Title

Definition at line 1295 of file Title.php.

References isSpecialPage(), makeTitle(), and NS_SPECIAL.

◆ fixUrlQueryArgs()

static Title::fixUrlQueryArgs (   $query,
  $query2 = false 
)
staticprivate

Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args get{Canonical,Full,Link,Local,Internal}URL methods accepted an optional second argument named variant.

This was deprecated in favor of passing an array of option with a "variant" key Once $query2 is removed for good, this helper can be dropped and the wfArrayToCgi moved to getLocalURL();

Since
1.19 (r105919)
Parameters
array | string$query
string | string[] | bool$query2
Returns
string

Definition at line 2147 of file Title.php.

References wfArrayToCgi(), and wfDeprecatedMsg().

Referenced by getCanonicalURL(), getFullURL(), getInternalURL(), and getLocalURL().

◆ flushRestrictions()

Title::flushRestrictions ( )

Flush the protection cache in this object and force reload from the database.

This is used when updating protection from WikiPage::doUpdateRestrictions().

Deprecated:
since 1.37, now internal

Definition at line 2684 of file Title.php.

◆ getAllRestrictions()

Title::getAllRestrictions ( )

Accessor/initialisation for mRestrictions.

Deprecated:
since 1.37, use RestrictionStore::getAllRestrictions instead
Returns
array Keys are actions, values are arrays as returned by Title::getRestrictions()
Since
1.23

Definition at line 2610 of file Title.php.

◆ getArticleID()

Title::getArticleID (   $flags = 0)

Get the article ID for this Title from the link cache, adding it if necessary.

Parameters
int$flagsEither a bitfield of class READ_* constants or GAID_FOR_UPDATE
Returns
int The ID

Definition at line 2862 of file Title.php.

References $mArticleID, canExist(), DBAccessObjectUtils\hasFlags(), and loadFieldFromDB().

Referenced by estimateRevisionCount(), exists(), getBrokenLinksFrom(), getContentModel(), getId(), getLatestRevID(), getLength(), getLinksFrom(), getParentCategories(), isBigDeletion(), isRedirect(), NamespaceDupes\mergePage(), MediaWiki\Block\Restriction\PageRestriction\newFromTitle(), and toPageRecord().

◆ getBacklinkCache()

Title::getBacklinkCache ( )

Get a backlink cache object.

Deprecated:
since 1.37, use BacklinkCacheFactory::getBacklinkCache()
Returns
BacklinkCache

Definition at line 3887 of file Title.php.

References wfDeprecated().

◆ getBaseText()

Title::getBaseText ( )

Get the base page name without a namespace, i.e.

the part before the subpage name

Note
the return value may contain trailing whitespace and is thus not safe for use with makeTitle or TitleValue.
Example:
Title::newFromText('User:Foo/Bar/Baz')->getBaseText();
# returns: 'Foo/Bar'
Returns
string Base name

Definition at line 2029 of file Title.php.

References findSubpageDivider(), getText(), and hasSubpagesEnabled().

Referenced by getBaseTitle().

◆ getBaseTitle()

Title::getBaseTitle ( )

Get the base page name title, i.e.

the part before the subpage name.

Example:
Title::newFromText('User:Foo/Bar/Baz')->getBaseTitle();
# returns: Title{User:Foo/Bar}
Returns
Title
Since
1.20

Definition at line 2056 of file Title.php.

References $title, getBaseText(), and makeTitleSafe().

◆ getBrokenLinksFrom()

Title::getBrokenLinksFrom ( )

Get an array of Title objects referring to non-existent articles linked from this page.

Todo:
check if needed (used only in SpecialBrokenRedirects.php, and should use redirect table in this case).
Returns
Title[]

Definition at line 3220 of file Title.php.

References $dbr, $res, DB_REPLICA, getArticleID(), makeTitle(), and wfGetDB().

◆ getCanonicalURL()

Title::getCanonicalURL (   $query = '',
  $query2 = false 
)

Get the URL for a canonical link, for use in things like IRC and e-mail notifications.

Uses $wgCanonicalServer and the GetCanonicalURL hook.

NOTE: Unlike getInternalURL(), the canonical URL includes the fragment

See also
self::getLocalURL for the arguments.
Parameters
string | array$query
string | bool$query2Deprecated
Returns
string The URL
Since
1.18

Definition at line 2393 of file Title.php.

References fixUrlQueryArgs(), getFragmentForURL(), getLocalURL(), PROTO_CANONICAL, Hooks\runner(), and wfExpandUrl().

◆ getCascadeProtectionSources()

Title::getCascadeProtectionSources (   $getPages = true)

Cascading protection: Get the source of any cascading restrictions on this page.

Deprecated:
since 1.37, use RestrictionStore::getCascadeProtectionSources instead
Parameters
bool$getPagesWhether or not to retrieve the actual pages that the restrictions have come from and the actual restrictions themselves.
Returns
array Two elements: First is an array of Title objects of the pages from which cascading restrictions have come if $getPages is true, or a bool indicating whetehr any cascading protection applies if $getPages was set to false. Second is an array like that returned by Title::getAllRestrictions(), or an empty array if $getPages is false.

Definition at line 2560 of file Title.php.

◆ getCategorySortkey()

Title::getCategorySortkey (   $prefix = '')

Returns the raw sort key to be used for categories, with the specified prefix.

This will be fed to Collation::getSortKey() to get a binary sortkey that can be used for actual sorting.

Parameters
string$prefixThe prefix to be used, specified using {{defaultsort:}} or like [[Category:Foo|prefix]]. Empty for no prefix.
Returns
string

Definition at line 3917 of file Title.php.

References getText(), and Hooks\runner().

◆ getCdnUrls()

Title::getCdnUrls ( )

Get a list of URLs to purge from the CDN cache when this page changes.

Deprecated:
1.35 Use HtmlCacheUpdater
Returns
string[]

Definition at line 3256 of file Title.php.

◆ getContentModel()

Title::getContentModel (   $flags = 0)

Get the page's content model id, see the CONTENT_MODEL_XXX constants.

Todo:
Deprecate this in favor of SlotRecord::getModel()
Parameters
int$flagsEither a bitfield of class READ_* constants or GAID_FOR_UPDATE
Returns
string Content model id

Definition at line 1080 of file Title.php.

References $mContentModel, getArticleID(), ContentHandler\getDefaultModelFor(), DBAccessObjectUtils\hasFlags(), lazyFillContentModel(), and loadFieldFromDB().

Referenced by MediaWiki\EditPage\TextConflictHelper\__construct(), SpecialChangeContentModel\getOptionsForTitle(), getPageLanguage(), getPageViewLanguage(), hasContentModel(), and SpecialWhatLinksHere\wlhLink().

◆ getDBkey()

◆ getDbPageLanguageCode()

Title::getDbPageLanguageCode ( )
private

Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false.

If there is no language saved in the db, it will return NULL.

Returns
string|null|bool

Definition at line 3943 of file Title.php.

References $mDbPageLanguage, and $wgPageLanguageUseDB.

Referenced by getPageLanguage(), getPageViewLanguage(), and toPageRecord().

◆ getDefaultMessageText()

Title::getDefaultMessageText ( )

Get the default (plain) message contents for an page that overrides an interface message key.

Primary use cases:

  • Article:
    • Show default when viewing the page. The Article::getSubstituteContent method displays the default message content, instead of the 'noarticletext' placeholder message normally used.
  • EditPage:
    • Title of edit page. When creating an interface message override, the editor is told they are "Editing the page", instead of "Creating the page". (EditPage::setHeaders)
    • Edit notice. The 'translateinterface' edit notice is shown when creating or editing an interface message override. (EditPage::showIntro)
    • Opening the editor. The contents of the localisation message are used as contents of the editor when creating a new page in the MediaWiki namespace. This simplifies the process for editors when "changing" an interface message by creating an override. (EditPage::getContentObject)
    • Showing a diff. The left-hand side of a diff when an editor is previewing their changes before saving the creation of a page in the MediaWiki namespace. (EditPage::showDiff)
    • Disallowing a save. When attempting to create a MediaWiki-namespace page with the proposed content matching the interface message default, the save is rejected, the same way we disallow blank pages from being created. (EditPage::internalAttemptSave)
  • ApiEditPage:
    • Default content, when using the 'prepend' or 'append' feature.
  • SkinTemplate:
    • Label the create action as "Edit", if the page can be an override.
Returns
string|bool

Definition at line 3676 of file Title.php.

References $lang, getText(), NS_MEDIAWIKI, and wfMessage().

◆ getDefaultNamespace()

Title::getDefaultNamespace ( )

Get the default namespace index, for when there is no namespace.

Deprecated:
since 1.37, no callers, should be removed.
Returns
int Default namespace index

Definition at line 1760 of file Title.php.

References $mDefaultNamespace, and wfDeprecated().

◆ getDeletedEditsCount()

Title::getDeletedEditsCount ( )

Is there a version of this page in the deletion archive?

Since
1.36
Returns
int The number of archived revisions

Definition at line 2801 of file Title.php.

References $dbr, DB_REPLICA, NS_FILE, and wfGetDB().

Referenced by isDeleted().

◆ getEditNotices()

Title::getEditNotices (   $oldid = 0)

Get a list of rendered edit notices for this page.

Array is keyed by the original message key, and values are rendered using parseAsBlock, so they will already be wrapped in paragraphs.

Since
1.21
Parameters
int$oldidRevision ID that's being edited
Returns
string[]

Definition at line 4054 of file Title.php.

References $mNamespace, Sanitizer\escapeClass(), hasSubpages(), Html\rawElement(), Hooks\runner(), and wfMessage().

◆ getEditURL()

Title::getEditURL ( )

Get the edit URL for this Title.

Returns
string The URL, or a null string if this is an interwiki link

Definition at line 2405 of file Title.php.

References $s, getLocalURL(), and isExternal().

◆ getFilteredRestrictionTypes()

static Title::getFilteredRestrictionTypes (   $exists = true)
static

Get a filtered list of all restriction types supported by this wiki.

Deprecated:
since 1.37, use RestrictionStore::listAllRestrictionTypes instead
Parameters
bool$existsTrue to get all restriction types that apply to titles that do exist, False for all restriction types that apply to titles that do not exist
Returns
array

Definition at line 2424 of file Title.php.

Referenced by ApiQueryAllPages\getAllowedParams(), and SpecialProtectedpages\getTypeMenu().

◆ getFragment()

Title::getFragment ( )

Get the Title fragment (i.e.

\ the bit after the #) in text form

Use Title::hasFragment to check for a fragment

Returns
string Title fragment

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1772 of file Title.php.

References $mFragment.

Referenced by WikiPage\insertRedirectEntry(), and isSameLinkAs().

◆ getFragmentForURL()

Title::getFragmentForURL ( )

Get the fragment in URL form, including the "#" character if there is one.

Returns
string Fragment in URL form

Definition at line 1791 of file Title.php.

References Sanitizer\escapeIdForExternalInterwiki(), Sanitizer\escapeIdForLink(), getInterwikiLookup(), hasFragment(), and isExternal().

Referenced by getCanonicalURL(), getFullURL(), and getLinkURL().

◆ getFullText()

Title::getFullText ( )

Get the prefixed title with spaces, plus any fragment (part beginning with '#')

Returns
string The prefixed title, with spaces and the fragment, including '#'

Definition at line 1919 of file Title.php.

References $mFragment, getPrefixedText(), and hasFragment().

Referenced by getParentCategories(), isValid(), WikitextContentHandler\makeRedirectContent(), WikitextContent\updateRedirect(), and warnIfPageCannotExist().

◆ getFullURL()

Title::getFullURL (   $query = '',
  $query2 = false,
  $proto = PROTO_RELATIVE 
)

Get a real URL referring to this title, with interwiki link and fragment.

See also
self::getLocalURL for the arguments.
wfExpandUrl
Parameters
string | array$query
string | string[] | bool$query2
string | int | null$protoProtocol type to use in URL
Returns
string The URL

Definition at line 2185 of file Title.php.

References fixUrlQueryArgs(), getFragmentForURL(), getLocalURL(), Hooks\runner(), and wfExpandUrl().

Referenced by getLinkURL(), CssContentHandler\makeRedirectContent(), and JavaScriptContentHandler\makeRedirectContent().

◆ getFullUrlForRedirect()

Title::getFullUrlForRedirect (   $query = '',
  $proto = PROTO_CURRENT 
)

Get a url appropriate for making redirects based on an untrusted url arg.

This is basically the same as getFullUrl(), but in the case of external interwikis, we send the user to a landing page, to prevent possible phishing attacks and the like.

Note
Uses current protocol by default, since technically relative urls aren't allowed in redirects per HTTP spec, so this is not suitable for places where the url gets cached, as might pollute between https and non-https users.
See also
self::getLocalURL for the arguments.
Parameters
array | string$query
string$protoProtocol type to use in URL
Returns
string A url suitable to use in an HTTP location header.

Definition at line 2218 of file Title.php.

References getPrefixedDBkey(), SpecialPage\getTitleFor(), and isExternal().

◆ getId()

Title::getId (   $wikiId = self::LOCAL)

Returns the page ID.

If this ID is 0, this means the page does not exist.

See also
getArticleID()
Since
1.35
Parameters
string | false$wikiIdThe wiki ID expected by the caller.
Exceptions
PreconditionExceptionif this Title instance does not represent a proper page, that is, if it is a section link, interwiki link, link to a special page, or such.
PreconditionExceptionif $wikiId is not false.
Returns
int

Implements Page\PageIdentity.

Definition at line 4199 of file Title.php.

References assertProperPage(), MediaWiki\DAO\WikiAwareEntity\assertWiki(), and getArticleID().

Referenced by toPageIdentity().

◆ getInternalURL()

Title::getInternalURL (   $query = '',
  $query2 = false 
)

Get the URL form for an internal link.

  • Used in various CDN-related code, in case we have a different internal hostname for the server from the exposed one.

This uses $wgInternalServer to qualify the path, or $wgServer if $wgInternalServer is not set. If the server variable used is protocol-relative, the URL will be expanded to http://

See also
self::getLocalURL for the arguments.
Parameters
string | array$query
string | bool$query2Deprecated
Returns
string The URL

Definition at line 2371 of file Title.php.

References $wgInternalServer, $wgServer, fixUrlQueryArgs(), getLocalURL(), PROTO_HTTP, Hooks\runner(), and wfExpandUrl().

◆ getInterwiki()

Title::getInterwiki ( )

Get the interwiki prefix.

Use Title::isExternal to check if a interwiki is set

Returns
string Interwiki prefix

Implements MediaWiki\Linker\LinkTarget.

Definition at line 969 of file Title.php.

References $mInterwiki.

Referenced by equals(), WikiPage\insertRedirectEntry(), WikitextContentHandler\makeRedirectContent(), and warnIfPageCannotExist().

◆ getInterwikiLookup()

static Title::getInterwikiLookup ( )
staticprivate

B/C kludge: provide an InterwikiLookup for use by Title.

Ideally, Title would have no methods that need this. Avoid usage of this singleton by using TitleValue and the associated services when possible.

Returns
InterwikiLookup

Definition at line 240 of file Title.php.

Referenced by getFragmentForURL(), getLocalURL(), getTransWikiID(), isLocal(), and isTrans().

◆ getLanguageConverter()

Title::getLanguageConverter (   $language)
private

Shorthand for getting a Language Converter for specific language.

Parameters
Language$languageLanguage of converter
Returns
ILanguageConverter

Definition at line 207 of file Title.php.

Referenced by getPageLanguageConverter(), and getPageViewLanguage().

◆ getLatestRevID()

Title::getLatestRevID (   $flags = 0)

What is the page_latest field for this page?

Parameters
int$flagsEither a bitfield of class READ_* constants or GAID_FOR_UPDATE
Returns
int Int or 0 if the page doesn't exist

Definition at line 2953 of file Title.php.

References $mLatestID, getArticleID(), DBAccessObjectUtils\hasFlags(), and loadFieldFromDB().

Referenced by RefreshLinksJob\getCurrentRevisionIfUnchanged(), and toPageRecord().

◆ getLength()

Title::getLength (   $flags = 0)

What is the length of this page? Uses link cache, adding it if necessary.

Parameters
int$flagsEither a bitfield of class READ_* constants or GAID_FOR_UPDATE
Returns
int

Definition at line 2926 of file Title.php.

References $mLength, getArticleID(), DBAccessObjectUtils\hasFlags(), and loadFieldFromDB().

◆ getLinksFrom()

Title::getLinksFrom (   $options = [],
  $table = 'pagelinks',
  $prefix = 'pl' 
)

Get an array of Title objects linked from this Title Also stores the IDs in the link cache.

WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.

Parameters
array$optionsQuery option to Database::select()
string$tableTable name
string$prefixFields prefix
Returns
Title[] List of Titles linking here

Definition at line 3154 of file Title.php.

References $res, DB_REPLICA, getArticleID(), WikiPage\getQueryInfo(), makeTitle(), newFromRow(), and wfGetDB().

Referenced by getTemplateLinksFrom().

◆ getLinksTo()

Title::getLinksTo (   $options = [],
  $table = 'pagelinks',
  $prefix = 'pl' 
)

Get an array of Title objects linking to this Title Also stores the IDs in the link cache.

WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.

Parameters
array$optionsMay be FOR UPDATE
string$tableTable name
string$prefixFields prefix
Returns
Title[]

Definition at line 3096 of file Title.php.

References $res, DB_PRIMARY, DB_REPLICA, LinkCache\getSelectFields(), makeTitle(), and wfGetDB().

Referenced by getTemplateLinksTo().

◆ getLinkURL()

Title::getLinkURL (   $query = '',
  $query2 = false,
  $proto = false 
)

Get a URL that's the simplest URL that will be valid to link, locally, to the current Title.

It includes the fragment, but does not include the server unless action=render is used (or the link is external). If there's a fragment but the prefixed text is empty, we just return a link to the fragment.

The result obviously should not be URL-escaped, but does need to be HTML-escaped if it's being output in HTML.

Parameters
string | array$query
bool$query2
string | int | bool$protoA PROTO_* constant on how the URL should be expanded, or false (default) for no expansion
See also
self::getLocalURL for the arguments.
Returns
string The URL

Definition at line 2346 of file Title.php.

References getFragmentForURL(), getFullURL(), getLocalURL(), getPrefixedText(), hasFragment(), and isExternal().

◆ getLocalURL()

Title::getLocalURL (   $query = '',
  $query2 = false 
)

Get a URL with no fragment or server name (relative URL) from a Title object.

If this page is generated with action=render, however, $wgServer is prepended to make an absolute URL.

See also
self::getFullURL to always get an absolute URL.
self::getLinkURL to always get a URL that's the simplest URL that will be valid to link, locally, to the current Title.
self::newFromText to produce a Title object.
Parameters
string | array$queryAn optional query string, not used for interwiki links. Can be specified as an associative array as well, e.g., [ 'action' => 'edit' ] (keys and values will be URL-escaped). Some query patterns will trigger various shorturl path replacements.
string | string[] | bool$query2An optional secondary query array. This one MUST be an array. If a string is passed it will be interpreted as a deprecated variant argument and urlencoded into a variant= argument. This second query argument will be added to the $query The second parameter is deprecated since 1.19. Pass it as a key,value pair in the first parameter array instead.
Returns
string

Definition at line 2252 of file Title.php.

References $matches, $wgActionPaths, $wgArticlePath, $wgMainPageIsDomainRoot, $wgScript, $wgVariantArticlePath, equals(), fixUrlQueryArgs(), PathRouter\getActionPaths(), getInterwikiLookup(), getNsText(), getPageLanguage(), getPageLanguageConverter(), getPrefixedDBkey(), isMainPage(), Hooks\runner(), wfAppendQuery(), and wfUrlencode().

Referenced by getCanonicalURL(), getEditURL(), getFullURL(), getInternalURL(), and getLinkURL().

◆ getNamespace()

◆ getNamespaceKey()

Title::getNamespaceKey (   $prepend = 'nstab-')

Generate strings used for xml 'id' names in monobook tabs.

Parameters
string$prependDefaults to 'nstab-'
Returns
string XML 'id' name

Definition at line 3791 of file Title.php.

References getSubjectNsText().

◆ getNotificationTimestamp()

Title::getNotificationTimestamp ( User  $user)

Get the timestamp when this page was updated since the user last saw it.

Deprecated:
since 1.35
Parameters
User$user
Returns
string|bool|null String timestamp, false if not watched, null if nothing is unseen

Definition at line 3779 of file Title.php.

◆ getNsText()

Title::getNsText ( )

Get the namespace text.

Returns
string|false Namespace text

Definition at line 1159 of file Title.php.

References getTitleFormatter(), isExternal(), and wfDebug().

Referenced by getLocalURL(), getSubjectNsText(), getTalkNsText(), and prefix().

◆ getOtherPage()

Title::getOtherPage ( )

Get the other title for this page, if this is a subject page get the talk page, if it is a subject page get the talk page.

Deprecated:
since 1.34, use NamespaceInfo::getAssociatedPage
Since
1.25
Exceptions
MWExceptionIf the page doesn't have an other page
Returns
Title

Definition at line 1734 of file Title.php.

References canHaveTalkPage(), getSubjectPage(), getTalkPage(), isSpecialPage(), and isTalkPage().

◆ getPageLanguage()

Title::getPageLanguage ( )

Get the language in which the content of this page is written in wikitext.

Defaults to content language, but in certain cases it can be e.g. $wgLang (such as special pages, which are in the user language).

Since
1.18
Returns
Language|StubUserLang

Definition at line 3965 of file Title.php.

References $wgLang, $wgLanguageCode, getContentModel(), getDbPageLanguageCode(), isSpecialPage(), and wfGetLangObj().

Referenced by getLocalURL(), and getPageLanguageConverter().

◆ getPageLanguageConverter()

Title::getPageLanguageConverter ( )
private

Shorthand for getting a Language Converter for page's language.

Returns
ILanguageConverter

Definition at line 216 of file Title.php.

References getLanguageConverter(), and getPageLanguage().

Referenced by getLocalURL().

◆ getPageViewLanguage()

Title::getPageViewLanguage ( )

Get the language in which the content of this page is written when viewed by user.

Defaults to content language, but in certain cases it can be e.g. $wgLang (such as special pages, which are in the user language).

Since
1.20
Returns
Language|StubUserLang

Definition at line 4006 of file Title.php.

References $wgLang, getContentModel(), getDbPageLanguageCode(), getLanguageConverter(), isSpecialPage(), and wfGetLangObj().

◆ getParentCategories()

Title::getParentCategories ( )

Get categories to which this Title belongs and return an array of categories' names.

Returns
string[] Array of parents in the form: $parent => $currentarticle

Definition at line 3315 of file Title.php.

References $dbr, $res, DB_REPLICA, getArticleID(), getFullText(), NS_CATEGORY, and wfGetDB().

Referenced by getParentCategoryTree().

◆ getParentCategoryTree()

Title::getParentCategoryTree (   $children = [])

Get a tree of parent categories.

Parameters
array$childrenArray with the children in the keys, to check for circular refs
Returns
array Tree of parent categories

Definition at line 3350 of file Title.php.

References getParentCategories(), and newFromText().

◆ getPartialURL()

Title::getPartialURL ( )

Get the URL-encoded form of the main part.

Returns
string Main part of the title, URL-encoded

Definition at line 1050 of file Title.php.

References $mUrlform.

◆ getPrefixedDBkey()

Title::getPrefixedDBkey ( )

Get the prefixed database key form.

Returns
string The prefixed title, with underscores and any interwiki and namespace prefixes

Definition at line 1883 of file Title.php.

References $s, and prefix().

Referenced by PPTemplateFrame_Hash\__construct(), getFullUrlForRedirect(), getLocalURL(), PPFrame_Hash\loopCheck(), and LinkHolderArray\makeHolder().

◆ getPrefixedText()

Title::getPrefixedText ( )

◆ getPrefixedURL()

Title::getPrefixedURL ( )

Get a URL-encoded title (not an actual URL) including interwiki.

Returns
string The URL-encoded form

Definition at line 2128 of file Title.php.

References $s, prefix(), and wfUrlencode().

◆ getRedirectsHere()

Title::getRedirectsHere (   $ns = null)

Get all extant redirects to this Title.

Parameters
int | null$nsSingle namespace to consider; null to consider all namespaces
Returns
Title[]

Definition at line 3820 of file Title.php.

References $dbr, $mDbkeyform, $mInterwiki, $mNamespace, $res, DB_REPLICA, isExternal(), newFromRow(), and wfGetDB().

◆ getRestrictionExpiry()

Title::getRestrictionExpiry (   $action)

Get the expiry time for the restriction against a given action.

Deprecated:
since 1.37, use RestrictionStore::getRestrictionExpiry instead
Parameters
string$action
Returns
string|bool 14-char timestamp, or 'infinity' if the page is protected forever or not protected at all, or false if the action is not recognised.

Definition at line 2623 of file Title.php.

◆ getRestrictions()

Title::getRestrictions (   $action)

Accessor/initialisation for mRestrictions.

Deprecated:
since 1.37, use RestrictionStore::getRestrictions instead
Parameters
string$actionAction that permission needs to be checked for
Returns
array Restriction levels needed to take the action. All levels are required. Note that restriction levels are normally user rights, but 'sysop' and 'autoconfirmed' are also allowed for backwards compatibility. These should be mapped to 'editprotected' and 'editsemiprotected' respectively.

Definition at line 2597 of file Title.php.

◆ getRestrictionTypes()

Title::getRestrictionTypes ( )

Returns restriction types for the current Title.

Deprecated:
since 1.37, use RestrictionStore::listApplicableRestrictionTypes instead
Returns
array Applicable restriction types

Definition at line 2437 of file Title.php.

◆ getRootText()

Title::getRootText ( )

Get the root page name text without a namespace, i.e.

the leftmost part before any slashes

Note
the return value may contain trailing whitespace and is thus not safe for use with makeTitle or TitleValue.
Example:
Title::newFromText('User:Foo/Bar/Baz')->getRootText();
# returns: 'Foo'
Returns
string Root name
Since
1.20

Definition at line 1979 of file Title.php.

References findSubpageDivider(), getText(), and hasSubpagesEnabled().

Referenced by getRootTitle().

◆ getRootTitle()

Title::getRootTitle ( )

Get the root page name title, i.e.

the leftmost part before any slashes

Example:
Title::newFromText('User:Foo/Bar/Baz')->getRootTitle();
# returns: Title{User:Foo}
Returns
Title
Since
1.20

Definition at line 2006 of file Title.php.

References $title, getRootText(), and makeTitleSafe().

Referenced by isRawHtmlMessage().

◆ getSelectFields()

static Title::getSelectFields ( )
staticprotected

Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries.

Deprecated:
since 1.36, use PageStore::newSelectQueryBuilder() instead.
Returns
array

Definition at line 517 of file Title.php.

◆ getSkinFromConfigSubpage()

Title::getSkinFromConfigSubpage ( )

Trim down a .css, .json, or .js subpage title to get the corresponding skin name.

Returns
string Containing skin name from .css, .json, or .js subpage title
Since
1.31

Definition at line 1484 of file Title.php.

References findSubpageDivider(), and getText().

◆ getSubjectNsText()

Title::getSubjectNsText ( )

Get the namespace text of the subject (rather than talk) page.

Returns
string Namespace text

Definition at line 1184 of file Title.php.

References getNsText().

Referenced by getNamespaceKey().

◆ getSubjectPage()

Title::getSubjectPage ( )

Get a title object associated with the subject page of this talk page.

Deprecated:
since 1.34, use NamespaceInfo::getSubjectPage
Returns
Title The object for the subject page

Definition at line 1677 of file Title.php.

References $title, makeTitle(), and warnIfPageCannotExist().

Referenced by getOtherPage().

◆ getSubpage()

Title::getSubpage (   $text)

Get the title for a subpage of the current page.

Example:
Title::newFromText('User:Foo/Bar/Baz')->getSubpage("Asdf");
# returns: Title{User:Foo/Bar/Baz/Asdf}
Parameters
string$textThe subpage name to add to the title
Returns
Title|null Subpage title, or null on an error
Since
1.20

Definition at line 2103 of file Title.php.

References getText(), and makeTitleSafe().

◆ getSubpages()

Title::getSubpages (   $limit = -1)

Get all subpages of this page.

Parameters
int$limitMaximum number of subpages to fetch; -1 for no limit
Returns
TitleArray|array TitleArray, or empty array if this page's namespace doesn't allow subpages

Definition at line 2762 of file Title.php.

References getDBkey(), getNamespace(), hasSubpages(), and TitleArray\newFromResult().

Referenced by hasSubpages().

◆ getSubpageText()

Title::getSubpageText ( )

Get the lowest-level subpage name, i.e.

the rightmost part after any slashes

Example:
Title::newFromText('User:Foo/Bar/Baz')->getSubpageText();
# returns: "Baz"
Returns
string Subpage name

Definition at line 2076 of file Title.php.

References findSubpageDivider(), getText(), and hasSubpagesEnabled().

Referenced by getSubpageUrlForm().

◆ getSubpageUrlForm()

Title::getSubpageUrlForm ( )

Get a URL-encoded form of the subpage text.

Returns
string URL-encoded subpage name

Definition at line 2117 of file Title.php.

References getSubpageText(), and wfUrlencode().

◆ getTalkNsText()

Title::getTalkNsText ( )

Get the namespace text of the talk page.

Returns
string Namespace text

Definition at line 1195 of file Title.php.

References getNsText().

◆ getTalkPage()

Title::getTalkPage ( )

Get a Title object associated with the talk page of this article.

Deprecated:
since 1.34, use getTalkPageIfDefined() or NamespaceInfo::getTalkPage() with NamespaceInfo::canHaveTalkPage(). Note that the new method will throw if asked for the talk page of a section-only link, or of an interwiki link.
Returns
Title The object for the talk page
Exceptions
MWExceptionif $target doesn't have talk pages, e.g. because it's in NS_SPECIAL or because it's a relative link, or an interwiki link.

Definition at line 1632 of file Title.php.

References $title, makeTitle(), and warnIfPageCannotExist().

Referenced by getOtherPage(), and getTalkPageIfDefined().

◆ getTalkPageIfDefined()

Title::getTalkPageIfDefined ( )

Get a Title object associated with the talk page of this article, if such a talk page can exist.

Since
1.30
Returns
Title|null The object for the talk page, or null if no associated talk page can exist, according to canHaveTalkPage().

Definition at line 1662 of file Title.php.

References canHaveTalkPage(), and getTalkPage().

◆ getTemplateLinksFrom()

Title::getTemplateLinksFrom (   $options = [])

Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache.

WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.

Parameters
array$optionsMay be FOR UPDATE
Returns
Title[]

Definition at line 3208 of file Title.php.

References getLinksFrom().

◆ getTemplateLinksTo()

Title::getTemplateLinksTo (   $options = [])

Get an array of Title objects using this Title as a template Also stores the IDs in the link cache.

WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.

Parameters
array$optionsQuery option to Database::select()
Returns
Title[]

Definition at line 3138 of file Title.php.

References getLinksTo().

◆ getText()

◆ getTitleCache()

static Title::getTitleCache ( )
staticprivate
Returns
MapCacheLRU

Definition at line 502 of file Title.php.

References $titleCache.

Referenced by clearCaches(), newFromTextThrow(), and uncache().

◆ getTitleFormatter()

static Title::getTitleFormatter ( )
staticprivate

B/C kludge: provide a TitleParser for use by Title.

Ideally, Title would have no methods that need this. Avoid usage of this singleton by using TitleValue and the associated services when possible.

Returns
TitleFormatter

Definition at line 228 of file Title.php.

Referenced by getNsText().

◆ getTitleProtection()

Title::getTitleProtection ( )

Is this title subject to title protection? Title protection is the one applied against creation of such title.

Deprecated:
since 1.37, use RestrictionStore::getRestrictions() instead
Returns
array|bool An associative array representing any existent title protection, or false if there's none.

Definition at line 2452 of file Title.php.

◆ getTitleValue()

Title::getTitleValue ( )

Get a TitleValue object representing this Title.

Note
Not all valid Titles have a corresponding valid TitleValue (e.g. TitleValues cannot represent page-local links that have a fragment but no title text).
Returns
TitleValue|null

Definition at line 1018 of file Title.php.

References $mTitleValue, getPrefixedText(), and wfDebug().

◆ getTouched()

Title::getTouched (   $db = null)

Get the last touched timestamp.

Parameters
IDatabase | null$db
Returns
string|false Last-touched timestamp

Definition at line 3763 of file Title.php.

References DB_REPLICA, pageCond(), and wfGetDB().

Referenced by toPageRecord().

◆ getTransWikiID()

Title::getTransWikiID ( )

Returns the DB name of the distant wiki which owns the object.

Returns
string|false The DB name

Definition at line 1001 of file Title.php.

References getInterwikiLookup(), and isExternal().

◆ getWikiId()

Title::getWikiId ( )

Returns false to indicate that this Title belongs to the local wiki.

Note
The behavior of this method if considered undefined for interwiki links. At the moment, this method always returns false. But this may change in the future.
Since
1.36
Returns
bool false

Implements Page\PageReference.

Definition at line 4179 of file Title.php.

Referenced by toPageRecord().

◆ hasContentModel()

Title::hasContentModel (   $id)

Convenience method for checking a title's content model name.

Parameters
string$idThe content model ID (use the CONTENT_MODEL_XXX constants).
Returns
bool True if $this->getContentModel() == $id

Definition at line 1113 of file Title.php.

References getContentModel().

Referenced by isSiteCssConfigPage(), isSiteJsConfigPage(), isSiteJsonConfigPage(), isUserCssConfigPage(), isUserJsConfigPage(), isUserJsonConfigPage(), and isWikitextPage().

◆ hasDeletedEdits()

Title::hasDeletedEdits ( )

Is there a version of this page in the deletion archive?

Since
1.36
Returns
bool

Definition at line 2837 of file Title.php.

References $dbr, DB_REPLICA, NS_FILE, and wfGetDB().

Referenced by isDeletedQuick(), and File\wasDeleted().

◆ hasFragment()

Title::hasFragment ( )

Check if a Title fragment is set.

Returns
bool
Since
1.23

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1782 of file Title.php.

Referenced by getFragmentForURL(), getFullText(), and getLinkURL().

◆ hasSourceText()

Title::hasSourceText ( )

Does this page have source text?

Returns
bool

Definition at line 3617 of file Title.php.

References Page\PageIdentity\exists(), NS_MEDIAWIKI, and wfMessage().

Referenced by isAlwaysKnown().

◆ hasSubjectNamespace()

Title::hasSubjectNamespace (   $ns)

Returns true if the title has the same subject namespace as the namespace specified.

For example this method will take NS_USER and return true if namespace is either NS_USER or NS_USER_TALK since both of them have NS_USER as their subject namespace.

This is MUCH simpler than individually testing for equivalence against both NS_USER and NS_USER_TALK, and is also forward compatible.

Since
1.19
Parameters
int$ns
Returns
bool

Definition at line 1358 of file Title.php.

◆ hasSubpages()

Title::hasSubpages ( )

Does this have subpages? (Warning, usually requires an extra DB query.)

Returns
bool

Definition at line 2734 of file Title.php.

References $mHasSubpages, and getSubpages().

Referenced by getEditNotices(), getSubpages(), hasSubpagesEnabled(), and isSubpage().

◆ hasSubpagesEnabled()

Title::hasSubpagesEnabled ( )
private

Whether this Title's namespace has subpages enabled.

Returns
bool

Definition at line 1959 of file Title.php.

References hasSubpages().

Referenced by getBaseText(), getRootText(), and getSubpageText().

◆ inNamespace()

Title::inNamespace (   $ns)

Returns true if the title is inside the specified namespace.

Please make use of this instead of comparing to getNamespace() This function is much more resistant to changes we may make to namespaces than code that makes direct comparisons.

Parameters
int$nsThe namespace
Returns
bool
Since
1.19

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1319 of file Title.php.

References equals().

Referenced by inNamespaces(), and isRawHtmlMessage().

◆ inNamespaces()

Title::inNamespaces (   $namespaces)

Returns true if the title is inside one of the specified namespaces.

Parameters
int|int[]...$namespaces The namespaces to check for
Returns
bool
Since
1.19

Definition at line 1331 of file Title.php.

References inNamespace().

◆ invalidateCache()

Title::invalidateCache (   $purgeTime = null)

Updates page_touched for this page; called from LinksUpdate.php.

Parameters
string | null$purgeTime[optional] TS_MW timestamp
Returns
bool True if the update succeeded

Definition at line 3699 of file Title.php.

References Wikimedia\Rdbms\IDatabase\addQuotes(), DeferredUpdates\addUpdate(), DB_PRIMARY, Wikimedia\Rdbms\IDatabase\getDomainID(), ResourceLoaderWikiModule\invalidateModuleCache(), pageCond(), Wikimedia\Rdbms\IDatabase\timestamp(), Wikimedia\Rdbms\IDatabase\update(), wfGetDB(), and wfReadOnly().

Referenced by File\purgeDescription(), and LocalFile\recordUpload3().

◆ isAlwaysKnown()

Title::isAlwaysKnown ( )

Should links to this title be shown as potentially viewable (i.e.

as "bluelinks"), even if there's no record by this title in the page table?

This function is semi-deprecated for public use, as well as somewhat misleadingly named. You probably just want to call isKnown(), which calls this function internally.

(ISSUE: Most of these checks are cheap, but the file existence check can potentially be quite expensive. Including it here fixes a lot of existing code, but we might want to add an optional parameter to skip it and any other expensive checks.)

Returns
bool

Definition at line 3554 of file Title.php.

References hasSourceText(), isExternal(), NS_FILE, NS_MAIN, NS_MEDIA, NS_MEDIAWIKI, NS_SPECIAL, and Hooks\runner().

Referenced by isKnown().

◆ isBigDeletion()

Title::isBigDeletion ( )

Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.

Deprecated:
since 1.37 External callers shouldn't need to know about this.
Returns
bool

Definition at line 3402 of file Title.php.

References $dbr, $mIsBigDeletion, $wgDeleteRevisionsLimit, DB_REPLICA, getArticleID(), and wfGetDB().

◆ isCascadeProtected()

Title::isCascadeProtected ( )

Cascading protection: Return true if cascading restrictions apply to this page, false if not.

Deprecated:
since 1.37, use RestrictionStore::isCascadeProtected instead
Returns
bool If the page is subject to cascading restrictions.

Definition at line 2527 of file Title.php.

◆ isContentPage()

Title::isContentPage ( )

Is this Title in a namespace which contains content? In other words, is this a content page, for the purposes of calculating statistics, etc?

Returns
bool

Definition at line 1370 of file Title.php.

◆ isConversionTable()

Title::isConversionTable ( )

Is this a conversion table for the LanguageConverter?

Returns
bool

Definition at line 1426 of file Title.php.

References getText(), and NS_MEDIAWIKI.

◆ isDeleted()

Title::isDeleted ( )

Is there a version of this page in the deletion archive?

Deprecated:
since 1.36. Use self::getDeletedEditsCount()
Returns
int The number of archived revisions

Definition at line 2791 of file Title.php.

References getDeletedEditsCount().

◆ isDeletedQuick()

Title::isDeletedQuick ( )

Is there a version of this page in the deletion archive?

Deprecated:
since 1.36, Use self::hasDeletedEdits()
Returns
bool

Definition at line 2827 of file Title.php.

References hasDeletedEdits().

◆ isExternal()

◆ isKnown()

Title::isKnown ( )

Does this title refer to a page that can (or might) be meaningfully viewed? In particular, this function may be used to determine if links to the title should be rendered as "bluelinks" (as opposed to "redlinks" to non-existent pages).

Adding something else to this function will cause inconsistency since LinkHolderArray calls isAlwaysKnown() and does its own page existence check.

Returns
bool

Definition at line 3608 of file Title.php.

References Page\PageIdentity\exists(), and isAlwaysKnown().

◆ isLocal()

Title::isLocal ( )

Determine whether the object refers to a page within this project (either this wiki or a wiki with a local interwiki, see https://www.mediawiki.org/wiki/Manual:Interwiki_table#iw_local )

Returns
bool True if this is an in-project interwiki link or a wikilink, false otherwise

Definition at line 943 of file Title.php.

References getInterwikiLookup(), and isExternal().

◆ isMainPage()

Title::isMainPage ( )

Is this the mainpage?

Note
Title::newFromText seems to be sufficiently optimized by the title cache that we don't need to over-optimize by doing direct comparisons and accidentally creating new bugs where $title->equals( Title::newFromText() ) ends up reporting something differently than $title->isMainPage();
Since
1.18
Returns
bool

Definition at line 1405 of file Title.php.

References equals().

Referenced by getLocalURL().

◆ isMovable()

Title::isMovable ( )

Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable.

Returns
bool

Definition at line 1381 of file Title.php.

References isExternal(), and Hooks\runner().

◆ isNamespaceProtected()

Title::isNamespaceProtected ( User  $user)

Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection.

Deprecated:
since 1.34, hard-deprecated since 1.37
Parameters
User$userUser object to check permissions
Returns
bool

Definition at line 2504 of file Title.php.

References $wgNamespaceProtection, and wfDeprecated().

◆ isNewPage()

Title::isNewPage ( )

Check if this is a new page.

Returns
bool

Definition at line 3391 of file Title.php.

References $dbr, DB_REPLICA, pageCond(), and wfGetDB().

Referenced by toPageRecord().

◆ isProtected()

Title::isProtected (   $action = '')

Does the title correspond to a protected article?

Deprecated:
since 1.37, use RestrictionStore::isProtected instead
Parameters
string$actionThe action the page is protected from, by default checks all actions.
Returns
bool

Definition at line 2490 of file Title.php.

◆ isRawHtmlMessage()

Title::isRawHtmlMessage ( )

Is this a message which can contain raw HTML?

Returns
bool
Since
1.32

Definition at line 1601 of file Title.php.

References $wgRawHtmlMessages, getDBkey(), getRootTitle(), inNamespace(), and NS_MEDIAWIKI.

◆ isRedirect()

Title::isRedirect (   $flags = 0)

Is this an article that is a redirect page? Uses link cache, adding it if necessary.

This is intended to provide fast access to page_is_redirect for linking. In rare cases, there might not be a valid target in the redirect table even though this function returns true.

To find a redirect target, just call WikiPage::getRedirectTarget() and check if it returns null, there's no need to call this first.

Parameters
int$flagsEither a bitfield of class READ_* constants or GAID_FOR_UPDATE
Returns
bool

Definition at line 2901 of file Title.php.

References $mRedirect, getArticleID(), DBAccessObjectUtils\hasFlags(), and loadFieldFromDB().

Referenced by toPageRecord().

◆ isSameLinkAs()

Title::isSameLinkAs ( LinkTarget  $other)

◆ isSamePageAs()

Title::isSamePageAs ( PageReference  $other)
See also
PageReference::isSamePageAs()
Since
1.36
Parameters
PageReference$other
Returns
bool

Implements Page\PageReference.

Definition at line 3495 of file Title.php.

References Page\PageReference\getDBkey(), Page\PageReference\getNamespace(), and Page\PageReference\getWikiId().

◆ isSemiProtected()

Title::isSemiProtected (   $action = 'edit')

Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels?

Deprecated:
since 1.37, use RestrictionStore::isSemiProtected instead
Parameters
string$actionAction to check (default: edit)
Returns
bool

Definition at line 2475 of file Title.php.

◆ isSingleRevRedirect()

Title::isSingleRevRedirect ( )

Locks the page row and check if this page is single revision redirect.

This updates the cached fields of this instance via Title::loadFromRow()

Returns
bool

Definition at line 3277 of file Title.php.

References DB_PRIMARY, loadFromRow(), pageCond(), and wfGetDB().

◆ isSiteConfigPage()

Title::isSiteConfigPage ( )

Could this MediaWiki namespace page contain custom CSS, JSON, or JavaScript for the global UI.

This is generally true for pages in the MediaWiki namespace having CONTENT_MODEL_CSS, CONTENT_MODEL_JSON, or CONTENT_MODEL_JAVASCRIPT.

This method does not return true for per-user JS/JSON/CSS. Use isUserConfigPage() for that!

Note that this method should not return true for pages that contain and show "inactive" CSS, JSON, or JS.

Returns
bool
Since
1.31

Definition at line 1456 of file Title.php.

References isSiteCssConfigPage(), isSiteJsConfigPage(), and isSiteJsonConfigPage().

◆ isSiteCssConfigPage()

Title::isSiteCssConfigPage ( )

Is this a sitewide CSS "config" page?

Returns
bool
Since
1.32

Definition at line 1547 of file Title.php.

References CONTENT_MODEL_CSS, hasContentModel(), and NS_MEDIAWIKI.

Referenced by isSiteConfigPage().

◆ isSiteJsConfigPage()

Title::isSiteJsConfigPage ( )

Is this a sitewide JS "config" page?

Returns
bool
Since
1.31

Definition at line 1583 of file Title.php.

References CONTENT_MODEL_JAVASCRIPT, hasContentModel(), and NS_MEDIAWIKI.

Referenced by isSiteConfigPage().

◆ isSiteJsonConfigPage()

Title::isSiteJsonConfigPage ( )

Is this a sitewide JSON "config" page?

Returns
bool
Since
1.32

Definition at line 1565 of file Title.php.

References CONTENT_MODEL_JSON, hasContentModel(), and NS_MEDIAWIKI.

Referenced by isSiteConfigPage().

◆ isSpecial()

Title::isSpecial (   $name)

Returns true if this title resolves to the named special page.

Parameters
string$nameThe special page name
Returns
bool

Definition at line 1277 of file Title.php.

References isSpecialPage().

Referenced by isValidRedirectTarget().

◆ isSpecialPage()

Title::isSpecialPage ( )

Returns true if this is a special page.

Returns
bool

Definition at line 1267 of file Title.php.

References NS_SPECIAL.

Referenced by SkinTemplate\buildPersonalUrls(), fixSpecialName(), getOtherPage(), getPageLanguage(), getPageViewLanguage(), isSpecial(), isValidRedirectTarget(), and secureAndSplit().

◆ isSubpage()

Title::isSubpage ( )

Is this a subpage?

Returns
bool

Definition at line 1414 of file Title.php.

References getText(), and hasSubpages().

Referenced by isUserCssConfigPage(), isUserJsConfigPage(), and isUserJsonConfigPage().

◆ isSubpageOf()

Title::isSubpageOf ( Title  $title)

Check if this title is a subpage of another title.

Parameters
Title$title
Returns
bool

Definition at line 3516 of file Title.php.

References $title.

◆ isTalkPage()

Title::isTalkPage ( )

Is this a talk page of some sort?

Returns
bool

Definition at line 1616 of file Title.php.

Referenced by getOtherPage().

◆ isTrans()

Title::isTrans ( )

Determine whether the object refers to a page within this project and is transcludable.

Returns
bool True if this is transcludable

Definition at line 988 of file Title.php.

References getInterwikiLookup(), and isExternal().

◆ isUserConfigPage()

Title::isUserConfigPage ( )

Is this a "config" (.css, .json, or .js) sub-page of a user page?

Returns
bool
Since
1.31

Definition at line 1470 of file Title.php.

References isUserCssConfigPage(), isUserJsConfigPage(), and isUserJsonConfigPage().

◆ isUserCssConfigPage()

Title::isUserCssConfigPage ( )

Is this a CSS "config" sub-page of a user page?

Returns
bool
Since
1.31

Definition at line 1505 of file Title.php.

References CONTENT_MODEL_CSS, hasContentModel(), isSubpage(), and NS_USER.

Referenced by isUserConfigPage().

◆ isUserJsConfigPage()

Title::isUserJsConfigPage ( )

Is this a JS "config" sub-page of a user page?

Returns
bool
Since
1.31

Definition at line 1533 of file Title.php.

References CONTENT_MODEL_JAVASCRIPT, hasContentModel(), isSubpage(), and NS_USER.

Referenced by isUserConfigPage().

◆ isUserJsonConfigPage()

Title::isUserJsonConfigPage ( )

Is this a JSON "config" sub-page of a user page?

Returns
bool
Since
1.31

Definition at line 1519 of file Title.php.

References CONTENT_MODEL_JSON, hasContentModel(), isSubpage(), and NS_USER.

Referenced by isUserConfigPage().

◆ isValid()

Title::isValid ( )

Returns true if the title is a valid link target, and that it has been properly normalized.

This method checks that the title is syntactically valid, and that the namespace it refers to exists.

Titles constructed using newFromText() or makeTitleSafe() are always valid.

Note
Code that wants to check whether the title can represent a page that can be created and edited should use canExist() instead. Examples of valid titles that cannot "exist" are Special pages, interwiki links, and on-page section links that only have the fragment part set.
See also
canExist()
Returns
bool

Definition at line 904 of file Title.php.

References $mIsValid, and getFullText().

Referenced by canExist(), and isValidRedirectTarget().

◆ isValidRedirectTarget()

Title::isValidRedirectTarget ( )

Check if this Title is a valid redirect target.

Returns
bool

Definition at line 3856 of file Title.php.

References $wgInvalidRedirectTargets, getDBkey(), isSpecial(), isSpecialPage(), and isValid().

Referenced by AbstractContent\getRedirectChain(), WikiPage\insertRedirectEntry(), and XmlDumpWriter\openPage().

◆ isWikitextPage()

Title::isWikitextPage ( )

Does that page contain wikitext, or it is JS, CSS or whatever?

Returns
bool

Definition at line 1438 of file Title.php.

References CONTENT_MODEL_WIKITEXT, and hasContentModel().

◆ lazyFillContentModel()

Title::lazyFillContentModel (   $model)
private

If the content model field is not frozen then update it with a retrieved value.

Parameters
string | bool$modelCONTENT_MODEL_XXX constant or false

Definition at line 1148 of file Title.php.

Referenced by getContentModel(), and loadFromRow().

◆ legalChars()

static Title::legalChars ( )
static

Get a regex character class describing the legal characters in a link.

Returns
string The list of characters, not delimited

Definition at line 736 of file Title.php.

References $wgLegalTitleChars.

Referenced by ApiQuerySiteinfo\appendGeneralInfo(), CleanupImages\buildSafeTitle(), MediaWikiTitleCodec\getTitleInvalidRegex(), Parser\handleInternalLinks2(), Parser\pstPass2(), and wfStripIllegalFilenameChars().

◆ loadFieldFromDB()

Title::loadFieldFromDB (   $field,
  $flags 
)
private
Parameters
string$field
int$flagsBitfield of class READ_* constants
Returns
string|bool

Definition at line 4129 of file Title.php.

References GAID_FOR_UPDATE, DBAccessObjectUtils\getDBOptions(), pageCond(), and wfGetDB().

Referenced by getArticleID(), getContentModel(), getLatestRevID(), getLength(), and isRedirect().

◆ loadFromRow()

Title::loadFromRow (   $row)

Load Title object fields from a DB row.

If false is given, the title will be treated as non-existing.

Parameters
stdClass | bool$rowDatabase row

Definition at line 591 of file Title.php.

References lazyFillContentModel().

Referenced by isSingleRevRedirect().

◆ loadRestrictions()

Title::loadRestrictions (   $oldFashionedRestrictions = null,
  $flags = 0 
)

Load restrictions from the page_restrictions table.

Deprecated:
since 1.37, no public replacement
Parameters
string | null$oldFashionedRestrictionsComma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. Edit and move sections are separated by a colon Example: "edit=autoconfirmed,sysop:move=sysop"
int$flagsA bit field. If self::READ_LATEST is set, skip replicas and read from the primary DB.

Definition at line 2673 of file Title.php.

◆ loadRestrictionsFromRows()

Title::loadRestrictionsFromRows (   $rows,
  $oldFashionedRestrictions = null 
)

Compiles list of active page restrictions from both page table (pre 1.10) and page_restrictions table for this existing page.

Public for usage by LiquidThreads.

Deprecated:
since 1.37, use RestrictionStore::loadRestrictionsFromRows instead
Parameters
stdClass[]$rowsArray of db result objects
string | null$oldFashionedRestrictionsComma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. Edit and move sections are separated by a colon Example: "edit=autoconfirmed,sysop:move=sysop"

Definition at line 2655 of file Title.php.

◆ makeName()

static Title::makeName (   $ns,
  $title,
  $fragment = '',
  $interwiki = '',
  $canonicalNamespace = false 
)
static

Make a prefixed DB key from a DB key and a namespace index.

Parameters
int$nsNumerical representation of the namespace
string$titleThe DB key form the title
string$fragmentThe link fragment (after the "#")
string$interwikiThe interwiki prefix
bool$canonicalNamespaceIf true, use the canonical name for $ns instead of the localized version.
Returns
string The prefixed form of the title

Definition at line 856 of file Title.php.

References $title.

Referenced by SpecialRedirect\dispatchFile(), MovePageForm\doSubmit(), SpecialExport\getPagesFromCategory(), SpecialExport\getPagesFromNamespace(), makeTitleSafe(), TitleCleanup\processRow(), and HTMLTitleTextField\validate().

◆ makeTitle()

static Title::makeTitle (   $ns,
  $title,
  $fragment = '',
  $interwiki = '' 
)
static

Create a new Title from a namespace index and a DB key.

It's assumed that $ns and $title are safe, for instance when they came directly from the database or a special page name, not from user input.

No validation is applied. For convenience, spaces are normalized to underscores, so that e.g. user_text fields can be used directly.

Note
This method may return Title objects that are "invalid" according to the isValid() method. This is usually caused by configuration changes: e.g. a namespace that was once defined is no longer configured, or a character that was once allowed in titles is now forbidden.
Parameters
int$nsThe namespace of the article
string$titleThe unprefixed database key form
string$fragmentThe link fragment (after the "#")
string$interwikiThe interwiki prefix
Returns
Title The new object

Definition at line 650 of file Title.php.

References $t, $title, normalizeFragment(), and wfUrlencode().

Referenced by Job\__construct(), DeletePageJob\__construct(), MediaWiki\Block\AbstractBlock\appliesToUsertalk(), ChangesFeed\buildItems(), castFromPageReference(), FindOrphanedFiles\checkFiles(), LocalRepo\checkRedirect(), Orphans\checkSeparation(), SpecialEditWatchlist\cleanupWatchlist(), CompressOld\compressWithConcat(), BenchmarkTitleValue\constructTitle(), ApiFeedWatchlist\createFeedItem(), createFragmentTarget(), UppercaseTitlesForUnicodeTransition\doMove(), UppercaseTitlesForUnicodeTransition\doUpdate(), LinkHolderArray\doVariants(), SpecialPasswordPolicies\execute(), ApiBlock\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), AttachLatest\execute(), CheckBadRedirects\execute(), DeleteDefaultMessages\execute(), DeleteEqualMessages\execute(), DumpLinks\execute(), FixDoubleRedirects\execute(), NukeNS\execute(), PurgeChangedPages\execute(), SqlSearchResultSet\extractResults(), ApiQueryLogEvents\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryUserContribs\extractRowInfo(), Job\factory(), ApiFeedContributions\feedItem(), SpecialNewpages\feedItem(), ForeignAPIRepo\findBySha1(), DoubleRedirectJob\fixRedirects(), fixSpecialName(), WikiFilePage\followRedirect(), MediaWiki\Search\SearchWidgets\InterwikiSearchResultSetWidget\footerHtml(), ApiParse\formatCategoryLinks(), FeedUtils\formatDiff(), ApiParse\formatLinks(), SpecialAncientPages\formatResult(), SpecialBrokenRedirects\formatResult(), SpecialDoubleRedirects\formatResult(), SpecialListDuplicatedFiles\formatResult(), SpecialListRedirects\formatResult(), SpecialMIMESearch\formatResult(), SpecialUncategorizedCategories\formatResult(), SpecialUnusedCategories\formatResult(), SpecialUnusedTemplates\formatResult(), SpecialWantedCategories\formatResult(), DeletedContribsPager\formatRevisionRow(), SpecialNewpages\formatRow(), NewFilesPager\formatRow(), AllMessagesTablePager\formatValue(), ImageListPager\formatValue(), GenerateSitemap\generateLimit(), LinksUpdate\getAddedLinks(), getBrokenLinksFrom(), ApiUpload\getChunkResult(), PopulateContentTables\getContentModel(), CategoriesRdf\getDumpURI(), DoubleRedirectJob\getFinalDestination(), WikiPage\getHiddenCategories(), ChangeTagsLogItem\getHTML(), RevDelLogItem\getHTML(), SpecialExport\getLinks(), getLinksFrom(), getLinksTo(), SearchNearMatcher\getNearMatchInternal(), MediaWiki\Search\ParserOutputSearchDataExtractor\getOutgoingLinks(), NewUsersLogFormatter\getPreloadTitles(), SpecialRandomInCategory\getRandomTitle(), SpecialMypage\getRedirect(), SpecialMytalk\getRedirect(), File\getRedirectedTitle(), SpecialListRedirects\getRedirectTarget(), WikiFilePage\getRedirectTarget(), LinksUpdate\getRemovedLinks(), RollbackEdits\getRollbackTitles(), getSubjectPage(), getTalkPage(), DatabaseLogEntry\getTarget(), RCDatabaseLogEntry\getTarget(), Parser\getTemplateDom(), EditPage\getTemplates(), MediaWiki\Search\ParserOutputSearchDataExtractor\getTemplates(), RecentChange\getTitle(), DifferenceEngine\getTitle(), Message\getTitle(), Parser\getTitle(), User\getTokenUrl(), ExternalUserNames\getUserLinkTitle(), User\getUserPage(), UserRightsProxy\getUserPage(), FixDefaultJsonContentPages\handleRow(), MediaWiki\Search\SearchWidgets\SimpleSearchResultSetWidget\headerHtml(), ImagePage\imageLinks(), ApiPageSet\initFromQueryResult(), ApiPageSet\initFromRevIDs(), CategoriesRdf\labelToUrl(), MessageCache\loadCachedMessagePageEntry(), ApiPageSet\loadRedirectTargets(), MediaWiki\Block\BlockUser\log(), MediaWiki\main(), MediaWiki\Rest\EntryPoint\main(), GenerateSitemap\main(), TitleFactory\makeTitle(), NamespaceDupes\mergePage(), UppercaseTitlesForUnicodeTransition\mungeTitle(), newFromLinkTarget(), ArchivedFile\newFromRow(), newFromRow(), LocalFile\newFromRow(), OldLocalFile\newFromRow(), Article\newFromTitle(), MediaWiki\Revision\RevisionStore\newRevisionFromArchiveRowAndSlots(), MediaWiki\Revision\RevisionStore\newRevisionsFromBatch(), CategoryMembershipChangeJob\notifyUpdatesForRevision(), MediaWiki\parseTitle(), ApiUpload\performUpload(), RebuildTextIndex\populateSearchIndex(), SpecialBlock\processFormInternal(), CleanupWatchlist\processRow(), CleanupCaps\processRowToLowercase(), CleanupCaps\processRowToUppercase(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), MessageCache\refreshAndReplaceInternal(), LinkHolderArray\replaceInternal(), ApiQueryAllCategories\run(), ApiQueryAllImages\run(), ApiQueryAllLinks\run(), ApiQueryAllPages\run(), ApiQueryCategories\run(), ApiQueryCategoryMembers\run(), ApiQueryExtLinksUsage\run(), ApiQueryImages\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryLinks\run(), ApiQueryPagesWithProp\run(), ApiQueryProtectedTitles\run(), ApiQueryQueryPage\run(), ApiQueryRecentChanges\run(), ApiQueryWatchlistRaw\run(), DoubleRedirectJob\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryBacklinksprop\run(), ApiQueryDeletedRevisions\run(), ApiQueryBacklinks\runFirstQuery(), ApiQueryRandom\runQuery(), ApiOpenSearch\search(), Parser\setPage(), SearchSuggestion\setText(), UppercaseTitlesForUnicodeTransition\shouldDelete(), SpecialAllPages\showChunk(), SpecialWhatLinksHere\showIndirectLinks(), SpecialUpload\showUploadWarning(), CoreParserFunctions\urlFunction(), wfApiMain(), CategoriesRdf\writeCategoryData(), CategoriesRdf\writeCategoryLinkData(), and XmlDumpWriter\writeLogItem().

◆ makeTitleSafe()

static Title::makeTitleSafe (   $ns,
  $title,
  $fragment = '',
  $interwiki = '' 
)
static

Create a new Title from a namespace index and a DB key.

The parameters will be checked for validity, which is a bit slower than makeTitle() but safer for user-provided data.

The Title object returned by this method is guaranteed to be valid. Call canExist() to check if the Title represents an editable page.

Parameters
int$nsThe namespace of the article
string$titleDatabase key form
string$fragmentThe link fragment (after the "#")
string$interwikiInterwiki prefix
Returns
Title|null The new object, or null on an error

Definition at line 676 of file Title.php.

References $t, $title, Page\PageIdentity\exists(), and makeName().

Referenced by UsersPager\__construct(), ActiveUsersPager\__construct(), AllMessagesTablePager\__construct(), ImageListPager\__construct(), OutputPage\addCategoryLinks(), CleanupImages\buildSafeTitle(), BenchmarkTitleValue\constructTitleSafe(), PrefixSearch\defaultSearchBackend(), DifferenceEngine\deletedLink(), MovePageForm\doSubmit(), LinkHolderArray\doVariants(), SpecialContributions\execute(), SpecialExport\execute(), SpecialListGroupRights\execute(), SpecialLog\execute(), MovePageForm\execute(), FixMergeHistoryCorruption\execute(), ImportImages\execute(), ImportSiteScripts\execute(), MakeTestEdits\execute(), RebuildFileCache\execute(), RefreshLinks\execute(), SpecialNewpages\form(), WantedQueryPage\formatResult(), SpecialFewestRevisions\formatResult(), SpecialMostCategories\formatResult(), SpecialMostInterwikis\formatResult(), SpecialMostLinked\formatResult(), SpecialMostLinkedCategories\formatResult(), SpecialMostLinkedTemplates\formatResult(), SpecialShortPages\formatResult(), SpecialUnwatchedPages\formatResult(), PageQueryPage\formatResult(), SpecialProtectedtitles\formatRow(), ImageListPager\formatValue(), ProtectedPagesPager\formatValue(), MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions(), NamespaceDupes\getAlternateTitle(), getBaseTitle(), LinksUpdate\getCategoryInsertions(), NamespaceDupes\getDestinationTitle(), SpecialUncategorizedCategories\getExceptionList(), SpecialStatistics\getGroupStats(), SpecialAllPages\getNamespaceKeyAndText(), SpecialEditWatchlist\getNormalForm(), Category\getPage(), WantedFilesPage\getPageHeader(), NewPagesPager\getQueryInfo(), SpecialRandomPage\getRandomTitle(), WikiPage\getRedirectTarget(), getRootTitle(), SpecialPage\getSafeTitleFor(), getSubpage(), UploadBase\getTitle(), SpecialUpload\getUploadForm(), SpecialUpload\getWatchCheck(), SpecialEditWatchlist\getWatchlist(), ChangeTags\isTagNameValid(), ArchivedFile\loadFromRow(), Linker\makeThumbLink2(), TitleFactory\makeTitleSafe(), TitleCleanup\moveInconsistentPage(), MovePage\moveSubpagesInternal(), Category\newFromName(), File\normalizeTitle(), SpecialRandomInCategory\onSubmit(), ImageQueryPage\outputResults(), CoreParserFunctions\pagesincategory(), LanguageConverter\parseCachedTable(), CleanupImages\processRow(), RefreshLinksJob\run(), RevisionDeleteUser\setUsernameBitfields(), SpecialBookSources\showList(), SpecialUndelete\showList(), SpecialAllPages\showToplevel(), SpecialUpload\showViewDeletedLinks(), MediaWiki\Preferences\DefaultPreferencesFactory\skinPreferences(), CoreParserFunctions\special(), PrefixSearch\specialSearch(), ApiQueryBase\titlePartToKey(), ApiFileRevert\validateParameters(), wfImageAuthMain(), and wfStreamThumb().

◆ newFromDBkey()

static Title::newFromDBkey (   $key)
static

Create a new Title from a prefixed DB key.

Parameters
string$keyThe database key, which has underscores instead of spaces, possibly including namespace and interwiki prefixes
Returns
Title|null Title, or null on an error

Definition at line 255 of file Title.php.

References $t.

Referenced by TitleFactory\newFromDBkey().

◆ newFromID()

◆ newFromIDs()

static Title::newFromIDs (   $ids)
static

Make an array of titles from an array of IDs.

Parameters
int[]$idsArray of IDs
Returns
Title[] Array of Titles

Definition at line 553 of file Title.php.

References $dbr, $res, DB_REPLICA, newFromRow(), and wfGetDB().

Referenced by TitleFactory\newFromIDs(), and MediaWiki\Revision\RevisionStore\newRevisionsFromBatch().

◆ newFromLinkTarget()

static Title::newFromLinkTarget ( LinkTarget  $linkTarget,
  $forceClone = '' 
)
static

Returns a Title given a LinkTarget.

If the given LinkTarget is already a Title instance, that instance is returned, unless $forceClone is "clone". If $forceClone is "clone" and the given LinkTarget is already a Title instance, that instance is copied using the clone operator.

Parameters
LinkTarget$linkTargetAssumed to be safe.
string$forceCloneset to NEW_CLONE to ensure a fresh instance is returned.
Returns
Title

Definition at line 294 of file Title.php.

References MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getInterwiki(), MediaWiki\Linker\LinkTarget\getNamespace(), MediaWiki\Linker\LinkTarget\getText(), and makeTitle().

Referenced by castFromLinkTarget(), MediaWiki\Linker\LinkRenderer\castToTitle(), MediaWiki\Permissions\PermissionManager\checkActionPermissions(), MediaWiki\Permissions\PermissionManager\checkCascadingSourcesRestrictions(), MediaWiki\Permissions\PermissionManager\checkPageRestrictions(), MediaWiki\Permissions\PermissionManager\checkPermissionHooks(), MediaWiki\Permissions\PermissionManager\checkQuickPermissions(), MediaWiki\Permissions\PermissionManager\checkReadPermissions(), MediaWiki\Permissions\PermissionManager\checkSiteConfigPermissions(), MediaWiki\Permissions\PermissionManager\checkSpecialsAndNSPermissions(), MediaWiki\Permissions\PermissionManager\checkUserBlock(), MediaWiki\Permissions\PermissionManager\checkUserConfigPermissions(), ApiComparePages\execute(), ApiExpandTemplates\execute(), ApiParse\execute(), ApiQueryRevisionsBase\extractDeprecatedContent(), ApiQueryWatchlist\extractOutputData(), ApiQueryRevisionsBase\extractRevisionInfo(), TemplatesOnThisPageFormatter\formatTemplate(), ApiComparePages\getDiffRevision(), Linker\getImageLinkMTOParams(), SpecialPage\getTitleFor(), ApiComparePages\guessTitle(), DifferenceEngine\loadRevisionData(), Linker\makeImageLink(), Linker\makeSelfLinkObj(), Linker\makeThumbLink2(), TitleFactory\newFromLinkTarget(), newFromTitleValue(), MediaWiki\parseTitle(), ApiQueryAllDeletedRevisions\run(), ApiQueryAllRevisions\run(), SpecialEditWatchlist\runWatchUnwatchCompleteHook(), DifferenceEngine\setRevisions(), ManualLogEntry\setTarget(), ApiComparePages\setVals(), SpecialUndelete\showDiff(), Parser\statelessFetchTemplate(), RevDelRevisionList\suggestTarget(), and UpdateSearchIndex\updateSearchIndexForPage().

◆ newFromRow()

◆ newFromText()

static Title::newFromText (   $text,
  $defaultNamespace = NS_MAIN 
)
static

Create a new Title from text, such as what one would find in a link.

Decodes any HTML entities in the text. Titles returned by this method are guaranteed to be valid. Call canExist() to check if the Title represents an editable page.

Note
The Title instance returned by this method is not guaranteed to be a fresh instance. It may instead be a cached instance created previously, with references to it remaining elsewhere.
Parameters
string | int | null$textThe link text; spaces, prefixes, and an initial ':' indicating the main namespace are accepted.
int$defaultNamespaceThe namespace to use if none is specified by a prefix. If you want to force a specific namespace even if $text might begin with a namespace prefix, use makeTitle() or makeTitleSafe().
Exceptions
InvalidArgumentException
Returns
Title|null Title or null if the Title could not be parsed because it is invalid.

Definition at line 382 of file Title.php.

References newFromTextThrow().

Referenced by Installer\__construct(), ImageListPager\__construct(), DoubleRedirectJob\__construct(), Action\addHelpLink(), Article\addHelpLink(), SpecialPage\addHelpLink(), Skin\addToSidebarPlain(), ApiFormatXml\addXslt(), ApiQuerySiteinfo\appendRightsInfo(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), Parser\braceSubstitution(), SkinTemplate\buildPersonalUrls(), ImageListPager\buildQueryConds(), CoreParserFunctions\cascadingsources(), LocalRepo\checkRedirect(), Skin\checkTitle(), ApiFeedWatchlist\createFeedItem(), CoreParserFunctions\displaytitle(), SpecialExport\doExport(), SpecialRecentChangesLinked\doMainQuery(), PurgeList\doPurge(), Skin\drawCategoryBrowser(), SpecialEditTags\execute(), SpecialFileDuplicateSearch\execute(), SpecialGoToInterwiki\execute(), SpecialLog\execute(), MovePageForm\execute(), SpecialRevisionDelete\execute(), SpecialSearch\execute(), SpecialWhatLinksHere\execute(), SpecialExpandTemplates\execute(), ApiExpandTemplates\execute(), ApiMergeHistory\execute(), ApiMove\execute(), ApiParse\execute(), ApiQueryAllMessages\execute(), ApiQueryImageInfo\execute(), ApiQueryIWLinks\execute(), ApiQueryLangLinks\execute(), ApiQueryLogEvents\execute(), ApiRevisionDelete\execute(), ApiUndelete\execute(), ApiWatch\execute(), BenchmarkCommentFormatter\execute(), BenchmarkParse\execute(), DeleteBatch\execute(), DumpIterator\execute(), EditCLI\execute(), FixDoubleRedirects\execute(), FormatInstallDoc\execute(), GetTextMaint\execute(), ImportTextFiles\execute(), MoveBatch\execute(), NukePage\execute(), PageExists\execute(), Protect\execute(), RollbackEdits\execute(), Undelete\execute(), UppercaseTitlesForUnicodeTransition\execute(), ViewCLI\execute(), SpecialEditWatchlist\extractTitles(), ResourceLoaderWikiModule\fetchTitleInfo(), SpecialMyLanguage\findTitle(), LanguageConverter\findVariantLink(), ApiHelp\fixHelpLinks(), Skin\footerLinkTitle(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), LogFormatter\formatParameterValue(), LogFormatter\formatParameterValueForApi(), SpecialMIMESearch\formatResult(), SearchSuggestion\fromText(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), CoreParserFunctions\gender(), MoveLogFormatter\getActionLinks(), Skin\getCategoryLinks(), Skin\getCopyright(), ApiComparePages\getDiffRevision(), SpecialUncategorizedCategories\getExceptionList(), ApiFeedRecentChanges\getFeedObject(), SpecialPageLanguage\getFormFields(), UserGroupMembership\getGroupPage(), OutputPage\getHeadLinksArray(), ApiPageSet\getInterwikiTitlesAsResult(), Skin\getLanguages(), IRCColourfulRCFeedFormatter\getLine(), SpecialExport\getLinks(), BlockLogFormatter\getMessageParameters(), MergeLogFormatter\getMessageParameters(), MoveLogFormatter\getMessageParameters(), ProtectLogFormatter\getMessageParameters(), SearchNearMatcher\getNearMatchInternal(), UsersPager\getPageHeader(), getParentCategoryTree(), EditPage\getPreloadedContent(), BlockLogFormatter\getPreloadTitles(), MergeLogFormatter\getPreloadTitles(), MoveLogFormatter\getPreloadTitles(), ProtectLogFormatter\getPreloadTitles(), NewFilesPager\getQueryInfo(), ApiRollback\getRbTitle(), CssContent\getRedirectTarget(), JavaScriptContent\getRedirectTarget(), WikitextContent\getRedirectTargetAndText(), SkinTemplate\getReturnToParam(), SpecialChangeCredentials\getReturnUrl(), SpecialRecentChangesLinked\getTargetTitle(), ParserOutput\getText(), UploadBase\getTitle(), CLIParser\getTitle(), ApiBase\getTitleFromTitleOrPageId(), ResourceLoaderWikiModule\getTitleInfo(), ApiBase\getTitleOrPageId(), SpecialSearch\goResult(), ApiComparePages\guessTitle(), Parser\handleInternalLinks2(), ApiPageSet\initFromRevIDs(), LogPager\limitTitle(), PageArchive\listPagesByPrefix(), PageArchive\listPagesBySearch(), LoginSignupSpecialPage\load(), SpecialUndelete\loadRequest(), SpecialMergeHistory\loadRequestParams(), ChangeTags\logTagManagementAction(), PopulateArchiveRevId\makeDummyRevisionRow(), Skin\makeInternalOrExternalUrl(), Skin\makeKnownUrlDetails(), SkinTemplate\makeTalkUrlDetails(), PPFuzzTester\makeTitle(), Skin\makeUrlDetails(), MediaWiki\maybeDoHttpsRedirect(), TitleCleanup\moveIllegalPage(), CoreParserFunctions\mwnamespace(), CoreParserFunctions\namespacee(), CoreParserFunctions\namespacenumber(), TitleFactory\newFromText(), MediaWiki\Block\Restriction\PageRestriction\newFromTitle(), ForeignAPIFile\newFromTitle(), newMainPage(), MediaWikiSite\normalizePageName(), SpecialChangeContentModel\onSubmit(), SpecialRandomInCategory\onSubmit(), SpecialChangeEmail\onSuccess(), CoreParserFunctions\pageid(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), CoreParserFunctions\pagesize(), Parser\parseLinkParameter(), BenchmarkTitleValue\parseTitle(), SpecialPage\prefixSearchString(), SpecialFileDuplicateSearch\prefixSearchSubpages(), ResourceLoaderWikiModule\preloadTitleInfo(), SearchEngine\processCompletionResults(), WikiImporter\processLogItem(), TitleCleanup\processRow(), CleanupWatchlist\processRow(), CleanupCaps\processRowToUppercase(), CoreParserFunctions\protectionexpiry(), CoreParserFunctions\protectionlevel(), PurgePage\purge(), LocalFile\recordUpload3(), SearchExactMatchRescorer\redirectTargetsToRedirect(), Parser\renderImageGallery(), SearchExactMatchRescorer\rescore(), OutputPage\returnToMain(), CoreParserFunctions\revisionday(), CoreParserFunctions\revisionday2(), CoreParserFunctions\revisionid(), CoreParserFunctions\revisionmonth(), CoreParserFunctions\revisionmonth1(), CoreParserFunctions\revisiontimestamp(), CoreParserFunctions\revisionuser(), CoreParserFunctions\revisionyear(), SpecialComparePages\revOrTitle(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ApiQueryCategories\run(), ApiQueryImages\run(), ApiQueryLinks\run(), ApiQueryRecentChanges\run(), ApiQueryDeletedRevisions\run(), SpecialEditWatchlist\runWatchUnwatchCompleteHook(), SpecialChangeContentModel\setParameter(), WikiImporter\setTargetRootPage(), ResourceLoaderWikiModule\shouldEmbedModule(), EditPage\showCustomIntro(), OutputPage\showPermissionsErrorPage(), SpecialSearch\showResults(), LoginHelper\showReturnToPage(), SpecialEditWatchlist\showTitles(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subjectspace(), CoreParserFunctions\subjectspacee(), WebInstallerName\submit(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), Skin\subPageSubtitleInternal(), SpecialCreateAccount\successfulAction(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), CoreParserFunctions\talkspace(), CoreParserFunctions\talkspacee(), Message\unserialize(), and CoreParserFunctions\urlFunction().

◆ newFromTextThrow()

static Title::newFromTextThrow (   $text,
  $defaultNamespace = NS_MAIN 
)
static

Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.

Titles returned by this method are guaranteed to be valid. Call canExist() to check if the Title represents an editable page.

Note
The Title instance returned by this method is not guaranteed to be a fresh instance. It may instead be a cached instance created previously, with references to it remaining elsewhere.
See also
Title::newFromText
Since
1.25
Parameters
string$textTitle text to check
int$defaultNamespace
Exceptions
MalformedTitleExceptionIf the title is invalid.
Returns
Title

Definition at line 417 of file Title.php.

References $t, $titleCache, Sanitizer\decodeCharReferencesAndNormalize(), MapCacheLRU\get(), getTitleCache(), NS_MAIN, and MapCacheLRU\set().

Referenced by SpecialRedirect\dispatchFile(), PageDataRequestHandler\handleRequest(), newFromText(), TitleFactory\newFromTextThrow(), SpecialRedirectWithAction\onFormSubmit(), SpecialNewSection\onFormSubmit(), SpecialPageLanguage\onSubmit(), MediaWiki\parseTitle(), ApiPageSet\processTitlesArray(), HTMLTitleTextField\validate(), and SpecialChangeContentModel\validateTitle().

◆ newFromTitleValue()

static Title::newFromTitleValue ( TitleValue  $titleValue,
  $forceClone = '' 
)
static

Returns a Title given a TitleValue.

If the given TitleValue is already a Title instance, that instance is returned, unless $forceClone is "clone". If $forceClone is "clone" and the given TitleValue is already a Title instance, that instance is copied using the clone operator.

Deprecated:
since 1.34, use newFromLinkTarget or castFromLinkTarget
Parameters
TitleValue$titleValueAssumed to be safe.
string$forceCloneset to NEW_CLONE to ensure a fresh instance is returned.
Returns
Title

Definition at line 279 of file Title.php.

References newFromLinkTarget().

Referenced by TrackingCategories\getTrackingCategories().

◆ newFromURL()

static Title::newFromURL (   $url)
static

THIS IS NOT THE FUNCTION YOU WANT.

Use Title::newFromText().

Example of wrong and broken code: $title = Title::newFromURL( $request->getText( 'title' ) );

Example of right code: $title = Title::newFromText( $request->getText( 'title' ) );

Create a new Title from URL-encoded text. Ensures that the given title's length does not exceed the maximum.

Parameters
string$urlThe title, as might be taken from a URL
Returns
Title|null The new object, or null on an error

Definition at line 479 of file Title.php.

References $t.

Referenced by TitleFactory\newFromURL(), MediaWiki\parseTitle(), and CoreParserFunctions\urlFunction().

◆ newMainPage()

static Title::newMainPage ( MessageLocalizer  $localizer = null)
static

Create a new Title for the Main Page.

This uses the 'mainpage' interface message, which could be specified in $wgForceUIMsgAsContentMsg. If that is the case, then calling this method will use the user language, which would involve initialising the session via RequestContext::getMain()->getLanguage(). For session-less endpoints, be sure to pass in a MessageLocalizer (such as your own RequestContext, or ResourceloaderContext) to prevent an error.

Note
The Title instance returned by this method is not guaranteed to be a fresh instance. It may instead be a cached instance created previously, with references to it remaining elsewhere.
Parameters
MessageLocalizer | null$localizerAn optional context to use (since 1.34)
Returns
Title

Definition at line 712 of file Title.php.

References $title, newFromText(), and wfMessage().

Referenced by EmaillingJob\__construct(), Skin\addToSidebarPlain(), ApiQuerySiteinfo\appendGeneralInfo(), Installer\createMainpage(), ApiRsd\execute(), MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions(), SpecialChangeCredentials\getAuthForm(), HTMLForm\getCancelTargetURL(), ApiComparePages\getDiffRevision(), SpecialMyLanguage\getRedirect(), SkinMustache\getTemplateData(), XmlDumpWriter\homelink(), Skin\logoText(), PopulateArchiveRevId\makeDummyRevisionRow(), Skin\makeMainPageUrl(), TitleFactory\newMainPage(), SpecialChangeEmail\onSuccess(), MediaWiki\parseTitle(), OutputPage\returnToMain(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendNewAccountEmail(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendPasswordResetEmail(), OutputPage\showPermissionsErrorPage(), LoginHelper\showReturnToPage(), MediaWikiTitleCodec\splitTitleString(), and MediaWiki\Actions\FileDeleteAction\tempExecute().

◆ normalizeFragment()

static Title::normalizeFragment (   $fragment)
staticprivate

Normalizes fragment part of the title.

Parameters
string$fragment
Returns
string

Definition at line 1843 of file Title.php.

Referenced by makeTitle(), and setFragment().

◆ pageCond()

Title::pageCond ( )

Get an associative array for selecting this title from the "page" table.

Returns
array Array suitable for the $where parameter of DB::select()

Definition at line 3377 of file Title.php.

References $mArticleID, $mDbkeyform, and $mNamespace.

Referenced by getTouched(), invalidateCache(), isNewPage(), isSingleRevRedirect(), and loadFieldFromDB().

◆ prefix()

Title::prefix (   $name)
private

Prefix some arbitrary text with the namespace or interwiki prefix of this object.

Parameters
string$nameThe text
Returns
string The prefixed text

Definition at line 1857 of file Title.php.

References getNsText(), isExternal(), and NS_SPECIAL.

Referenced by getPrefixedDBkey(), getPrefixedText(), and getPrefixedURL().

◆ purgeExpiredRestrictions()

static Title::purgeExpiredRestrictions ( )
static

Purge expired restrictions from the page_restrictions table.

This will purge no more than $wgUpdateRowsPerQuery page_restrictions rows

Definition at line 2693 of file Title.php.

References Wikimedia\Rdbms\IDatabase\addQuotes(), DeferredUpdates\addUpdate(), DB_PRIMARY, Wikimedia\Rdbms\IDatabase\delete(), Wikimedia\Rdbms\IDatabase\selectFieldValues(), Wikimedia\Rdbms\IDatabase\timestamp(), wfGetDB(), and wfReadOnly().

Referenced by WikiPage\doUpdateRestrictions().

◆ purgeSquid()

Title::purgeSquid ( )

Purge all applicable CDN URLs.

Deprecated:
1.35 Use HtmlCacheUpdater

Definition at line 3265 of file Title.php.

◆ resetArticleID()

Title::resetArticleID (   $id)

Inject a page ID, reset DB-loaded fields, and clear the link cache for this title.

This can be called on page insertion to allow loading of the new page_id without having to create a new Title instance. Likewise with deletion.

This is also used during page moves, to reflect the change in the relationship between article ID and title text.

Note
This overrides Title::setContentModel()
Parameters
int | bool$idPage ID, 0 for non-existant, or false for "unknown" (lazy-load)

Definition at line 2988 of file Title.php.

◆ secureAndSplit()

Title::secureAndSplit (   $text,
  $defaultNamespace = null 
)
private

Secure and split - main initialisation function for this object.

Assumes that $text is urldecoded and uses underscores, but not otherwise munged. This function removes illegal characters, splits off the interwiki and namespace prefixes, sets the other forms, and canonicalizes everything.

If this method returns normally, the Title is valid.

Parameters
string$text
int | null$defaultNamespace
Exceptions
MalformedTitleExceptionOn malformed titles

Definition at line 3048 of file Title.php.

References $mDefaultNamespace, isExternal(), isSpecialPage(), setFragment(), and wfUrlencode().

◆ setContentModel()

Title::setContentModel (   $model)

Set a proposed content model for the page for permissions checking.

This does not actually change the content model of a title in the DB. It only affects this particular Title instance. The content model is forced to remain this value until another setContentModel() call.

ContentHandler::canBeUsedOn() should be checked before calling this if there is any doubt regarding the applicability of the content model

Warning
This must only be used if the caller controls the further use of this Title object, to avoid other code unexpectedly using the new value.
Since
1.28
Parameters
string$modelCONTENT_MODEL_XXX constant

Definition at line 1133 of file Title.php.

References uncache().

Referenced by MediaWiki\EditPage\Constraint\ContentModelChangeConstraint\checkConstraint().

◆ setFragment()

Title::setFragment (   $fragment)

Set the fragment for this title.

Removes the first character from the specified fragment before setting, so it assumes you're passing it with an initial "#".

Warning
This must only be used if the caller controls the further use of this Title object, to avoid other code unexpectedly using the new value.
Parameters
string$fragmentText

Definition at line 1816 of file Title.php.

References normalizeFragment(), and uncache().

Referenced by secureAndSplit().

◆ toPageIdentity()

Title::toPageIdentity ( )

Returns the page represented by this Title as a ProperPageIdentity.

The ProperPageIdentity returned by this method is guaranteed to be immutable. If this Title does not represent a proper page, an exception is thrown.

It is preferred to use this method rather than using the Title as a PageIdentity directly.

Returns
ProperPageIdentity
Exceptions
PreconditionExceptionif the page is not a proper page, that is, if it is a section link, interwiki link, link to a special page, or such.
Since
1.36

Definition at line 4236 of file Title.php.

References assertProperPage(), getDBkey(), getId(), and getNamespace().

◆ toPageRecord()

Title::toPageRecord (   $flags = 0)

Returns the page represented by this Title as a ProperPageRecord.

The PageRecord returned by this method is guaranteed to be immutable, the page is guaranteed to exist.

Note
For now, this method queries the database on every call.
Since
1.36
Parameters
int$flagsEither a bitfield of class READ_* constants or GAID_FOR_UPDATE
Returns
ExistingPageRecord
Exceptions
PreconditionExceptionif the page does not exist, or is not a proper page, that is, if it is a section link, interwiki link, link to a special page, or such.

Definition at line 4263 of file Title.php.

References assertProperPage(), Page\PageIdentity\exists(), getArticleID(), getDBkey(), getDbPageLanguageCode(), getLatestRevID(), getNamespace(), getTouched(), getWikiId(), isNewPage(), and isRedirect().

◆ touchLinks()

Title::touchLinks ( )

Update page_touched timestamps and send CDN purge messages for pages linking to this title.

May be sent to the job queue depending on the number of links. Typically called on create and delete.

Definition at line 3739 of file Title.php.

References HTMLCacheUpdateJob\newForBacklinks(), NS_CATEGORY, and JobQueueGroup\singleton().

◆ uncache()

Title::uncache ( )
private

Removes this instance from the internal title cache, so it can be modified in-place without polluting the cache (see T281337).

Definition at line 456 of file Title.php.

References $titleCache, MapCacheLRU\clear(), and getTitleCache().

Referenced by setContentModel(), and setFragment().

◆ warnIfPageCannotExist()

Title::warnIfPageCannotExist ( Title  $title,
  $method 
)
private
Parameters
Title$title
string$method
Returns
bool whether a warning was issued

Definition at line 1703 of file Title.php.

References getFullText(), getInterwiki(), getText(), and wfLogWarning().

Referenced by getSubjectPage(), and getTalkPage().

◆ wasLocalInterwiki()

Title::wasLocalInterwiki ( )

Was this a local interwiki link?

Returns
bool

Definition at line 978 of file Title.php.

References $mLocalInterwiki.

Member Data Documentation

◆ $mArticleID

int Title::$mArticleID = -1

Article ID, fetched from the link cache on demand.

Definition at line 131 of file Title.php.

Referenced by getArticleID(), and pageCond().

◆ $mContentModel

bool string Title::$mContentModel = false
private

ID of the page's content model, i.e.

one of the CONTENT_MODEL_XXX constants

Definition at line 140 of file Title.php.

Referenced by getContentModel().

◆ $mDbkeyform

string Title::$mDbkeyform = ''
Deprecated:
since 1.37 directly accessing this member, use the ::getDBkey() method instead. Main part with underscores

Definition at line 104 of file Title.php.

Referenced by getDBkey(), getRedirectsHere(), and pageCond().

◆ $mDbPageLanguage

string bool null Title::$mDbPageLanguage = false
private

The page language code from the database, null if not saved in the database or false if not loaded, yet.

Definition at line 184 of file Title.php.

Referenced by getDbPageLanguageCode().

◆ $mDefaultNamespace

int Title::$mDefaultNamespace = NS_MAIN

Namespace index when there is no namespace.

Don't change the following default, NS_MAIN is hardcoded in several places. See T2696. Used primarily for {{transclusion}} tags.

See also
newFromText()

Definition at line 167 of file Title.php.

Referenced by getDefaultNamespace(), and secureAndSplit().

◆ $mEstimateRevisions

int Title::$mEstimateRevisions
private

Estimated number of revisions; null of not loaded.

Definition at line 149 of file Title.php.

Referenced by estimateRevisionCount().

◆ $mForcedContentModel

bool Title::$mForcedContentModel = false
private

If a content model was forced via setContentModel() this will be true to avoid having other code paths reset it.

Definition at line 146 of file Title.php.

◆ $mFragment

string Title::$mFragment = ''
Deprecated:
since 1.37 Avoid directly accessing this member, use the ::getFragment() method instead. Title fragment (i.e. the bit after the #)

Definition at line 128 of file Title.php.

Referenced by getFragment(), and getFullText().

◆ $mHasSubpages

bool Title::$mHasSubpages
private

Whether a page has any subpages.

Definition at line 176 of file Title.php.

Referenced by hasSubpages().

◆ $mInstanceCacheKey

string null Title::$mInstanceCacheKey = null
private

The key of this instance in the internal Title instance cache.

Definition at line 196 of file Title.php.

◆ $mInterwiki

string Title::$mInterwiki = ''
Deprecated:
since 1.37 Avoid directly accessing this member, use the ::getInterwiki() method instead. Interwiki prefix

Definition at line 118 of file Title.php.

Referenced by getInterwiki(), and getRedirectsHere().

◆ $mIsBigDeletion

bool null Title::$mIsBigDeletion = null
private

Would deleting this page be a big deletion?

Definition at line 190 of file Title.php.

Referenced by isBigDeletion().

◆ $mIsValid

bool null Title::$mIsValid = null
private

Is the title known to be valid?

Definition at line 193 of file Title.php.

Referenced by isValid().

◆ $mLatestID

bool int Title::$mLatestID = false
protected

ID of most recent revision.

Definition at line 134 of file Title.php.

Referenced by getLatestRevID().

◆ $mLength

int Title::$mLength = -1
protected

The page length, 0 for special pages.

Definition at line 170 of file Title.php.

Referenced by getLength().

◆ $mLocalInterwiki

bool Title::$mLocalInterwiki = false
private

Was this Title created from a string with a local interwiki prefix?

Definition at line 121 of file Title.php.

Referenced by wasLocalInterwiki().

◆ $mNamespace

int Title::$mNamespace = NS_MAIN
Deprecated:
sine 1.37 Avoid directly accessing this member, use the ::getNamespace() method instead Namespace index, i.e. one of the NS_xxxx constants

Definition at line 111 of file Title.php.

Referenced by getEditNotices(), getNamespace(), getRedirectsHere(), and pageCond().

◆ $mPageLanguage

array null Title::$mPageLanguage
private

The (string) language code of the page's language and content code.

Definition at line 179 of file Title.php.

◆ $mRedirect

null bool Title::$mRedirect = null

Is the article at this title a redirect?

Definition at line 173 of file Title.php.

Referenced by isRedirect().

◆ $mTextform

string Title::$mTextform = ''
Deprecated:
since 1.37 directly accessing this member, use the ::getText() method instead. Text form (spaces not underscores) of the main part

Definition at line 90 of file Title.php.

Referenced by getText().

◆ $mTitleValue

TitleValue null Title::$mTitleValue = null
private

Was this Title created from a string with a local interwiki prefix?

Definition at line 187 of file Title.php.

Referenced by getTitleValue().

◆ $mUrlform

string Title::$mUrlform = ''
Deprecated:
since 1.37 directly accessing this member, use the ::getPartialURL() method instead. URL-encoded form of the main part

Definition at line 97 of file Title.php.

Referenced by getPartialURL().

◆ $prefixedText

string null Title::$prefixedText = null

Text form including namespace/interwiki, initialised on demand.

Only public to share cache with TitleFormatter

Access: internal

Definition at line 159 of file Title.php.

Referenced by getPrefixedText().

◆ $titleCache

MapCacheLRU null Title::$titleCache = null
staticprivate

Definition at line 52 of file Title.php.

Referenced by clearCaches(), getTitleCache(), newFromTextThrow(), and uncache().

◆ CACHE_MAX

const Title::CACHE_MAX = 1000
private

Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles.

On a batch operation this can become a memory leak if not bounded. After hitting this many titles reset the cache.

Definition at line 59 of file Title.php.

◆ GAID_FOR_UPDATE

const Title::GAID_FOR_UPDATE = 512

Used to be GAID_FOR_UPDATE define().

Used with getArticleID() and friends to use the primary DB and inject it into link cache.

Deprecated:
since 1.34, use Title::READ_LATEST instead.

Definition at line 66 of file Title.php.

Referenced by loadFieldFromDB(), and newFromID().

◆ NEW_CLONE

const Title::NEW_CLONE = 'clone'

Flag for use with factory methods like newFromLinkTarget() that have a $forceClone parameter.

If set, the method must return a new instance. Without this flag, some factory methods may return existing instances.as

Since
1.33

Definition at line 75 of file Title.php.


The documentation for this class was generated from the following file:
Title\newFromText
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition: Title.php:382