MediaWiki  master
Title Class Reference

Represents a title within MediaWiki. More...

Inheritance diagram for Title:
Collaboration diagram for Title:

Public Member Functions

 __construct ()
 
 __sleep ()
 
 __toString ()
 Return a string representation of this title. More...
 
 __wakeup ()
 
 areCascadeProtectionSourcesLoaded ( $getPages=true)
 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 ()
 Is this in a namespace that allows actual pages? More...
 
 canHaveTalkPage ()
 Can this title have a corresponding talk page? More...
 
 canUseNoindex ()
 Whether the magic words INDEX and NOINDEX function for this page. More...
 
 countAuthorsBetween ( $old, $new, $limit, $options=[])
 Get the number of authors between the given revisions or revision IDs. More...
 
 countRevisionsBetween ( $old, $new, $max=null)
 Get the number of revisions between the given revision. 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 (LinkTarget $title)
 Compare 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...
 
 getAuthorsBetween ( $old, $new, $limit, $options=[])
 Get the authors between the given revisions or revision IDs. 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...
 
 getEarliestRevTime ( $flags=0)
 Get the oldest revision timestamp of this page. More...
 
 getEditNotices ( $oldid=0)
 Get a list of rendered edit notices for this page. More...
 
 getEditURL ()
 Get the edit URL for this Title. More...
 
 getFirstRevision ( $flags=0)
 Get the first revision of the page. 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...
 
 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...
 
 getNextRevisionID ( $revId, $flags=0)
 Get the revision ID of the next revision. More...
 
 getNotificationTimestamp ( $user=null)
 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...
 
 getPreviousRevisionID ( $revId, $flags=0)
 Get the revision ID of the previous revision. 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...
 
 getUserCaseDBKey ()
 Get the DB key with the initial letter case as specified by the user. More...
 
 getUserPermissionsErrors ( $action, $user, $rigor=PermissionManager::RIGOR_SECURE, $ignoreErrors=[])
 Can $user perform $action on this page? More...
 
 hasContentModel ( $id)
 Convenience method for checking a title's content model name. 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 ()
 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...
 
 isSemiProtected ( $action='edit')
 Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels? More...
 
 isSingleRevRedirect ()
 Checks if this page is just a one-rev 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 valid, false if it is invalid. More...
 
 isValidMoveOperation (&$nt, $auth=true, $reason='')
 Check whether a given move operation would be valid. More...
 
 isValidMoveTarget ( $nt)
 Checks if $this can be moved to a given Title. More...
 
 isValidRedirectTarget ()
 Check if this Title is a valid redirect target. More...
 
 isWatchable ()
 Can this title be added to a user's watchlist? 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...
 
 moveSubpages ( $nt, $auth=true, $reason='', $createRedirect=true, array $changeTags=[])
 Move this page's subpages to be subpages of $nt. More...
 
 moveTo (&$nt, $auth=true, $reason='', $createRedirect=true, array $changeTags=[])
 Move a title to a new location. More...
 
 pageCond ()
 Get an associative array for selecting this title from the "page" table. More...
 
 purgeSquid ()
 Purge all applicable CDN URLs. More...
 
 quickUserCan ( $action, $user=null)
 Can $user perform $action on this page? This skips potentially expensive cascading permission checks as well as avoids expensive error formatting. More...
 
 resetArticleID ( $newid)
 This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache. More...
 
 setContentModel ( $model)
 Set a proposed content model for the page for permissions checking. More...
 
 setFragment ( $fragment)
 Set the fragment for this title. More...
 
 touchLinks ()
 Update page_touched timestamps and send CDN purge messages for pages linking to this title. More...
 
 userCan ( $action, $user=null, $rigor=PermissionManager::RIGOR_SECURE)
 Can $user perform $action on this page? More...
 
 wasLocalInterwiki ()
 Was this a local interwiki link? 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 clearCaches ()
 
static compare (LinkTarget $a, LinkTarget $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 nameOf ( $id)
 Get the prefixed DB key associated with an ID. 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 CACHE_MAX = 1000
 Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles. More...
 
const GAID_FOR_UPDATE = 1
 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_LOCKING = self::READ_LATEST | 2
 Constants for object loading bitfield flags (higher => higher QoS) More...
 
const READ_NONE = -1
 

Protected Member Functions

 getTitleProtectionInternal ()
 Fetch title protection settings. 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

 getDbPageLanguageCode ()
 Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false. More...
 
 getRelativeRevisionID ( $revId, $flags, $dir)
 Get next/previous revision ID relative to another revision ID. More...
 
 prefix ( $name)
 Prefix some arbitrary text with the namespace or interwiki prefix of this object. More...
 
 resultToError ( $errors, $result)
 Add the resulting error code to the errors array. More...
 
 secureAndSplit ()
 Secure and split - main initialisation function for this object. More...
 

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 Private Attributes

static MapCacheLRU null $titleCache = null
 

Private member variables

Please use the accessor functions instead.

Access:
private
string $mTextform = ''
 Text form (spaces not underscores) of the main part. More...
 
string $mUrlform = ''
 URL-encoded form of the main part. More...
 
string $mDbkeyform = ''
 Main part with underscores. More...
 
int $mNamespace = NS_MAIN
 Namespace index, i.e. More...
 
string $mInterwiki = ''
 Interwiki prefix. More...
 
string $mFragment = ''
 Title fragment (i.e. More...
 
int $mArticleID = -1
 Article ID, fetched from the link cache on demand. More...
 
array $mRestrictions = []
 Array of groups allowed to edit this article. More...
 
bool $mCascadeRestriction
 Cascade restrictions on this page to included templates and images? More...
 
 $mCascadingRestrictions
 Caching the results of getCascadeProtectionSources. More...
 
array $mCascadeSources
 Where are the cascading restrictions coming from on this page? More...
 
bool $mRestrictionsLoaded = false
 Boolean for initialisation on demand. More...
 
string null $prefixedText = null
 Text form including namespace/interwiki, initialised on demand. More...
 
mixed $mTitleProtection
 Cached value for getTitleProtection (create protection) More...
 
int $mDefaultNamespace = NS_MAIN
 Namespace index when there is no namespace. More...
 
null $mRedirect = null
 Is the article at this title a redirect? More...
 
string $mUserCaseDBKey
 Database key with the initial letter in the case specified by the user. More...
 
bool int $mLatestID = false
 ID of most recent revision. More...
 
string bool $mOldRestrictions = false
 Comma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. More...
 
array $mRestrictionsExpiry = []
 When do the restrictions on this page expire? More...
 
bool $mHasCascadingRestrictions
 Are cascading restrictions in effect on this page? More...
 
int $mLength = -1
 The page length, 0 for special pages. More...
 
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...
 
array $mNotificationTimestamp = []
 Associative array of user ID -> timestamp/false. More...
 
bool $mHasSubpages
 Whether a page has any subpages. More...
 
bool $mPageLanguage = false
 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
 A corresponding TitleValue object. More...
 
bool null $mIsBigDeletion = null
 Would deleting this page be a big deletion? 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 40 of file Title.php.

Constructor & Destructor Documentation

◆ __construct()

Title::__construct ( )
Access:
protected

Definition at line 220 of file Title.php.

Member Function Documentation

◆ __sleep()

Title::__sleep ( )
Returns
array

Definition at line 4611 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 1710 of file Title.php.

References getPrefixedText().

◆ __wakeup()

Title::__wakeup ( )

Definition at line 4623 of file Title.php.

References wfUrlencode().

◆ areCascadeProtectionSourcesLoaded()

Title::areCascadeProtectionSourcesLoaded (   $getPages = true)

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

Parameters
bool$getPagesTrue to check if the pages are loaded, or false to check if the status is loaded.
Returns
bool Whether or not the specified information has been loaded
Since
1.23

Definition at line 2515 of file Title.php.

References null.

◆ areRestrictionsCascading()

Title::areRestrictionsCascading ( )

Returns cascading restrictions for the current article.

Returns
bool

Definition at line 2671 of file Title.php.

References $mCascadeRestriction, and loadRestrictions().

◆ areRestrictionsLoaded()

Title::areRestrictionsLoaded ( )

Accessor for mRestrictionsLoaded.

Returns
bool Whether or not the page's restrictions have already been loaded from the database
Since
1.23

Definition at line 2618 of file Title.php.

References $mRestrictionsLoaded.

◆ canExist()

Title::canExist ( )

Is this in a namespace that allows actual pages?

Returns
bool

Definition at line 1146 of file Title.php.

References NS_MAIN.

Referenced by RequestContext\canUseWikiPage(), and TitleCleanup\moveInconsistentPage().

◆ canHaveTalkPage()

Title::canHaveTalkPage ( )

Can this title have a corresponding talk page?

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

Definition at line 1136 of file Title.php.

Referenced by getTalkPageIfDefined(), and TitleTest\testCanHaveTalkPage().

◆ canUseNoindex()

Title::canUseNoindex ( )

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

Returns
bool

Definition at line 4389 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 3161 of file Title.php.

References $services.

Referenced by CategoryPager\__construct(), UploadBase\checkBadFileName(), WithoutInterwikiPage\execute(), and MediaWikiTitleCodec\splitTitleString().

◆ castFromLinkTarget()

static Title::castFromLinkTarget (   $linkTarget)
static

Same as newFromLinkTarget, but if passed null, returns null.

Parameters
LinkTarget | null$linkTargetAssumed to be safe (if not null).
Returns
Title|null

Definition at line 295 of file Title.php.

References null.

Referenced by Linker\formatAutocomments(), Linker\getUploadUrl(), Linker\makeBrokenImageLinkObj(), Linker\makeMediaLinkFile(), WatchedItemStore\resetNotificationTimestamp(), and TitleTest\testCastFromLinkTarget().

◆ clearCaches()

◆ compare()

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

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

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

Definition at line 846 of file Title.php.

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

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 714 of file Title.php.

References $out.

Referenced by ResourceLoaderStartUpModule\getConfigSettings(), and TitleTest\testConvertByteClassToUnicodeClass().

◆ countAuthorsBetween()

Title::countAuthorsBetween (   $old,
  $new,
  $limit,
  $options = [] 
)

Get the number of authors between the given revisions or revision IDs.

Used for diffs and other things that really need it.

Parameters
int | Revision$oldOld revision or rev ID (first before range by default)
int | Revision$newNew revision or rev ID (first after range by default)
int$limitMaximum number of authors
string | array$options(Optional): Single option, or an array of options: 'include_old' Include $old in the range; $new is excluded. 'include_new' Include $new in the range; $old is excluded. 'include_both' Include both $old and $new in the range. Unknown option values are ignored.
Returns
int Number of revision authors in the range; zero if not both revisions exist

Definition at line 3974 of file Title.php.

References $options, and getAuthorsBetween().

◆ countRevisionsBetween()

Title::countRevisionsBetween (   $old,
  $new,
  $max = null 
)

Get the number of revisions between the given revision.

Used for diffs and other things that really need it.

Parameters
int | Revision$oldOld revision or rev ID (first before range)
int | Revision$newNew revision or rev ID (first after range)
int | null$maxLimit of Revisions to count, will be incremented to detect truncations
Returns
int Number of revisions between these revisions.

Definition at line 3856 of file Title.php.

References $dbr, DB_REPLICA, getArticleID(), Revision\newFromTitle(), null, and wfGetDB().

◆ 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 1642 of file Title.php.

References getText().

Referenced by TitleTest\testCreateFragmentTitle().

◆ deleteTitleProtection()

Title::deleteTitleProtection ( )

Remove any title protection due to page existing.

Definition at line 2405 of file Title.php.

References DB_MASTER, and wfGetDB().

Referenced by WikiPage\onArticleCreate().

◆ equals()

◆ estimateRevisionCount()

Title::estimateRevisionCount ( )

Get the approximate revision count of this page.

Returns
int

Definition at line 3833 of file Title.php.

References $dbr, $mEstimateRevisions, DB_REPLICA, exists(), getArticleID(), null, 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$flagsAn optional bit field; may be Title::GAID_FOR_UPDATE to check from master/for update
Returns
bool

Definition at line 4015 of file Title.php.

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

Referenced by estimateRevisionCount(), getRestrictionTypes(), getTitleProtectionInternal(), hasSourceText(), isKnown(), makeTitleSafe(), and TitleCleanup\moveInconsistentPage().

◆ 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 1193 of file Title.php.

References isSpecialPage(), list, 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 1886 of file Title.php.

References $query, wfArrayToCgi(), and wfDeprecated().

◆ 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().

Definition at line 2842 of file Title.php.

References null.

◆ getAllRestrictions()

Title::getAllRestrictions ( )

Accessor/initialisation for mRestrictions.

Returns
array Keys are actions, values are arrays as returned by Title::getRestrictions()
Since
1.23

Definition at line 2645 of file Title.php.

References $mRestrictions, and loadRestrictions().

◆ getArticleID()

◆ getAuthorsBetween()

Title::getAuthorsBetween (   $old,
  $new,
  $limit,
  $options = [] 
)

Get the authors between the given revisions or revision IDs.

Used for diffs and other things that really need it.

Since
1.23
Parameters
int | Revision$oldOld revision or rev ID (first before range by default)
int | Revision$newNew revision or rev ID (first after range by default)
int$limitMaximum number of authors
string | array$options(Optional): Single option, or an array of options: 'include_old' Include $old in the range; $new is excluded. 'include_new' Include $new in the range; $old is excluded. 'include_both' Include both $old and $new in the range. Unknown option values are ignored.
Returns
array|null Names of revision authors in the range; null if not both revisions exist

Definition at line 3899 of file Title.php.

References $dbr, $options, $revQuery, array(), DB_REPLICA, getArticleID(), Revision\getQueryInfo(), Revision\newFromTitle(), null, Revision\RAW, and wfGetDB().

Referenced by countAuthorsBetween().

◆ getBacklinkCache()

Title::getBacklinkCache ( )

Get a backlink cache object.

Returns
BacklinkCache

Definition at line 4380 of file Title.php.

References BacklinkCache\get().

Referenced by LinksUpdate\queueRecursiveJobsForTable().

◆ getBaseText()

Title::getBaseText ( )

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

the part before the subpage name

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

Definition at line 1778 of file Title.php.

References getText(), and hasSubpages().

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 Base title
Since
1.20

Definition at line 1808 of file Title.php.

References getBaseText().

◆ 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[] Array of Title the Title objects

Definition at line 3348 of file Title.php.

References $dbr, $res, as, DB_REPLICA, getArticleID(), 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|string[]$query
string | bool$query2Deprecated
Returns
string The URL
Since
1.18

Definition at line 2141 of file Title.php.

References $query, getFragmentForURL(), getLocalURL(), PROTO_CANONICAL, Hooks\run(), and wfExpandUrl().

◆ getCascadeProtectionSources()

Title::getCascadeProtectionSources (   $getPages = true)

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

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, false for none, or true if such restrictions exist but $getPages was not set. Second is an array like that returned by Title::getAllRestrictions(), or an empty array if $getPages is false.

Definition at line 2532 of file Title.php.

References $dbr, $mCascadeSources, $mCascadingRestrictions, $mDbkeyform, $mHasCascadingRestrictions, $mNamespace, $res, $tables, as, DB_REPLICA, NS_FILE, null, wfGetDB(), and wfTimestampNow().

Referenced by isCascadeProtected().

◆ 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 4408 of file Title.php.

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

Referenced by CategoryViewer\doCategoryQuery().

◆ getCdnUrls()

Title::getCdnUrls ( )

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

Returns
string[] Array of String the URLs

Definition at line 3384 of file Title.php.

References $urls, as, getInternalURL(), getPageLanguage(), isUserCssConfigPage(), isUserJsConfigPage(), isUserJsonConfigPage(), and Hooks\run().

Referenced by MediaWiki\performAction(), and purgeSquid().

◆ 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$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
string Content model id

Definition at line 1038 of file Title.php.

References $mContentModel, article, getArticleID(), ContentHandler\getDefaultModelFor(), and in.

Referenced by MediaWiki\EditPage\TextConflictHelper\__construct(), ContentHandler\getForTitle(), hasContentModel(), loadFromRow(), makeTitle(), EditPageTest\testShouldPreventChangingContentModelWhenUserCannotChangeModelForTitle(), and EditPageTest\testShouldPreventChangingContentModelWhenUserCannotEditTargetTitle().

◆ 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 4434 of file Title.php.

References $mDbPageLanguage, and $wgPageLanguageUseDB.

Referenced by getPageLanguage(), and getPageViewLanguage().

◆ 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 a 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 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 4158 of file Title.php.

References $lang, $name, getText(), list, NS_MEDIAWIKI, MessageCache\singleton(), and wfMessage().

◆ getDefaultNamespace()

Title::getDefaultNamespace ( )

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

Returns
int Default namespace index

Definition at line 1574 of file Title.php.

References $mDefaultNamespace.

◆ getEarliestRevTime()

Title::getEarliestRevTime (   $flags = 0)

Get the oldest revision timestamp of this page.

Parameters
int$flagsTitle::GAID_FOR_UPDATE
Returns
string|null MW timestamp

Definition at line 3784 of file Title.php.

References $rev, getFirstRevision(), and null.

◆ 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
array

Definition at line 4538 of file Title.php.

References $html, $mNamespace, as, Sanitizer\escapeClass(), hasSubpages(), Html\rawElement(), Hooks\run(), 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 2155 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.

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 2290 of file Title.php.

References $wgRestrictionTypes.

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

◆ getFirstRevision()

Title::getFirstRevision (   $flags = 0)

Get the first revision of the page.

Parameters
int$flagsTitle::GAID_FOR_UPDATE
Returns
Revision|null If page doesn't exist

Definition at line 3757 of file Title.php.

References $revQuery, DB_MASTER, DB_REPLICA, getArticleID(), Revision\getQueryInfo(), null, and wfGetDB().

Referenced by getEarliestRevTime().

◆ 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 1585 of file Title.php.

References $mFragment.

Referenced by WikiPage\insertRedirectEntry().

◆ 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 1604 of file Title.php.

References Sanitizer\escapeIdForExternalInterwiki(), Sanitizer\escapeIdForLink(), 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 1720 of file Title.php.

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

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

◆ 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|string[]$query
string|string[]|bool$query2
string | int | null$protoProtocol type to use in URL
Returns
string The URL

Definition at line 1924 of file Title.php.

References $query, getFragmentForURL(), getLocalURL(), Hooks\run(), and wfExpandUrl().

Referenced by MediaWiki\Special\SpecialPageFactory\executePath(), FeedUtils\getDiffLink(), PageDataRequestHandler\getDocUrl(), getLinkURL(), CssContentHandler\makeRedirectContent(), JavaScriptContentHandler\makeRedirectContent(), CategoriesRdf\titleToUrl(), and MediaWiki\tryNormaliseRedirect().

◆ 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 1959 of file Title.php.

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

◆ 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|string[]$query
string | bool$query2Deprecated
Returns
string The URL

Definition at line 2117 of file Title.php.

References $query, $wgInternalServer, $wgServer, getLocalURL(), PROTO_HTTP, Hooks\run(), and wfExpandUrl().

Referenced by getCdnUrls().

◆ 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 912 of file Title.php.

References $mInterwiki.

Referenced by WikiPage\insertRedirectEntry(), WikitextContentHandler\makeRedirectContent(), TitleCleanup\moveInconsistentPage(), and TitleTest\testCreateFragmentTitle().

◆ 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 213 of file Title.php.

◆ getLatestRevID()

Title::getLatestRevID (   $flags = 0)

What is the page_latest field for this page?

Parameters
int$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
int Int or 0 if the page doesn't exist

Definition at line 3092 of file Title.php.

References $mLatestID, article, getArticleID(), in, and null.

Referenced by Revision\RevisionStore\getKnownCurrentRevision(), and RefreshLinksJob\runForTitle().

◆ getLength()

Title::getLength (   $flags = 0)

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

Parameters
int$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
int

Definition at line 3064 of file Title.php.

References $mLength, article, getArticleID(), in, and null.

◆ 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
array Array of Title objects linking here

Definition at line 3282 of file Title.php.

References $options, $res, as, DB_REPLICA, getArticleID(), WikiPage\getQueryInfo(), 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[] Array of Title objects linking here

Definition at line 3224 of file Title.php.

References $options, $res, as, DB_MASTER, DB_REPLICA, 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|string[]$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 2092 of file Title.php.

References $query, $ret, 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|string[]$query An optional query string, not used for interwiki links. Can be specified as an associative array as well, e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped). Some query patterns will trigger various shorturl path replacements.
string|string[]|bool$query2 An 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 String of the URL.

Definition at line 1993 of file Title.php.

References $matches, $query, $wgActionPaths, $wgArticlePath, $wgRequest, $wgScript, $wgServer, $wgVariantArticlePath, equals(), getNsText(), getPageLanguage(), getPrefixedDBkey(), Hooks\run(), wfAppendQuery(), and wfUrlencode().

Referenced by EditPage\getActionURL(), getCanonicalURL(), getEditURL(), getFullURL(), getInternalURL(), getLinkURL(), and Language\numLink().

◆ 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 4291 of file Title.php.

References getSubjectNsText().

◆ getNextRevisionID()

Title::getNextRevisionID (   $revId,
  $flags = 0 
)

Get the revision ID of the next revision.

Deprecated:
since 1.34, use RevisionLookup::getNextRevision
Parameters
int$revIdRevision ID. Get the revision that was after this one.
int$flagsTitle::GAID_FOR_UPDATE
Returns
int|bool Next revision ID, or false if none exists

Definition at line 3747 of file Title.php.

References getRelativeRevisionID().

◆ getNotificationTimestamp()

Title::getNotificationTimestamp (   $user = null)

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

Parameters
User | null$user
Returns
string|null

Definition at line 4253 of file Title.php.

References $user.

◆ getNsText()

Title::getNsText ( )

Get the namespace text.

Returns
string|false Namespace text

Definition at line 1086 of file Title.php.

References 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 1564 of file Title.php.

Referenced by WikiPage\onArticleCreate(), and WikiPage\onArticleDelete().

◆ 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

Definition at line 4456 of file Title.php.

References $wgLang, $wgLanguageCode, Language\factory(), getDbPageLanguageCode(), ContentHandler\getForTitle(), isSpecialPage(), and wfGetLangObj().

Referenced by MediaWiki\EditPage\TextboxBuilder\buildTextboxAttribs(), WikitextContent\fillParserOutput(), SpecialExpandTemplates\generateHtml(), getCdnUrls(), and 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

Definition at line 4494 of file Title.php.

References $wgLang, Language\factory(), getDbPageLanguageCode(), ContentHandler\getForTitle(), isSpecialPage(), and wfGetLangObj().

Referenced by SpecialExpandTemplates\showHtmlPreview().

◆ getParentCategories()

Title::getParentCategories ( )

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

Returns
array Array of parents in the form: $parent => $currentarticle

Definition at line 3633 of file Title.php.

References $dbr, $res, as, 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 3668 of file Title.php.

References $parent, as, and getParentCategories().

◆ getPartialURL()

Title::getPartialURL ( )

Get the URL-encoded form of the main part.

Returns
string Main part of the title, URL-encoded

Definition at line 993 of file Title.php.

References $mUrlform.

◆ getPrefixedDBkey()

◆ getPrefixedText()

◆ getPrefixedURL()

Title::getPrefixedURL ( )

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

Returns
string The URL-encoded form

Definition at line 1867 of file Title.php.

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

◆ getPreviousRevisionID()

Title::getPreviousRevisionID (   $revId,
  $flags = 0 
)

Get the revision ID of the previous revision.

Deprecated:
since 1.34, use RevisionLookup::getPreviousRevision
Parameters
int$revIdRevision ID. Get the revision that was before this one.
int$flagsTitle::GAID_FOR_UPDATE
Returns
int|bool Old revision ID, or false if none exists

Definition at line 3735 of file Title.php.

References getRelativeRevisionID().

◆ 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[] Array of Title redirects to this title

Definition at line 4320 of file Title.php.

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

◆ getRelativeRevisionID()

Title::getRelativeRevisionID (   $revId,
  $flags,
  $dir 
)
private

Get next/previous revision ID relative to another revision ID.

Parameters
int$revIdRevision ID. Get the revision that was before this one.
int$flagsTitle::GAID_FOR_UPDATE
string$dir'next' or 'prev'
Returns
int|bool New revision ID, or false if none exists

Definition at line 3711 of file Title.php.

References $rev.

Referenced by getNextRevisionID(), and getPreviousRevisionID().

◆ getRestrictionExpiry()

Title::getRestrictionExpiry (   $action)

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

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 2659 of file Title.php.

References loadRestrictions().

◆ getRestrictions()

Title::getRestrictions (   $action)

Accessor/initialisation for mRestrictions.

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 2631 of file Title.php.

References loadRestrictions().

Referenced by isProtected(), and isSemiProtected().

◆ getRestrictionTypes()

Title::getRestrictionTypes ( )

Returns restriction types for the current Title.

Returns
array Applicable restriction types

Definition at line 2308 of file Title.php.

References exists(), getPrefixedText(), isSpecialPage(), NS_FILE, Hooks\run(), and wfDebug().

Referenced by isProtected(), and loadRestrictionsFromRows().

◆ getRootText()

Title::getRootText ( )

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

the leftmost part before any slashes

Example:
Title::newFromText('User:Foo/Bar/Baz')->getRootText();
# returns: 'Foo'
Returns
string Root name
Since
1.20

Definition at line 1740 of file Title.php.

References getText(), and hasSubpages().

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 Root title
Since
1.20

Definition at line 1763 of file Title.php.

References getRootText().

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.

Uses $wgContentHandlerUseDB to determine whether to include page_content_model.

Returns
array

Definition at line 444 of file Title.php.

References $wgContentHandlerUseDB, and $wgPageLanguageUseDB.

◆ 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 1383 of file Title.php.

References in, and names.

◆ getSubjectNsText()

Title::getSubjectNsText ( )

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

Returns
string Namespace text

Definition at line 1111 of file Title.php.

References $services, and 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 1550 of file Title.php.

◆ 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 1847 of file Title.php.

References getText().

◆ 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 2924 of file Title.php.

References $dbr, $mNamespace, $options, DB_REPLICA, hasSubpages(), TitleArray\newFromResult(), and wfGetDB().

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 1823 of file Title.php.

References $mTextform, and hasSubpages().

Referenced by getSubpageUrlForm().

◆ getSubpageUrlForm()

Title::getSubpageUrlForm ( )

Get a URL-encoded form of the subpage text.

Returns
string URL-encoded subpage name

Definition at line 1856 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 1122 of file Title.php.

References $services, and getNsText().

◆ getTalkPage()

Title::getTalkPage ( )

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

Deprecated:
since 1.34, use NamespaceInfo::getTalkPage
Returns
Title The object for the talk page

Definition at line 1521 of file Title.php.

Referenced by 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 1535 of file Title.php.

References canHaveTalkPage(), getTalkPage(), and null.

Referenced by TitleTest\testGetTalkPageIfDefined_bad(), and TitleTest\testGetTalkPageIfDefined_good().

◆ 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[] Array of Title the Title objects used here

Definition at line 3336 of file Title.php.

References $options, and 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[] Array of Title the Title objects linking here

Definition at line 3266 of file Title.php.

References $options, and getLinksTo().

◆ getText()

◆ getTitleCache()

static Title::getTitleCache ( )
staticprivate
Returns
MapCacheLRU

Definition at line 430 of file Title.php.

References null.

◆ 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 201 of file Title.php.

◆ getTitleProtection()

Title::getTitleProtection ( )

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

Returns
array|bool An associative array representing any existent title protection, or false if there's none.

Definition at line 2335 of file Title.php.

References getTitleProtectionInternal().

◆ getTitleProtectionInternal()

Title::getTitleProtectionInternal ( )
protected

Fetch title protection settings.

To work correctly, $this->loadRestrictions() needs to have access to the actual protections in the database without munging 'sysop' => 'editprotected' and 'autoconfirmed' => 'editsemiprotected'. Other callers probably want $this->getTitleProtection() instead.

Returns
array|bool

Definition at line 2358 of file Title.php.

References $dbr, $mTitleProtection, $res, DB_REPLICA, exists(), CommentStore\getStore(), null, and wfGetDB().

Referenced by getTitleProtection(), and loadRestrictions().

◆ 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 961 of file Title.php.

References $mTitleValue, getPrefixedText(), null, 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 4239 of file Title.php.

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

◆ getTransWikiID()

Title::getTransWikiID ( )

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

Returns
string|false The DB name

Definition at line 944 of file Title.php.

References isExternal().

◆ getUserCaseDBKey()

Title::getUserCaseDBKey ( )

Get the DB key with the initial letter case as specified by the user.

Deprecated:
since 1.33; please use Title::getDBKey() instead
Returns
string DB key

Definition at line 1012 of file Title.php.

References $mDbkeyform, and $mUserCaseDBKey.

Referenced by FileRepo\getNameFromTitle().

◆ getUserPermissionsErrors()

Title::getUserPermissionsErrors (   $action,
  $user,
  $rigor = PermissionManager::RIGOR_SECURE,
  $ignoreErrors = [] 
)

Can $user perform $action on this page?

Todo:
FIXME: This does not check throttles (User::pingLimiter()).
Parameters
string$actionAction that permission needs to be checked for
User$userUser to check
string$rigorOne of (quick,full,secure)
  • quick : does cheap permission checks from replica DBs (usable for GUI creation)
  • full : does cheap and expensive checks possibly from a replica DB
  • secure : does cheap and expensive checks, using the master as needed
array$ignoreErrorsArray of Strings Set this to a list of message keys whose corresponding errors may be ignored.
Returns
array Array of arrays of the arguments to wfMessage to explain permissions problems.
Exceptions
Exception
Deprecated:
since 1.33, use MediaWikiServices::getInstance()->getPermissionManager()->getPermissionErrors()

Definition at line 2241 of file Title.php.

References $user.

◆ 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 1061 of file Title.php.

References getContentModel().

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

◆ hasFragment()

Title::hasFragment ( )

Check if a Title fragment is set.

Returns
bool
Since
1.23

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1595 of file Title.php.

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

◆ hasSourceText()

Title::hasSourceText ( )

Does this page have source text?

Returns
bool

Definition at line 4100 of file Title.php.

References $name, exists(), list, NS_MEDIAWIKI, MessageCache\singleton(), 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 1257 of file Title.php.

◆ hasSubpages()

Title::hasSubpages ( )

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

Returns
bool

Definition at line 2893 of file Title.php.

References $mHasSubpages, getSubpages(), and null.

Referenced by getBaseText(), getEditNotices(), getRootText(), getSubpages(), getSubpageText(), and isSubpage().

◆ 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 1217 of file Title.php.

References equals().

Referenced by ContentHandler\getPageLanguage(), inNamespaces(), and isRawHtmlMessage().

◆ inNamespaces()

Title::inNamespaces ( )

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 1229 of file Title.php.

References $namespaces, as, and 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 4181 of file Title.php.

References $fname, Wikimedia\Rdbms\IDatabase\addQuotes(), DeferredUpdates\addUpdate(), DB_MASTER, ResourceLoaderWikiModule\invalidateModuleCache(), null, pageCond(), DeferredUpdates\PRESEND, Wikimedia\Rdbms\IDatabase\timestamp(), Wikimedia\Rdbms\IDatabase\update(), use, wfGetDB(), and wfReadOnly().

Referenced by SpecialPageLanguage\changePageLanguage().

◆ 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 4037 of file Title.php.

References $services, hasSourceText(), isExternal(), NS_FILE, NS_MAIN, NS_MEDIA, NS_MEDIAWIKI, NS_SPECIAL, null, and Hooks\run().

Referenced by isKnown().

◆ isBigDeletion()

Title::isBigDeletion ( )

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

Returns
bool

Definition at line 3804 of file Title.php.

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

◆ isCascadeProtected()

Title::isCascadeProtected ( )

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

Returns
bool If the page is subject to cascading restrictions.

Definition at line 2501 of file Title.php.

References getCascadeProtectionSources(), and list.

Referenced by MediaWiki\EditPage\TextboxBuilder\getTextboxProtectionCSSClasses().

◆ 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 1269 of file Title.php.

◆ isConversionTable()

Title::isConversionTable ( )

Is this a conversion table for the LanguageConverter?

Returns
bool

Definition at line 1325 of file Title.php.

References getText(), and NS_MEDIAWIKI.

◆ isDeleted()

Title::isDeleted ( )

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

Returns
int The number of archived revisions

Definition at line 2954 of file Title.php.

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

◆ isDeletedQuick()

Title::isDeletedQuick ( )

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

Returns
bool

Definition at line 2979 of file Title.php.

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

◆ 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 4091 of file Title.php.

References exists(), and isAlwaysKnown().

Referenced by WantedQueryPage\existenceCheck().

◆ 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 886 of file Title.php.

References 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 1304 of file Title.php.

References equals().

◆ 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 1280 of file Title.php.

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

◆ isNamespaceProtected()

Title::isNamespaceProtected ( User  $user)

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

Parameters
User$userUser object to check permissions
Returns
bool

Definition at line 2483 of file Title.php.

References $wgNamespaceProtection, array(), as, and User\isAllowed().

◆ isNewPage()

Title::isNewPage ( )

Check if this is a new page.

Returns
bool

Definition at line 3794 of file Title.php.

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

◆ isProtected()

Title::isProtected (   $action = '')

Does the title correspond to a protected article?

Parameters
string$actionThe action the page is protected from, by default checks all actions.
Returns
bool

Definition at line 2451 of file Title.php.

References $type, $wgRestrictionLevels, as, getRestrictions(), getRestrictionTypes(), and isSpecialPage().

Referenced by MediaWiki\EditPage\TextboxBuilder\getTextboxProtectionCSSClasses().

◆ isRawHtmlMessage()

Title::isRawHtmlMessage ( )

Is this a message which can contain raw HTML?

Returns
bool
Since
1.32

Definition at line 1495 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.

Parameters
int$flagsA bit field; may be Title::GAID_FOR_UPDATE to select for update
Returns
bool

Definition at line 3029 of file Title.php.

References $mRedirect, article, getArticleID(), in, and null.

Referenced by CategoryViewer\addSubcategoryObject(), and OutputPage\buildBacklinkSubtitle().

◆ isSemiProtected()

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

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

Parameters
string$actionAction to check (default: edit)
Returns
bool

Definition at line 2423 of file Title.php.

References $wgSemiprotectedRestrictionLevels, as, and getRestrictions().

Referenced by MediaWiki\EditPage\TextboxBuilder\getTextboxProtectionCSSClasses().

◆ isSingleRevRedirect()

Title::isSingleRevRedirect ( )

Checks if this page is just a one-rev redirect.

Adds lock, so don't use just for light purposes.

Returns
bool

Definition at line 3531 of file Title.php.

References $wgContentHandlerUseDB, DB_MASTER, 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 1355 of file Title.php.

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

Referenced by ResourceLoaderWikiModule\invalidateModuleCache().

◆ isSiteCssConfigPage()

Title::isSiteCssConfigPage ( )

Is this a sitewide CSS "config" page?

Returns
bool
Since
1.32

Definition at line 1441 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 1477 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 1459 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 1175 of file Title.php.

References $name, isSpecialPage(), and list.

Referenced by isValidRedirectTarget().

◆ isSpecialPage()

Title::isSpecialPage ( )

Returns true if this is a special page.

Returns
bool

Definition at line 1165 of file Title.php.

References NS_SPECIAL.

Referenced by fixSpecialName(), getPageLanguage(), getPageViewLanguage(), getRestrictionTypes(), isProtected(), isSpecial(), isValidRedirectTarget(), secureAndSplit(), and MediaWiki\tryNormaliseRedirect().

◆ isSubpage()

Title::isSubpage ( )

Is this a subpage?

Returns
bool

Definition at line 1313 of file Title.php.

References false, 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 3998 of file Title.php.

◆ isTalkPage()

Title::isTalkPage ( )

Is this a talk page of some sort?

Returns
bool

Definition at line 1510 of file Title.php.

◆ 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 931 of file Title.php.

References 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 1369 of file Title.php.

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

Referenced by ResourceLoaderWikiModule\invalidateModuleCache().

◆ isUserCssConfigPage()

Title::isUserCssConfigPage ( )

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

Returns
bool
Since
1.31

Definition at line 1399 of file Title.php.

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

Referenced by getCdnUrls(), and isUserConfigPage().

◆ isUserJsConfigPage()

Title::isUserJsConfigPage ( )

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

Returns
bool
Since
1.31

Definition at line 1427 of file Title.php.

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

Referenced by getCdnUrls(), and isUserConfigPage().

◆ isUserJsonConfigPage()

Title::isUserJsonConfigPage ( )

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

Returns
bool
Since
1.31

Definition at line 1413 of file Title.php.

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

Referenced by getCdnUrls(), and isUserConfigPage().

◆ isValid()

Title::isValid ( )

Returns true if the title is valid, false if it is invalid.

Valid titles can be round-tripped via makeTitleSafe() and newFromText(). Invalid titles may get returned from makeTitle(), and it may be useful to allow them to exist, e.g. in order to process log entries about pages in namespaces that belong to extensions that are no longer installed.

Note
This method is relatively expensive. When constructing Title objects that need to be valid, use an instantiator method that is guaranteed to return valid titles, such as makeTitleSafe() or newFromText().
Returns
bool

Definition at line 865 of file Title.php.

References $services.

Referenced by TitleTest\testIsValid().

◆ isValidMoveOperation()

Title::isValidMoveOperation ( $nt,
  $auth = true,
  $reason = '' 
)

Check whether a given move operation would be valid.

Returns true if ok, or a getUserPermissionsErrors()-like array otherwise

Deprecated:
since 1.25, use MovePage's methods instead
Parameters
Title&$ntThe new title
bool$authWhether to check user permissions (uses $wgUser)
string$reasonIs the log summary of the move, used for spam checking
Returns
array|bool True on success, getUserPermissionsErrors()-like array on failure

Definition at line 3431 of file Title.php.

References wfDeprecated(), and wfMergeErrorArrays().

◆ isValidMoveTarget()

Title::isValidMoveTarget (   $nt)

Checks if $this can be moved to a given Title.

  • Selects for update, so don't call it unless you mean business
Deprecated:
since 1.25, use MovePage's methods instead
Parameters
Title$ntThe new title to check
Returns
bool

Definition at line 3582 of file Title.php.

References $content, $file, $rev, getPrefixedDBkey(), Revision\newFromTitle(), NS_FILE, null, wfDebug(), and wfDeprecated().

◆ isValidRedirectTarget()

Title::isValidRedirectTarget ( )

Check if this Title is a valid redirect target.

Returns
bool

Definition at line 4356 of file Title.php.

References $wgInvalidRedirectTargets, as, isSpecial(), and isSpecialPage().

◆ isWatchable()

Title::isWatchable ( )

Can this title be added to a user's watchlist?

Returns
bool

Definition at line 1155 of file Title.php.

References isExternal().

Referenced by ApiWatch\watchTitle().

◆ isWikitextPage()

Title::isWikitextPage ( )

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

Returns
bool

Definition at line 1337 of file Title.php.

References CONTENT_MODEL_WIKITEXT, and hasContentModel().

◆ legalChars()

static Title::legalChars ( )
static

◆ 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 531 of file Title.php.

References getContentModel(), in, and string.

◆ loadRestrictions()

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

Load restrictions from the page_restrictions table.

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 master DB.

Definition at line 2768 of file Title.php.

References $cache, $dbr, $fname, $rows, array(), DB_MASTER, DB_REPLICA, getArticleID(), getTitleProtectionInternal(), DBAccessObjectUtils\hasFlags(), loadRestrictionsFromRows(), WANObjectCache\TTL_UNCACHEABLE, use, wfGetDB(), and wfTimestampNow().

Referenced by areRestrictionsCascading(), getAllRestrictions(), getRestrictionExpiry(), and getRestrictions().

◆ 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.

Parameters
array$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 2690 of file Title.php.

References $dbr, $rows, $type, article, as, DB_REPLICA, getRestrictionTypes(), in, null, wfGetDB(), and wfTimestampNow().

Referenced by loadRestrictions().

◆ 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 819 of file Title.php.

References $name, and $title.

Referenced by SpecialRedirect\dispatchFile(), MovePageForm\doSubmit(), SpecialExport\getPagesFromCategory(), SpecialExport\getPagesFromNamespace(), 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 589 of file Title.php.

References $t, $title, getContentModel(), in, and wfUrlencode().

Referenced by DeletePageJob\__construct(), FakeDimensionFile\__construct(), JobSpecification\__construct(), Job\__construct(), PrefixSearchTest\addDBDataOnce(), CategoryViewer\addFragmentToTitle(), ChangesFeed\buildItems(), FindOrphanedFiles\checkFiles(), LocalRepo\checkRedirect(), Orphans\checkSeparation(), CompressOld\compressWithConcat(), BenchmarkTitleValue\constructTitle(), ApiFeedWatchlist\createFeedItem(), RefreshLinksJobTest\createPage(), ApiPageSetTest\createPageSetWithRedirect(), SpecialRedirect\dispatchUser(), LinkHolderArray\doVariants(), CheckBadRedirects\execute(), ApiQueryDeletedrevs\execute(), ApiQueryFilearchive\execute(), DeleteDefaultMessages\execute(), FixDoubleRedirects\execute(), ApiComparePages\execute(), AttachLatest\execute(), DumpLinks\execute(), PurgeChangedPages\execute(), NukeNS\execute(), DeleteEqualMessages\execute(), SqlSearchResultSet\extractResults(), ApiQueryLogEvents\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiQueryUserContribs\extractRowInfo(), Job\factory(), ApiFeedContributions\feedItem(), SpecialNewpages\feedItem(), SpecialRecentChanges\filterByCategories(), ForeignAPIRepo\findBySha1(), DoubleRedirectJob\fixRedirects(), WikiFilePage\followRedirect(), MediaWiki\Widget\Search\InterwikiSearchResultSetWidget\footerHtml(), ApiParse\formatCategoryLinks(), FeedUtils\formatDiff(), ApiParse\formatLinks(), UnusedtemplatesPage\formatResult(), UnusedCategoriesPage\formatResult(), UncategorizedCategoriesPage\formatResult(), ListDuplicatedFilesPage\formatResult(), WantedCategoriesPage\formatResult(), AncientPagesPage\formatResult(), BrokenRedirectsPage\formatResult(), DoubleRedirectsPage\formatResult(), ListredirectsPage\formatResult(), MIMEsearchPage\formatResult(), DeletedContribsPager\formatRevisionRow(), NewFilesPager\formatRow(), SpecialNewpages\formatRow(), AllMessagesTablePager\formatValue(), ImageListPager\formatValue(), SearchSuggestion\fromText(), ParserFuzzTest\fuzzTest(), GenerateSitemap\generateLimit(), LinksUpdate\getAddedLinks(), User\getCanonicalName(), ApiUpload\getChunkResult(), PopulateContentTables\getContentModel(), ApiComparePages\getDiffRevision(), ApiErrorFormatter\getDummyTitle(), CategoriesRdf\getDumpURI(), DoubleRedirectJob\getFinalDestination(), WikiPage\getHiddenCategories(), ChangeTagsLogItem\getHTML(), RevDelLogItem\getHTML(), SpecialExport\getLinks(), ApiStructureTest\getMain(), SearchNearMatcher\getNearMatchInternal(), MediaWiki\Search\ParserOutputSearchDataExtractor\getOutgoingLinks(), ChangesListSpecialPageTest\getPage(), ArticleViewTest\getPage(), ActionTest\getPage(), NewUsersLogFormatter\getPreloadTitles(), ApiQueryInfo\getProtectionInfo(), SpecialRandomInCategory\getRandomTitle(), SpecialMypage\getRedirect(), SpecialMytalk\getRedirect(), File\getRedirectedTitle(), WikiFilePage\getRedirectTarget(), ListredirectsPage\getRedirectTarget(), WikiPage\getRedirectTarget(), ApiPageSet\getRedirectTargets(), LinksUpdate\getRemovedLinks(), RollbackEdits\getRollbackTitles(), RCDatabaseLogEntry\getTarget(), DatabaseLogEntry\getTarget(), Parser\getTemplateDom(), MediaWiki\Search\ParserOutputSearchDataExtractor\getTemplates(), EditPage\getTemplates(), DifferenceEngine\getTitle(), RecentChange\getTitle(), Message\getTitle(), SpecialPageTest\getTitleForWithWarningProvider(), User\getTokenUrl(), ExternalUserNames\getUserLinkTitle(), UserRightsProxy\getUserPage(), User\getUserPage(), FixDefaultJsonContentPages\handleRow(), MediaWiki\Widget\Search\SimpleSearchResultSetWidget\headerHtml(), ImagePage\imageLinks(), ApiPageSet\initFromQueryResult(), ApiPageSet\initFromRevIDs(), CategoriesRdf\labelToUrl(), MessageCache\loadCachedMessagePageEntry(), MediaWiki\Rest\EntryPoint\main(), GenerateSitemap\main(), MediaWiki\main(), NamespaceDupes\mergePage(), Revision\newFromArchiveRow(), JobSpecification\newFromArray(), ForeignDBFile\newFromRow(), OldLocalFile\newFromRow(), LocalFile\newFromRow(), ArchivedFile\newFromRow(), Article\newFromTitle(), Revision\RevisionStore\newRevisionFromArchiveRow(), CategoryMembershipChangeJob\notifyUpdatesForRevision(), XmlDumpWriter\openPage(), InfoAction\pageInfo(), MessageCache\parse(), MediaWiki\parseTitle(), ApiUpload\performUpload(), PopulateContentModel\populateRevisionOrArchive(), RebuildTextIndex\populateSearchIndex(), SpecialBlock\processForm(), CleanupWatchlist\processRow(), CleanupCaps\processRowToLowercase(), CleanupCaps\processRowToUppercase(), SpecialUnblock\processUnblock(), TitleTest\provideCanHaveTalkPage(), TitleTest\provideCreateFragmentTitle(), TitleTest\provideEquals(), TitleTest\provideGetPrefixedDBKey(), TitleTest\provideGetPrefixedText(), TitleTest\provideGetTalkPage_bad(), TitleTest\provideGetTalkPage_good(), ExternalUserNamesTest\provideGetUserLinkTitle(), TitleTest\provideIsValid(), WikitextContentHandlerTest\provideMakeRedirectContent(), ParserOutputTest\provideMergeTrackingMetaDataFrom(), GlobalWithDBTest\provideWfIsBadImageList(), PurgeChangedFiles\purgeFromLogType(), PurgeList\purgeNamespace(), MessageCache\refreshAndReplaceInternal(), LinkHolderArray\replaceInternal(), ApiQueryDeletedRevisions\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryProtectedTitles\run(), ApiQueryImages\run(), ApiQueryExtLinksUsage\run(), ApiQueryIWBacklinks\run(), ApiQueryLangBacklinks\run(), ApiQueryCategories\run(), ApiQueryWatchlistRaw\run(), ApiQueryAllCategories\run(), ApiQueryPagesWithProp\run(), ApiQueryAllPages\run(), ApiQueryCategoryMembers\run(), ApiQueryLinks\run(), ApiQueryAllImages\run(), ApiQueryQueryPage\run(), ApiQueryBacklinksprop\run(), ApiQueryAllLinks\run(), DoubleRedirectJob\run(), ApiQueryRecentChanges\run(), ApiQueryBacklinks\runFirstQuery(), ApiQueryRandom\runQuery(), ApiQueryBacklinks\runSecondQuery(), ApiOpenSearch\search(), SearchSuggestion\setText(), TitlePermissionTest\setTitle(), MediaWiki\Tests\Permissions\PermissionManagerTest\setTitle(), SpecialMIMESearchTest\setUp(), ArticleTest\setUp(), TitlePermissionTest\setUp(), MediaWiki\Tests\Permissions\PermissionManagerTest\setUp(), OutputPageTest\setupFeedLinks(), ParserTestRunner\setupUploads(), SpecialAllPages\showChunk(), SpecialWhatLinksHere\showIndirectLinks(), SpecialUpload\showUploadWarning(), MediaWiki\Tests\Permissions\PermissionManagerTest\testBlockInstanceCache(), UserTest\testBlockInstanceCache(), TitlePermissionTest\testCascadingSourcesRestrictions(), MediaWiki\Tests\Permissions\PermissionManagerTest\testCascadingSourcesRestrictions(), TitleTest\testExists(), WikiCategoryPageTest\testExpectUnusedCategory_PropertyIsSet(), WikiCategoryPageTest\testExpectUnusedCategory_PropertyNotSet(), NamespaceInfoTest\testGetAssociated(), ResourceLoaderWikiModuleTest\testGetContentForRedirects(), WikiPageNoContentModelDbTest\testGetDeletionUpdates(), TitleMethodsTest\testGetLinkURL(), ParserOutputSearchDataExtractorTest\testGetOutgoingLinks(), MessageContentTest\testGetParserOutput(), NamespaceInfoTest\testGetSubject(), NamespaceInfoTest\testGetTalk(), ParserOutputSearchDataExtractorTest\testGetTemplates(), SpecialPageTest\testGetTitleFor(), WikiCategoryPageTest\testHiddenCategory_PropertyIsSet(), WikiCategoryPageTest\testHiddenCategory_PropertyNotSet(), SpecialPageTest\testInvalidGetTitleFor(), TitleTest\testIsAlwaysKnownOnInterwiki(), JobTest\testJobSignatureGeneric(), JobTest\testJobSignatureTitleBased(), JobTest\testJobSignatureTitleBasedIncomplete(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewMutableRevisionFromArray(), RCFeedIntegrationTest\testNotify(), RefreshLinksPartitionTest\testRefreshLinks(), SpecialSearchTest\testRewriteQueryWithSuggestion(), ApiQueryTest\testShouldNotExportPagesThatUserCanNotRead(), NamespaceInfoTest\testTitleGetOtherPage_special(), NamespaceInfoTest\testTitleGetTalkPage_special(), LinksUpdateTest\testUpdate_pagelinks(), ArticleViewTest\testViewMessagePage(), ArticleViewTest\testViewMissingUserPage(), ArticleViewTest\testViewRedirect(), ArticleViewTest\testViewUserPageOfNonexistingUser(), CoreParserFunctions\urlFunction(), 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.

Title objects returned by makeTitleSafe() are guaranteed to be valid, that is, they return true from the isValid() method. If no valid Title can be constructed from the input, this method returns null.

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 617 of file Title.php.

References $t, $title, exists(), and null.

Referenced by UsersPager\__construct(), ActiveUsersPager\__construct(), ImageListPager\__construct(), AllMessagesTablePager\__construct(), OutputPage\addCategoryLinks(), ParserOutput\addTrackingCategory(), CleanupImages\buildSafeTitle(), BenchmarkTitleValue\constructTitleSafe(), NaiveImportTitleFactory\createTitleFromForeignTitle(), NamespaceImportTitleFactory\createTitleFromForeignTitle(), PrefixSearch\defaultSearchBackend(), DifferenceEngine\deletedLink(), MovePageForm\doSubmit(), LinkHolderArray\doVariants(), Revision\ensureTitle(), SpecialLog\execute(), MakeTestEdits\execute(), SpecialContributions\execute(), SpecialExport\execute(), ImportSiteScripts\execute(), ApiFeedContributions\execute(), RefreshLinks\execute(), RebuildFileCache\execute(), MovePageForm\execute(), ImportImages\execute(), ApiQueryInfo\execute(), SpecialNewpages\form(), Linker\formatLinksInComment(), PageQueryPage\formatResult(), WantedQueryPage\formatResult(), FewestrevisionsPage\formatResult(), MostlinkedCategoriesPage\formatResult(), MostcategoriesPage\formatResult(), MostinterwikisPage\formatResult(), MostlinkedTemplatesPage\formatResult(), MostlinkedPage\formatResult(), UnwatchedpagesPage\formatResult(), ShortPagesPage\formatResult(), SpecialProtectedtitles\formatRow(), ProtectedPagesPager\formatValue(), ImageListPager\formatValue(), MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions(), NamespaceDupes\getAlternateTitle(), LinksUpdate\getCategoryInsertions(), NamespaceDupes\getDestinationTitle(), UncategorizedCategoriesPage\getExceptionList(), ImagePageTest\getImagePage(), ImagePage404Test\getImagePage(), SpecialAllPages\getNamespaceKeyAndText(), SpecialEditWatchlist\getNormalForm(), WantedFilesPage\getPageHeader(), NewPagesPager\getQueryInfo(), RandomPage\getRandomTitle(), SpecialPage\getSafeTitleFor(), MergeHistoryPager\getStartBody(), LogPager\getStartBody(), SpecialBlock\getTargetUserTitle(), MediaWiki\Tests\Storage\DerivedPageDataUpdaterTest\getTitle(), Category\getTitle(), UploadBase\getTitle(), TrackingCategories\getTrackingCategories(), SpecialUpload\getUploadForm(), SpecialUpload\getWatchCheck(), SpecialEditWatchlist\getWatchlist(), User\idFromName(), ChangeTags\isTagNameValid(), LogPager\limitPerformer(), ArchivedFile\loadFromRow(), Skin\makeNSUrl(), Linker\makeThumbLink2(), TitleCleanup\moveInconsistentPage(), MovePage\moveSubpagesInternal(), Category\newFromName(), File\normalizeTitle(), SpecialRandomInCategory\onSubmit(), ImageQueryPage\outputResults(), CoreParserFunctions\pagesincategory(), LanguageConverter\parseCachedTable(), CleanupImages\processRow(), OutputPageTest\provideGetCategories(), RefreshLinksJob\run(), CategoryFinder\seed(), RevisionDeleteUser\setUsernameBitfields(), SpecialUndelete\showHistory(), SpecialBookSources\showList(), SpecialUndelete\showList(), SpecialAllPages\showToplevel(), SpecialUpload\showViewDeletedLinks(), MediaWiki\Preferences\DefaultPreferencesFactory\skinPreferences(), CoreParserFunctions\special(), PrefixSearch\specialSearch(), ExtraParserTest\testTrackingCategory(), LinksUpdateTest\testUpdate_iwlinks(), ApiQueryBase\titlePartToKey(), ApiFileRevert\validateParameters(), and wfStreamThumb().

◆ moveSubpages()

Title::moveSubpages (   $nt,
  $auth = true,
  $reason = '',
  $createRedirect = true,
array  $changeTags = [] 
)

Move this page's subpages to be subpages of $nt.

Deprecated:
since 1.34, use MovePage instead
Parameters
Title$ntMove target
bool$authWhether $wgUser's permissions should be checked
string$reasonThe reason for the move
bool$createRedirectWhether to create redirects from the old subpages to the new ones Ignored if the user doesn't have the 'suppressredirect' right
array$changeTagsApplied to the entry in the move log and redirect page revision
Returns
array Array with old page titles as keys, and strings (new page titles) or getUserPermissionsErrors()-like arrays (errors) as values, or a getUserPermissionsErrors()-like error array with numeric indices if no pages were moved

Definition at line 3499 of file Title.php.

References as, and wfDeprecated().

◆ moveTo()

Title::moveTo ( $nt,
  $auth = true,
  $reason = '',
  $createRedirect = true,
array  $changeTags = [] 
)

Move a title to a new location.

Deprecated:
since 1.25, use the MovePage class instead
Parameters
Title&$ntThe new title
bool$authIndicates whether $wgUser's permissions should be checked
string$reasonThe reason for the move
bool$createRedirectWhether to create a redirect from the old title to the new title. Ignored if the user doesn't have the suppressredirect right.
array$changeTagsApplied to the entry in the move log and redirect page revision
Returns
array|bool True on success, getUserPermissionsErrors()-like array on failure

Definition at line 3467 of file Title.php.

References wfDeprecated().

◆ nameOf()

static Title::nameOf (   $id)
static

Get the prefixed DB key associated with an ID.

Parameters
int$idThe page_id of the article
Returns
Title|null An object representing the article, or null if no such article was found

Definition at line 678 of file Title.php.

References $dbr, $s, DB_REPLICA, null, and wfGetDB().

◆ 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 231 of file Title.php.

References $t, and null.

Referenced by TitleTest\testWgWhitelistReadRegexp().

◆ newFromID()

◆ newFromIDs()

static Title::newFromIDs (   $ids)
static

Make an array of titles from an array of IDs.

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

Definition at line 493 of file Title.php.

References $dbr, $res, $titles, as, DB_REPLICA, and wfGetDB().

◆ 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 271 of file Title.php.

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

Referenced by ActivityUpdateJob\__construct(), MediaWiki\Linker\LinkRenderer\buildAElement(), 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(), ApiQueryRecentChangesIntegrationTest\deletePage(), ApiQueryWatchlistIntegrationTest\deletePage(), ApiQueryRecentChangesIntegrationTest\doAnonPageEdit(), ApiQueryWatchlistIntegrationTest\doAnonPageEdit(), ApiQueryRecentChangesIntegrationTest\doBotPageEdit(), ApiQueryWatchlistIntegrationTest\doBotPageEdit(), ApiQueryRecentChangesIntegrationTest\doMinorPageEdit(), ApiQueryWatchlistIntegrationTest\doMinorPageEdit(), ApiQueryRecentChangesIntegrationTest\doPageEdit(), ApiQueryWatchlistIntegrationTest\doPageEdit(), ApiQueryWatchlistIntegrationTest\doPatrolledPageEdit(), ApiExpandTemplates\execute(), ApiComparePages\execute(), ApiQueryRevisionsBase\extractDeprecatedContent(), ApiQueryWatchlist\extractOutputData(), ApiQueryRevisionsBase\extractRevisionInfo(), TemplatesOnThisPageFormatter\formatTemplate(), Revision\MainSlotRoleHandler\getDefaultModel(), ApiComparePages\getDiffRevision(), WANCacheReapUpdate\getEventAffectedKeys(), ApiQueryRecentChangesIntegrationTest\getExternalRC(), ApiQueryWatchlistIntegrationTest\getExternalRC(), Linker\getImageLinkMTOParams(), MediaWiki\Linker\LinkRenderer\getLinkURL(), Revision\RevisionRenderer\getRenderedRevision(), Revision\RevisionStore\getRevisionByTitle(), Revision\getTitle(), ApiComparePages\guessTitle(), Revision\RevisionStore\insertRevisionOn(), Revision\MainSlotRoleHandler\isAllowedModel(), MediaWiki\Permissions\PermissionManager\isBlockedFrom(), Linker\makeImageLink(), MediaWiki\Linker\LinkRenderer\makeLink(), Linker\makeSelfLinkObj(), Linker\makeThumbLink2(), Revision\MutableRevisionRecord\newFromParentRevision(), ApiQueryAllRevisions\run(), ApiQueryAllDeletedRevisions\run(), ApiQueryRevisions\run(), MediaWiki\Linker\LinkRenderer\runLegacyBeginHook(), DifferenceEngine\setRevisions(), ManualLogEntry\setTarget(), ApiComparePages\setVals(), ApiQueryRecentChangesIntegrationTest\testCategorizeTypeParameter(), ApiQueryWatchlistIntegrationTest\testCategorizeTypeParameter(), TitleTest\testNewFromLinkTarget(), and TitleTest\testNewFromLinkTarget_clone().

◆ 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.

De- codes any HTML entities in the text.

Title objects returned by this method are guaranteed to be valid, and thus return true from the isValid() method.

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 on an error.

Definition at line 319 of file Title.php.

References null.

Referenced by DoubleRedirectJob\__construct(), ImageListPager\__construct(), SearchUpdate\__construct(), Installer\__construct(), LinkHolderArray\__wakeup(), ParserTestRunner\addArticle(), MediaWikiTestCase\addCoreDBData(), MediaWiki\Tests\Maintenance\TextPassDumperDatabaseTest\addDBData(), MediaWiki\Tests\Maintenance\BackupDumperPageTest\addDBData(), SpecialMyLanguageTest\addDBDataOnce(), ApiQueryUserContribsTest\addDBDataOnce(), ApiParseTest\addDBDataOnce(), ApiComparePagesTest\addDBDataOnce(), ApiQueryBasicTest\addDBDataOnce(), MediaWiki\Tests\Maintenance\FetchTextTest\addDBDataOnce(), MediaWiki\Tests\Maintenance\BackupDumperLoggerTest\addLogEntry(), MockCompletionSearchEngine\addMockResults(), ApiComparePagesTest\addPage(), Skin\addToSidebarPlain(), ApiFormatXml\addXslt(), ApiQuerySiteinfo\appendRightsInfo(), EditPageTest\assertEdit(), ApiMoveTest\assertMoved(), MovePageTest\assertMoved(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), SubpageImportTitleFactoryTest\basicProvider(), Parser\braceSubstitution(), SkinTemplate\buildPersonalUrls(), ImageListPager\buildQueryConds(), CoreParserFunctions\cascadingsources(), SpecialComparePages\checkExistingTitle(), LocalRepo\checkRedirect(), Skin\checkTitle(), ApiFeedWatchlist\createFeedItem(), RevisionDbTestBase\createPage(), PagePropsTest\createPage(), SubpageImportTitleFactory\createTitleFromForeignTitle(), UploadFromUrlTest\deleteFile(), ApiUploadTestCase\deleteFileByFileName(), ApiUploadTestCase\deleteFileByTitle(), CoreParserFunctions\displaytitle(), ApiStashEditTest\doCheckCache(), EditPageTest\doEditDummyNonTextPage(), SpecialExport\doExport(), SpecialRecentChangesLinked\doMainQuery(), PurgeList\doPurge(), GenderCache\doTitlesArray(), Skin\drawCategoryBrowser(), MediaWikiTestCase\editPage(), SearchEngineTest\editSearchResultPage(), ApiUndelete\execute(), ApiMergeHistory\execute(), ApiWatch\execute(), ApiMove\execute(), ApiExpandTemplates\execute(), PageExists\execute(), ApiRevisionDelete\execute(), Undelete\execute(), ApiQueryAllMessages\execute(), SpecialLog\execute(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), ViewCLI\execute(), SpecialGoToInterwiki\execute(), FormatInstallDoc\execute(), GetTextMaint\execute(), NukePage\execute(), SpecialListGroupRights\execute(), SpecialPasswordPolicies\execute(), ApiParse\execute(), Protect\execute(), ApiQueryImageInfo\execute(), FixDoubleRedirects\execute(), ApiQueryLogEvents\execute(), SpecialWhatLinksHere\execute(), DumpIterator\execute(), RollbackEdits\execute(), EditCLI\execute(), ImportTextFiles\execute(), DeleteBatch\execute(), MoveBatch\execute(), SpecialExpandTemplates\execute(), SpecialEditTags\execute(), BenchmarkParse\execute(), MovePageForm\execute(), FileDuplicateSearchPage\execute(), SpecialSearch\execute(), SpecialRevisionDelete\execute(), SpecialEditWatchlist\extractTitles(), SubpageImportTitleFactoryTest\failureProvider(), ResourceLoaderWikiModule\fetchTitleInfo(), SpecialMyLanguage\findTitle(), LanguageConverter\findVariantLink(), ApiHelp\fixHelpLinks(), Skin\footerLinkTitle(), foreach(), ApiParse\formatIWLinks(), ApiParse\formatLangLinks(), Linker\formatLinksInComment(), LogFormatter\formatParameterValue(), LogFormatter\formatParameterValueForApi(), MIMEsearchPage\formatResult(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), CoreParserFunctions\gender(), MoveLogFormatter\getActionLinks(), User\getCanonicalName(), EnhancedChangesListTest\getCategorizationChange(), Skin\getCategoryLinks(), ChangesListSpecialPage\getChangeTagList(), ResourceLoaderWikiModule\getContent(), RCCacheEntryFactoryTest\getContext(), Skin\getCopyright(), ApiComparePages\getDiffRevision(), MediaWiki\Tests\Storage\PageUpdaterTest\getDummyTitle(), UncategorizedCategoriesPage\getExceptionList(), MediaWikiTestCase\getExistingTestPage(), ApiFeedRecentChanges\getFeedObject(), SpecialPageLanguage\getFormFields(), UserGroupMembership\getGroupPage(), SpecialStatistics\getGroupStats(), OutputPage\getHeadLinksArray(), ApiPageSet\getInterwikiTitlesAsResult(), SkinTemplate\getLanguages(), IRCColourfulRCFeedFormatter\getLine(), SpecialExport\getLinks(), BlockLogFormatter\getMessageParameters(), MergeLogFormatter\getMessageParameters(), MoveLogFormatter\getMessageParameters(), ProtectLogFormatter\getMessageParameters(), WikitextStructureTest\getMockTitle(), SearchNearMatcher\getNearMatchInternal(), MediaWikiTestCase\getNonexistingTestPage(), WantedFilesPage\getPageHeader(), UsersPager\getPageHeader(), EditPage\getPreloadedContent(), MergeLogFormatter\getPreloadTitles(), MoveLogFormatter\getPreloadTitles(), ProtectLogFormatter\getPreloadTitles(), NewFilesPager\getQueryInfo(), ApiRollback\getRbTitle(), CssContent\getRedirectTarget(), JavaScriptContent\getRedirectTarget(), WikitextContent\getRedirectTargetAndText(), SpecialChangeCredentials\getReturnUrl(), ApiStashEditTest\getStashKey(), SpecialRecentChangesLinked\getTargetTitle(), TestRecentChangesHelper\getTestContext(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\getTestPageTitle(), ParserOutput\getText(), DifferenceEngineTest\getTitle(), CLIParser\getTitle(), UploadBase\getTitle(), ApiBase\getTitleFromTitleOrPageId(), ResourceLoaderWikiModule\getTitleInfo(), ApiBase\getTitleOrPageId(), SpecialSearch\goResult(), ApiComparePages\guessTitle(), ParserMethodsTest\helperParserFunc(), ApiPageSet\initFromRevIDs(), SideBarTest\initMessagesHref(), MediaWikiTestCase\insertPage(), User\isValidUserName(), LogPager\limitTitle(), PageArchive\listPagesByPrefix(), PageArchive\listPagesBySearch(), LoginSignupSpecialPage\load(), SpecialUndelete\loadRequest(), SpecialMergeHistory\loadRequestParams(), ChangeTags\logTagManagementAction(), MediaWiki\main(), SkinTemplate\makeArticleUrlDetails(), PopulateArchiveRevId\makeDummyRevisionRow(), UserTest\makeEdit(), MediaWiki\Tests\Revision\makeHasSameContentTestRecord(), Skin\makeI18nUrl(), Skin\makeKnownUrlDetails(), MessageCacheTest\makePage(), SkinTemplate\makeTalkUrlDetails(), PPFuzzTester\makeTitle(), LinksUpdateTest\makeTitleAndParserOutput(), Skin\makeUrl(), Skin\makeUrlDetails(), ApiQuerySearchTest\mockResultClosure(), TitleCleanup\moveIllegalPage(), ResourceLoaderContext\msg(), CoreParserFunctions\mwnamespace(), CoreParserFunctions\namespacee(), CoreParserFunctions\namespacenumber(), CategoryMembershipChangeTest\newChange(), ForeignAPIFile\newFromTitle(), HTMLFormTest\newInstance(), OutputPageTest\newInstance(), JobQueueMemoryTest\newJobSpecification(), WikiPageDbTestBase\newPage(), MediaWiki\Tests\Revision\RevisionStoreCacheRecordTest\newRevision(), MediaWiki\Tests\Revision\RevisionArchiveRecordTest\newRevision(), MediaWiki\Tests\Revision\RevisionStoreRecordTest\newRevision(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\newRevision(), RevisionDbTestBase\newTestRevision(), MediaWikiSite\normalizePageName(), SpecialRandomInCategory\onSubmit(), SpecialChangeContentModel\onSubmit(), SpecialChangeEmail\onSuccess(), WikiExporter\pageByName(), CoreParserFunctions\pageid(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), CoreParserFunctions\pagesize(), Parser\parseLinkParameter(), BenchmarkTitleValue\parseTitle(), ApiQueryBase\prefixedTitlePartToKey(), SpecialPage\prefixSearchString(), FileDuplicateSearchPage\prefixSearchSubpages(), ResourceLoaderWikiModule\preloadTitleInfo(), ResourceLoaderWikiModuleTest\prepareTitleInfo(), SearchEngine\processCompletionResults(), SpecialBlock\processForm(), WikiImporter\processLogItem(), TitleCleanup\processRow(), CleanupWatchlist\processRow(), CleanupCaps\processRowToUppercase(), CoreParserFunctions\protectionexpiry(), CoreParserFunctions\protectionlevel(), OutputPageTest\provideAddWikiText(), LogFormatterTest\provideApiParamFormatting(), MediaWiki\Tests\Revision\RevisionStoreRecordTest\provideConstructor(), MediaWiki\Tests\Revision\RevisionArchiveRecordTest\provideConstructor(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\provideConstructor(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\provideConstructorFailure(), MediaWiki\Tests\Revision\RevisionArchiveRecordTest\provideConstructorFailure(), MediaWiki\Tests\Revision\RevisionStoreRecordTest\provideConstructorFailure(), TitleTest\provideEquals(), ApiFormatXmlTest\provideGeneralEncoding(), PageDataRequestHandlerTest\provideHttpContentNegotiation(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\provideNewMutableRevisionFromArray(), MediaWiki\Tests\Revision\McrRevisionStoreDbTest\provideNewNullRevision(), MediaWiki\Tests\Revision\McrReadNewRevisionStoreDbTest\provideNewNullRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\provideNewNullRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\provideNonHistoryRevision(), ExtraParserTest\provideParseLinkParameter(), PurgePage\purge(), LocalFile\recordUpload2(), SearchExactMatchRescorer\redirectTargetsToRedirect(), Parser\renderImageGallery(), Parser\replaceInternalLinks2(), SearchExactMatchRescorer\rescore(), OutputPage\returnToMain(), CoreParserFunctions\revisionday(), CoreParserFunctions\revisionday2(), CoreParserFunctions\revisionid(), CoreParserFunctions\revisionmonth(), CoreParserFunctions\revisionmonth1(), CoreParserFunctions\revisiontimestamp(), CoreParserFunctions\revisionuser(), CoreParserFunctions\revisionyear(), SpecialComparePages\revOrTitle(), ApiQuerySiteinfoTest\rightsInfoProvider(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ApiQueryDeletedRevisions\run(), ApiQueryImages\run(), ApiQueryCategories\run(), ApiQueryLinks\run(), ApiQueryRecentChanges\run(), ParserTestRunner\runTest(), SpecialEditWatchlist\runWatchUnwatchCompleteHook(), SpecialChangeContentModel\setParameter(), WikiImporter\setTargetRootPage(), Parser\setTitle(), TextContentTest\setUp(), ApiRevisionDeleteTest\setUp(), RecentChangeTest\setUp(), PageDataRequestHandlerTest\setUp(), WatchActionTest\setUp(), ApiOptionsTest\setUp(), MagicVariableTest\setUp(), DefaultPreferencesFactoryTest\setUp(), ParserPreloadTest\setUp(), LogFormatterTest\setUp(), PageArchiveTestBase\setUp(), ApiFormatXmlTest\setUpBeforeClass(), OutputPageTest\setupCategoryTests(), 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\subPageSubtitle(), SpecialCreateAccount\successfulAction(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), CoreParserFunctions\talkspace(), CoreParserFunctions\talkspacee(), OutputPageTest\testAddBacklinkSubtitle(), ApiEditPageTest\testAppendInMediaWikiNamespace(), ApiEditPageTest\testAppendNewSection(), ApiEditPageTest\testAppendNewSectionWithSummary(), ApiEditPageTest\testAppendNewSectionWithTitle(), ApiEditPageTest\testAppendNewSectionWithTitleAndSummary(), ApiEditPageTest\testAppendToFirstSection(), ApiEditPageTest\testAppendToNonexistentSection(), ApiEditPageTest\testAppendToSection(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testApplyUpdate(), EditPageTest\testAutoMerge(), TagHooksTest\testBadFunctionTagHooks(), TagHooksTest\testBadTagHooks(), NamespaceImportTitleFactoryTest\testBasic(), NaiveImportTitleFactoryTest\testBasic(), ApiDeleteTest\testBatchedDelete(), OutputPageTest\testBuildBacklinkSubtitle(), ParserMethodsTest\testCallParserFunction(), CategoryMembershipChangeTest\testChangeAddedNoRev(), CategoryMembershipChangeTest\testChangeAddedWithRev(), CategoryMembershipChangeTest\testChangeRemovedNoRev(), CategoryMembershipChangeTest\testChangeRemovedWithRev(), MergeHistoryTest\testCheckPermissions(), ExtraParserTest\testCleanSig(), ExtraParserTest\testCleanSigDisabled(), TitleMethodsTest\testClearCaches(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), ApiQueryAllRevisionsTest\testContentComesWithContentModelAndFormat(), ApiEditPageTest\testCorrectContentFormat(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testCountRevisionsByTitle(), SampleTest\testCreateBasicListOfTitles(), ApiEditPageTest\testCreateOnly(), ContentHandlerTest\testDataIndexFields(), WikitextContentHandlerTest\testDataIndexFieldsFile(), ApiDeleteTest\testDelete(), ApiDeleteTest\testDeleteAbortedByHook(), ApiDeleteTest\testDeleteUnwatch(), ApiDeleteTest\testDeleteWatch(), ApiDeleteTest\testDeleteWithoutTagPermission(), ApiDeleteTest\testDeleteWithTag(), ApiDeleteTest\testDeletionWithoutPermission(), WikiPageDbTestBase\testDoDeleteArticle(), WikiPageDbTestBase\testDoEditContent_twice(), WatchedItemStoreIntegrationTest\testDuplicateAllAssociatedEntries(), ApiEditPageTest\testEdit_redirect(), ApiEditPageTest\testEdit_redirectText(), ApiEditPageTest\testEditAbortedByEditPageHookWithNoResult(), ApiEditPageTest\testEditAbortedByEditPageHookWithResult(), ApiEditPageTest\testEditAbortedByHook(), ApiEditPageTest\testEditAbortedByHookWithCustomOutput(), ApiEditPageTest\testEditAppend(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_newSection(), ApiEditPageTest\testEditConflict_T43990(), ApiEditPageTest\testEditMalformedSection(), ApiEditPageTest\testEditMinor(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditRecreate(), ApiEditPageTest\testEditSection(), ApiEditPageTest\testEditUnwatch(), ApiEditPageTest\testEditWatch(), ApiEditPageTest\testEditWithoutTagPermission(), ApiEditPageTest\testEditWithStartTimestamp(), ApiQuerySiteinfoTest\testExtensions(), TitleTest\testFixSpecialNameRetainsParameter(), HTMLRestrictionsFieldTest\testForm(), LinkerTest\testFormatComment(), LinkerTest\testFormatLinksInComment(), TagHooksTest\testFunctionTagHooks(), LinkerTest\testGenerateRollback(), ContentHandlerTest\testGetAutosummary(), TitleTest\testGetBaseText(), RevisionDbTestBase\testGetContentClone(), TitleMethodsTest\testGetContentModel(), ContentHandlerTest\testGetDefaultModelFor(), WikiPageMcrReadNewDbTest\testGetDeletionUpdates(), WikitextContentHandlerTest\testGetDeletionUpdates(), WikiPageDbTestBase\testGetDeletionUpdates(), UserTest\testGetEditCount(), ContentHandlerTest\testGetForTitle(), TitleTest\testGetFragment(), TitleTest\testGetFragmentForURL(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testGetMainContentWhenEmpty(), MergeHistoryTest\testGetMergedRevisionCount(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetNextRevision(), TitleMethodsTest\testGetOtherPage(), ContentHandlerTest\testGetPageLanguage(), TitleTest\testGetPageViewLanguage(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetParentLengths(), TextContentTest\testGetParserOutput(), ResourceLoaderWikiModuleTest\testGetPreloadedTitleInfo(), ExtraParserTest\testGetPreloadText(), PageArchiveTestBase\testGetPreviousRevision(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testGetPreviousRevision(), ApiWatchTest\testGetRollbackToken(), TitleTest\testGetRootText(), WikitextContentTest\testGetSecondaryDataUpdates(), WikitextContentHandlerTest\testGetSecondaryDataUpdates(), ParserMethodsTest\testGetSections(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testGetSlots(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testGetSlotWhenEmpty(), TitleTest\testGetSubpageText(), MediaWiki\Tests\Block\Restriction\PageRestrictionTest\testGetTitle(), TitleTest\testGetTitleValue(), WikitextContentTest\testHadSignature(), TitleMethodsTest\testHasContentModel(), TitleMethodsTest\testHasSubjectNamespace(), RecentChangeTest\testHiddenCategoryChange(), ImportLinkCacheIntegrationTest\testImportForImportSource(), TitleMethodsTest\testInNamespace(), TitleMethodsTest\testInNamespaces(), RevisionDbTestBase\testInsertOn_exceptionOnIncomplete(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testInsertRevisionOn_archive(), ApiResultTest\testInstanceDataMethods(), TitleTest\testIsAlwaysKnown(), MediaWiki\Tests\Permissions\PermissionManagerTest\testIsBlockedFrom(), UserTest\testIsBlockedFrom(), WikiPageDbTestBase\testIsCountable(), TitleTest\testIsRawHtmlMessage(), TitleMethodsTest\testIsUserConfigPage(), TitleMethodsTest\testIsUserCssConfigPage(), TitleMethodsTest\testIsUserJsConfigPage(), MergeHistoryTest\testIsValidMerge(), MergeHistoryTest\testIsValidMergeRevisionLimit(), MovePageTest\testIsValidMove(), TitleTest\testIsValidMoveOperation(), TitleMethodsTest\testIsWikitextPage(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromPageId(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTimestamp(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testLoadRevisionFromTitle(), ExtraParserTest\testLongNumericLinesDontKillTheParser(), ContentHandlerTest\testMakeContent(), LinkRendererTest\testMakeLink(), JavaScriptContentHandlerTest\testMakeRedirectContent(), CssContentHandlerTest\testMakeRedirectContent(), WikitextContentHandlerTest\testMakeRedirectContent(), ApiEditPageTest\testMd5AppendText(), ApiEditPageTest\testMd5PrependAndAppendText(), ApiEditPageTest\testMd5PrependText(), ApiEditPageTest\testMd5Text(), ApiEditPageTest\testMismatchedContentFormat(), MovePageTest\testMoveAbortedByTitleMoveHook(), ApiMoveTest\testMoveNoPermission(), MovePageTest\testMoveSubpages(), ApiMoveTest\testMoveSubpages(), ApiMoveTest\testMoveSubpagesError(), MovePageTest\testMoveSubpagesIfAllowed(), ApiMoveTest\testMoveTalkFailed(), ApiMoveTest\testMoveToInvalidPageName(), ApiMoveTest\testMoveWhileBlocked(), SearchNearMatcherTest\testNearMatch(), TitleTest\testNewFromLinkTarget_clone(), CategoryTest\testNewFromRow_notFoundWithTitle(), CategoryTest\testNewFromTitle(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewNullRevision_nonExistingTitle(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_getArchiveQueryInfo(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromArchiveRow_legacyEncoding(), MediaWiki\Tests\Revision\RevisionStoreTest\testNewRevisionFromRow_legacyEncoding_applied(), MediaWiki\Tests\Revision\RevisionStoreTest\testNewRevisionFromRow_legacyEncoding_ignored(), MediaWiki\Tests\Revision\RevisionStoreDbTestBase\testNewRevisionFromRow_no_user(), ApiEditPageTest\testNoCreate(), LinksUpdateTest\testOnAddingAndRemovingCategory_recentChangesRowIsAdded(), LinksUpdateTest\testOnAddingAndRemovingCategoryToTemplates_embeddingPagesAreIgnored(), WatchActionTest\testOnSuccessTalkPage(), ExportTest\testPageByTitle(), ExtraParserTest\testParse(), ExtraParserTest\testParseLinkParameter(), ContentHandlerTest\testParserOutputForIndexing(), ApiMoveTest\testPingLimiter(), ApiQueryAllPagesTest\testPrefixNormalizationSearchBug(), ExtraParserTest\testPreprocess(), ParserMethodsTest\testPreSaveTransform(), ExtraParserTest\testPreSaveTransform(), ApiPurgeTest\testPurgeMainPage(), OldChangesListTest\testRecentChangesLine_prefix(), EnhancedChangesListTest\testRecentChangesPrefix(), ParserMethodsTest\testRecursiveParse(), ImportLinkCacheIntegrationTest\testReImportForImportSource(), ApiEditPageTest\testReversedUndoAfter(), SpecialSearchTest\testSearchTermIsNotExpanded(), TitleTest\testSecureAndSplitValid(), MessageTest\testSerialization(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetComment(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetId(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetMainContent(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetMinor(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetPageId(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetParentId(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetSha1(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetSize(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetSlot(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetTimestamp(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetUser(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSetGetVisibility(), OutputPageTest\testSetRedirectedFrom(), OutputPageTest\testSetTitle(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSimpleGetOriginalAndInheritedSlots(), MediaWiki\Tests\Revision\MutableRevisionRecordTest\testSimpleremoveSlot(), TitleMethodsTest\testSiteConfigPage(), ExtraParserTest\testSpecialPageTransclusionRestoresGlobalState(), ApiResultTest\testStaticDataMethods(), ApiSetNotificationTimestampIntegrationTest\testStuff(), SpecialSearchTest\testSubPageRedirect(), ApiEditPageTest\testSupportsDirectApiEditing_withContentHandlerOverride(), SpecialPreferencesTest\testT43337(), TagHooksTest\testTagHooks(), ApiMoveTest\testTagsNoPermission(), TemplateCategoriesTest\testTemplateCategories(), ArticleTablesTest\testTemplatelinksUsesContentLanguage(), TitleMethodsTest\testTitleMoveCompleteIntegrationTest(), SampleTest\testTitleObjectFromObject(), SampleTest\testTitleObjectStringConversion(), ApiQueryTest\testTitlesAreRejectedIfInvalid(), ApiQueryTest\testTitlesGetNormalized(), ExtraParserTest\testTrackingCategory(), MediaWikiTest\testTryNormaliseRedirect(), ApiEditPageTest\testUndoAfterToHiddenRev(), ApiEditPageTest\testUndoAfterToInvalidRev(), ApiEditPageTest\testUndoWithConflicts(), ApiEditPageTest\testUndoWithSwappedRevisions(), ImportTest\testUnknownXMLTags(), ApiEditPageTest\testUnsupportedContentFormat(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_pagelinks(), LinksUpdateTest\testUpdate_templatelinks(), JavaScriptContentTest\testUpdateRedirect(), WatchedItemStoreIntegrationTest\testUpdateResetAndSetNotificationTimestamp(), MediaWiki\Tests\Revision\testUserCanBitfield(), RevisionDbTestBase\testUserCanBitfield(), RevisionDbTestBase\testUserWasLastToEdit(), WatchedItemStoreIntegrationTest\testWatchAndUnWatchItem(), WatchedItemStoreIntegrationTest\testWatchBatchAndClearItems(), RequestContextTest\testWikiPageTitle(), ParserMethodsTest\testWrapOutput(), Message\unserialize(), CoreParserFunctions\urlFunction(), and wfIsBadImage().

◆ newFromTextThrow()

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

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

The exception subclasses encode detailed information about why the title is invalid.

Title objects returned by this method are guaranteed to be valid, and thus return true from the isValid() method.

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 356 of file Title.php.

References $t, Sanitizer\decodeCharReferencesAndNormalize(), NS_MAIN, and null.

Referenced by SpecialRedirect\dispatchFile(), PageDataRequestHandler\handleRequest(), SpecialPageLanguage\onSubmit(), MediaWiki\parseTitle(), ApiPageSet\processTitlesArray(), TitleTest\testSecureAndSplitInvalid(), 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 256 of file Title.php.

Referenced by SpecialPage\getTitleFor(), SpecialEditWatchlist\runWatchUnwatchCompleteHook(), and TitleTest\testNewFromTitleValue().

◆ 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( $wgRequest->getVal( 'title' ) );

Example of right code: $title = Title::newFromText( $wgRequest->getVal( '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 407 of file Title.php.

References $t, and null.

Referenced by 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 653 of file Title.php.

References $title, and wfMessage().

Referenced by EmaillingJob\__construct(), Skin\addToSidebarPlain(), ApiQuerySiteinfo\appendGeneralInfo(), Installer\createMainpage(), ApiRsd\execute(), FileDeleteForm\execute(), MediaWiki\Preferences\DefaultPreferencesFactory\generateSkinOptions(), SpecialChangeCredentials\getAuthForm(), OOUIHTMLForm\getButtons(), VFormHTMLForm\getButtons(), HTMLForm\getButtons(), SpecialMyLanguage\getRedirect(), XmlDumpWriter\homelink(), Skin\logoText(), Skin\mainPageLink(), PopulateArchiveRevId\makeDummyRevisionRow(), Skin\makeMainPageUrl(), ViewActionTest\makeViewActionClassFactory(), JobQueueTest\newDedupedJob(), JobQueueTest\newJob(), SpecialChangeEmail\onSuccess(), MediaWiki\parseTitle(), SpecialSearchTest\provideRewriteQueryWithSuggestion(), OutputPage\returnToMain(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendNewAccountEmail(), MediaWiki\Auth\TemporaryPasswordPrimaryAuthenticationProvider\sendPasswordResetEmail(), OutputPage\showPermissionsErrorPage(), LoginHelper\showReturnToPage(), MediaWikiTitleCodec\splitTitleString(), ApiMessageTest\testApiMessage(), ApiMessageTest\testApiRawMessage(), SearchResultSetTest\testDelayedResultAugment(), SearchResultTest\testExtensionData(), SearchResultTest\testExtensionDataArrayBC(), ApiQuerySiteinfoTest\testGeneral(), SearchResultSetTest\testHasMoreResults(), SearchResultSetTest\testIterate(), JobTest\testJobFactory(), SiteStatsTest\testJobsCountGetCached(), TitleTest\testNewMainPage(), TitleTest\testNewMainPageWithLocal(), SearchNearMatchResultSetTest\testNumRows(), CdnCacheUpdateTest\testPurgeMergeWeb(), and SampleTest\testSetUpMainPageTitleForNextTest().

◆ 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 3695 of file Title.php.

References $mArticleID, $mDbkeyform, and $mNamespace.

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

◆ 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 1658 of file Title.php.

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

Referenced by getPrefixedDBkey(), getPrefixedText(), getPrefixedURL(), and SpecialSearch\showResults().

◆ 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 2852 of file Title.php.

References $fname, Wikimedia\Rdbms\IDatabase\addQuotes(), DeferredUpdates\addUpdate(), DB_MASTER, 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.

Definition at line 3414 of file Title.php.

References DeferredUpdates\addUpdate(), getCdnUrls(), and DeferredUpdates\PRESEND.

Referenced by WikiPage\onArticleCreate(), WikiPage\onArticleDelete(), and WikiPage\onArticleEdit().

◆ quickUserCan()

Title::quickUserCan (   $action,
  $user = null 
)

Can $user perform $action on this page? This skips potentially expensive cascading permission checks as well as avoids expensive error formatting.

Suitable for use for nonessential UI controls in common cases, but not for functional access control.

May provide false positives, but should never provide a false negative.

Parameters
string$actionAction that permission needs to be checked for
User | null$userUser to check (since 1.19); $wgUser will be used if not provided.
Returns
bool
Exceptions
Exception
Deprecated:
since 1.33, use MediaWikiServices::getInstance()->getPermissionManager()->quickUserCan(..) instead

Definition at line 2184 of file Title.php.

References $user, and userCan().

Referenced by TemplatesOnThisPageFormatter\buildEditLink(), and MovePageForm\showForm().

◆ resetArticleID()

Title::resetArticleID (   $newid)

This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache.

Parameters
int$newidThe new Article ID

Definition at line 3124 of file Title.php.

References null.

◆ resultToError()

Title::resultToError (   $errors,
  $result 
)
private

Add the resulting error code to the errors array.

Parameters
array$errorsList of current errors
array$resultResult of errors
Returns
array List of errors

Definition at line 2263 of file Title.php.

◆ secureAndSplit()

Title::secureAndSplit ( )
private

Secure and split - main initialisation function for this object.

Assumes that mDbkeyform has been set, and 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.

Exceptions
MalformedTitleExceptionOn invalid titles
Returns
bool True on success

Definition at line 3182 of file Title.php.

References 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!

Additionally, you should make sure you've checked ContentHandler::canBeUsedOn() first.

Since
1.28
Parameters
string$modelCONTENT_MODEL_XXX constant

Definition at line 1076 of file Title.php.

Referenced by EditPage\internalAttemptSave(), and SpecialChangeContentModel\onSubmit().

◆ 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 "#".

Deprecated for public use, use Title::makeTitle() with fragment parameter, or Title::createFragmentTarget(). Still in active use privately.

Access:
private
Parameters
string$fragmentText

Definition at line 1631 of file Title.php.

Referenced by secureAndSplit().

◆ 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 4224 of file Title.php.

References DeferredUpdates\addUpdate(), and NS_CATEGORY.

Referenced by WikiPage\onArticleCreate(), and WikiPage\onArticleDelete().

◆ userCan()

Title::userCan (   $action,
  $user = null,
  $rigor = PermissionManager::RIGOR_SECURE 
)

Can $user perform $action on this page?

Parameters
string$actionAction that permission needs to be checked for
User | null$userUser to check (since 1.19); $wgUser will be used if not provided.
string$rigorSame format as Title::getUserPermissionsErrors()
Returns
bool
Exceptions
Exception
Deprecated:
since 1.33, use MediaWikiServices::getInstance()->getPermissionManager()->userCan(..) instead

Definition at line 2203 of file Title.php.

References $user.

Referenced by quickUserCan().

◆ wasLocalInterwiki()

Title::wasLocalInterwiki ( )

Was this a local interwiki link?

Returns
bool

Definition at line 921 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 98 of file Title.php.

Referenced by getArticleID(), and pageCond().

◆ $mCascadeRestriction

bool Title::$mCascadeRestriction

Cascade restrictions on this page to included templates and images?

Definition at line 130 of file Title.php.

Referenced by areRestrictionsCascading().

◆ $mCascadeSources

array Title::$mCascadeSources

Where are the cascading restrictions coming from on this page?

Definition at line 142 of file Title.php.

Referenced by getCascadeProtectionSources().

◆ $mCascadingRestrictions

Title::$mCascadingRestrictions

Caching the results of getCascadeProtectionSources.

Definition at line 133 of file Title.php.

Referenced by getCascadeProtectionSources().

◆ $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 107 of file Title.php.

Referenced by getContentModel().

◆ $mDbkeyform

string Title::$mDbkeyform = ''

Main part with underscores.

Definition at line 80 of file Title.php.

Referenced by getCascadeProtectionSources(), getDBkey(), getRedirectsHere(), getUserCaseDBKey(), 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. Zero except in {{transclusion}} tags.

Definition at line 165 of file Title.php.

Referenced by getDefaultNamespace().

◆ $mEstimateRevisions

int Title::$mEstimateRevisions
private

Estimated number of revisions; null of not loaded.

Definition at line 116 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 113 of file Title.php.

◆ $mFragment

string Title::$mFragment = ''

Title fragment (i.e.

the bit after the #)

Definition at line 95 of file Title.php.

Referenced by getFragment(), and getFullText().

◆ $mHasCascadingRestrictions

bool Title::$mHasCascadingRestrictions
protected

Are cascading restrictions in effect on this page?

Definition at line 139 of file Title.php.

Referenced by getCascadeProtectionSources().

◆ $mHasSubpages

bool Title::$mHasSubpages
private

Whether a page has any subpages.

Definition at line 177 of file Title.php.

Referenced by hasSubpages().

◆ $mInterwiki

string Title::$mInterwiki = ''

Interwiki prefix.

Definition at line 89 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().

◆ $mLatestID

bool int Title::$mLatestID = false
protected

ID of most recent revision.

Definition at line 101 of file Title.php.

Referenced by getLatestRevID().

◆ $mLength

int Title::$mLength = -1
protected

The page length, 0 for special pages.

Definition at line 168 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 92 of file Title.php.

Referenced by wasLocalInterwiki().

◆ $mNamespace

int Title::$mNamespace = NS_MAIN

Namespace index, i.e.

one of the NS_xxxx constants

Definition at line 86 of file Title.php.

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

◆ $mNotificationTimestamp

array Title::$mNotificationTimestamp = []
private

Associative array of user ID -> timestamp/false.

Definition at line 174 of file Title.php.

◆ $mOldRestrictions

string bool Title::$mOldRestrictions = false
protected

Comma-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 127 of file Title.php.

◆ $mPageLanguage

bool Title::$mPageLanguage = false
private

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

Definition at line 180 of file Title.php.

◆ $mRedirect

null Title::$mRedirect = null

Is the article at this title a redirect?

Definition at line 171 of file Title.php.

Referenced by isRedirect().

◆ $mRestrictions

array Title::$mRestrictions = []

Array of groups allowed to edit this article.

Definition at line 119 of file Title.php.

Referenced by getAllRestrictions().

◆ $mRestrictionsExpiry

array Title::$mRestrictionsExpiry = []
protected

When do the restrictions on this page expire?

Definition at line 136 of file Title.php.

◆ $mRestrictionsLoaded

bool Title::$mRestrictionsLoaded = false

Boolean for initialisation on demand.

Definition at line 145 of file Title.php.

Referenced by areRestrictionsLoaded().

◆ $mTextform

string Title::$mTextform = ''

Text form (spaces not underscores) of the main part.

Definition at line 74 of file Title.php.

Referenced by getSubpageText(), and getText().

◆ $mTitleProtection

mixed Title::$mTitleProtection

Cached value for getTitleProtection (create protection)

Definition at line 158 of file Title.php.

Referenced by getTitleProtectionInternal().

◆ $mTitleValue

TitleValue null Title::$mTitleValue = null
private

A corresponding TitleValue object.

Definition at line 187 of file Title.php.

Referenced by getTitleValue().

◆ $mUrlform

string Title::$mUrlform = ''

URL-encoded form of the main part.

Definition at line 77 of file Title.php.

Referenced by getPartialURL().

◆ $mUserCaseDBKey

string Title::$mUserCaseDBKey
protected

Database key with the initial letter in the case specified by the user.

Definition at line 83 of file Title.php.

Referenced by getUserCaseDBKey().

◆ $prefixedText

string null Title::$prefixedText = null

Text form including namespace/interwiki, initialised on demand.

Only public to share cache with TitleFormatter

Access:
private

Definition at line 155 of file Title.php.

Referenced by getPrefixedText().

◆ $titleCache

MapCacheLRU null Title::$titleCache = null
staticprivate

Definition at line 42 of file Title.php.

◆ CACHE_MAX

const Title::CACHE_MAX = 1000

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 49 of file Title.php.

◆ GAID_FOR_UPDATE

◆ 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.

Since
1.33

Definition at line 64 of file Title.php.

Referenced by TitleTest\testNewFromLinkTarget_clone().


The documentation for this class was generated from the following file: