MediaWiki REL1_30
Title Class Reference

Represents a title within MediaWiki. More...

Inheritance diagram for Title:
Collaboration diagram for Title:

Public Attributes

const CACHE_MAX = 1000
 Title::newFromText maintains a cache to avoid expensive re-normalization of commonly used titles.
 
const GAID_FOR_UPDATE = 1
 Used to be GAID_FOR_UPDATE define.
 

Static Private Attributes

static HashBagOStuff $titleCache = null
 

Private member variables

Please use the accessor functions instead.

Access:\n private
string $mTextform = ''
 Text form (spaces not underscores) of the main part.
 
string $mUrlform = ''
 URL-encoded form of the main part.
 
string $mDbkeyform = ''
 Main part with underscores.
 
int $mNamespace = NS_MAIN
 Namespace index, i.e.
 
string $mInterwiki = ''
 Interwiki prefix.
 
string $mFragment = ''
 Title fragment (i.e.
 
int $mArticleID = -1
 Article ID, fetched from the link cache on demand.
 
array $mRestrictions = []
 Array of groups allowed to edit this article.
 
bool $mCascadeRestriction
 Cascade restrictions on this page to included templates and images?
 
 $mCascadingRestrictions
 Caching the results of getCascadeProtectionSources.
 
array $mCascadeSources
 Where are the cascading restrictions coming from on this page?
 
bool $mRestrictionsLoaded = false
 Boolean for initialisation on demand.
 
mixed $mTitleProtection
 Cached value for getTitleProtection (create protection)
 
int $mDefaultNamespace = NS_MAIN
 Namespace index when there is no namespace.
 
null $mRedirect = null
 Is the article at this title a redirect?
 
string $mUserCaseDBKey
 Database key with the initial letter in the case specified by the user.
 
bool int $mLatestID = false
 ID of most recent revision.
 
string bool $mOldRestrictions = false
 Text form (spaces not underscores) of the main part.
 
array $mRestrictionsExpiry = []
 When do the restrictions on this page expire?
 
bool $mHasCascadingRestrictions
 Are cascading restrictions in effect on this page?
 
string $mPrefixedText = null
 Text form including namespace/interwiki, initialised on demand.
 
int $mLength = -1
 The page length, 0 for special pages.
 
bool $mLocalInterwiki = false
 Was this Title created from a string with a local interwiki prefix?
 
bool string $mContentModel = false
 ID of the page's content model, i.e.
 
bool $mForcedContentModel = false
 If a content model was forced via setContentModel() this will be true to avoid having other code paths reset it.
 
int $mEstimateRevisions
 Estimated number of revisions; null of not loaded.
 
array $mNotificationTimestamp = []
 Associative array of user ID -> timestamp/false.
 
bool $mHasSubpages
 Whether a page has any subpages.
 
bool $mPageLanguage = false
 The (string) language code of the page's language and content code.
 
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.
 
TitleValue $mTitleValue = null
 A corresponding TitleValue object.
 
bool $mIsBigDeletion = null
 Would deleting this page be a big deletion?
 
static getTitleFormatter ()
 B/C kludge: provide a TitleParser for use by Title.
 
static getInterwikiLookup ()
 B/C kludge: provide an InterwikiLookup for use by Title.
 
static getTitleCache ()
 
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.
 
 __construct ()
 
 loadFromRow ( $row)
 Load Title object fields from a DB row.
 
 isValid ()
 Returns true if the title is valid, false if it is invalid.
 
 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 )
 
 isExternal ()
 Is this Title interwiki?
 
 getInterwiki ()
 Get the interwiki prefix.
 
 wasLocalInterwiki ()
 Was this a local interwiki link?
 
 isTrans ()
 Determine whether the object refers to a page within this project and is transcludable.
 
 getTransWikiID ()
 Returns the DB name of the distant wiki which owns the object.
 
 getTitleValue ()
 Get a TitleValue object representing this Title.
 
 getText ()
 Get the text form (spaces not underscores) of the main part.
 
 getPartialURL ()
 Get the URL-encoded form of the main part.
 
 getDBkey ()
 Get the main part with underscores.
 
 getUserCaseDBKey ()
 Get the DB key with the initial letter case as specified by the user.
 
 getNamespace ()
 Get the namespace index, i.e.
 
 getContentModel ( $flags=0)
 Get the page's content model id, see the CONTENT_MODEL_XXX constants.
 
 hasContentModel ( $id)
 Convenience method for checking a title's content model name.
 
 setContentModel ( $model)
 Set a proposed content model for the page for permissions checking.
 
 getNsText ()
 Get the namespace text.
 
 getSubjectNsText ()
 Get the namespace text of the subject (rather than talk) page.
 
 getTalkNsText ()
 Get the namespace text of the talk page.
 
 canTalk ()
 Can this title have a corresponding talk page?
 
 canHaveTalkPage ()
 Can this title have a corresponding talk page?
 
 canExist ()
 Is this in a namespace that allows actual pages?
 
 isWatchable ()
 Can this title be added to a user's watchlist?
 
 isSpecialPage ()
 Returns true if this is a special page.
 
 isSpecial ( $name)
 Returns true if this title resolves to the named special page.
 
 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.
 
 inNamespace ( $ns)
 Returns true if the title is inside the specified namespace.
 
 inNamespaces ()
 Returns true if the title is inside one of the specified namespaces.
 
 hasSubjectNamespace ( $ns)
 Returns true if the title has the same subject namespace as the namespace specified.
 
 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?
 
 isMovable ()
 Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable.
 
 isMainPage ()
 Is this the mainpage?
 
 isSubpage ()
 Is this a subpage?
 
 isConversionTable ()
 Is this a conversion table for the LanguageConverter?
 
 isWikitextPage ()
 Does that page contain wikitext, or it is JS, CSS or whatever?
 
 isCssOrJsPage ()
 Could this page contain custom CSS or JavaScript for the global UI.
 
 isCssJsSubpage ()
 Is this a .css or .js subpage of a user page?
 
 getSkinFromCssJsSubpage ()
 Trim down a .css or .js subpage title to get the corresponding skin name.
 
 isCssSubpage ()
 Is this a .css subpage of a user page?
 
 isJsSubpage ()
 Is this a .js subpage of a user page?
 
 isTalkPage ()
 Is this a talk page of some sort?
 
 getTalkPage ()
 Get a Title object associated with the talk page of this article.
 
 getTalkPageIfDefined ()
 Get a Title object associated with the talk page of this article, if such a talk page can exist.
 
 getSubjectPage ()
 Get a title object associated with the subject page of this talk page.
 
 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.
 
 getDefaultNamespace ()
 Get the default namespace index, for when there is no namespace.
 
 getFragment ()
 Get the Title fragment (i.e.
 
 hasFragment ()
 Check if a Title fragment is set.
 
 getFragmentForURL ()
 Get the fragment in URL form, including the "#" character if there is one.
 
 setFragment ( $fragment)
 Set the fragment for this title.
 
 createFragmentTarget ( $fragment)
 Creates a new Title for a different fragment of the same page.
 
 getPrefixedDBkey ()
 Get the prefixed database key form.
 
 getPrefixedText ()
 Get the prefixed title with spaces.
 
 __toString ()
 Return a string representation of this title.
 
 getFullText ()
 Get the prefixed title with spaces, plus any fragment (part beginning with '#')
 
 getRootText ()
 Get the root page name text without a namespace, i.e.
 
 getRootTitle ()
 Get the root page name title, i.e.
 
 getBaseText ()
 Get the base page name without a namespace, i.e.
 
 getBaseTitle ()
 Get the base page name title, i.e.
 
 getSubpageText ()
 Get the lowest-level subpage name, i.e.
 
 getSubpage ( $text)
 Get the title for a subpage of the current page.
 
 getSubpageUrlForm ()
 Get a URL-encoded form of the subpage text.
 
 getPrefixedURL ()
 Get a URL-encoded title (not an actual URL) including interwiki.
 
 getFullURL ( $query='', $query2=false, $proto=PROTO_RELATIVE)
 Get a real URL referring to this title, with interwiki link and fragment.
 
 getFullUrlForRedirect ( $query='', $proto=PROTO_CURRENT)
 Get a url appropriate for making redirects based on an untrusted url arg.
 
 getLocalURL ( $query='', $query2=false)
 Get a URL with no fragment or server name (relative URL) from a Title object.
 
 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.
 
 getInternalURL ( $query='', $query2=false)
 Get the URL form for an internal link.
 
 getCanonicalURL ( $query='', $query2=false)
 Get the URL for a canonical link, for use in things like IRC and e-mail notifications.
 
 getEditURL ()
 Get the edit URL for this 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.
 
 userCan ( $action, $user=null, $rigor='secure')
 Can $user perform $action on this page?
 
 getUserPermissionsErrors ( $action, $user, $rigor='secure', $ignoreErrors=[])
 Can $user perform $action on this page?
 
 getRestrictionTypes ()
 Returns restriction types for the current Title.
 
 getTitleProtection ()
 Is this title subject to title protection? Title protection is the one applied against creation of such title.
 
 deleteTitleProtection ()
 Remove any title protection due to page existing.
 
 isSemiProtected ( $action='edit')
 Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels?
 
 isProtected ( $action='')
 Does the title correspond to a protected article?
 
 isNamespaceProtected (User $user)
 Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection.
 
 isCascadeProtected ()
 Cascading protection: Return true if cascading restrictions apply to this page, false if not.
 
 areCascadeProtectionSourcesLoaded ( $getPages=true)
 Determines whether cascading protection sources have already been loaded from the database.
 
 getCascadeProtectionSources ( $getPages=true)
 Cascading protection: Get the source of any cascading restrictions on this page.
 
 areRestrictionsLoaded ()
 Accessor for mRestrictionsLoaded.
 
 getRestrictions ( $action)
 Accessor/initialisation for mRestrictions.
 
 getAllRestrictions ()
 Accessor/initialisation for mRestrictions.
 
 getRestrictionExpiry ( $action)
 Get the expiry time for the restriction against a given action.
 
 areRestrictionsCascading ()
 Returns cascading restrictions for the current article.
 
 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.
 
 loadRestrictions ( $oldFashionedRestrictions=null)
 Load restrictions from the page_restrictions table.
 
 flushRestrictions ()
 Flush the protection cache in this object and force reload from the database.
 
 hasSubpages ()
 Does this have subpages? (Warning, usually requires an extra DB query.)
 
 getSubpages ( $limit=-1)
 Get all subpages of this page.
 
 isDeleted ()
 Is there a version of this page in the deletion archive?
 
 isDeletedQuick ()
 Is there a version of this page in the deletion archive?
 
 getArticleID ( $flags=0)
 Get the article ID for this Title from the link cache, adding it if necessary.
 
 isRedirect ( $flags=0)
 Is this an article that is a redirect page? Uses link cache, adding it if necessary.
 
 getLength ( $flags=0)
 What is the length of this page? Uses link cache, adding it if necessary.
 
 getLatestRevID ( $flags=0)
 What is the page_latest field for this page?
 
 resetArticleID ( $newid)
 This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache.
 
 getLinksTo ( $options=[], $table='pagelinks', $prefix='pl')
 Get an array of Title objects linking to this Title Also stores the IDs in the link cache.
 
 getTemplateLinksTo ( $options=[])
 Get an array of Title objects using this Title as a template Also stores the IDs in the link cache.
 
 getLinksFrom ( $options=[], $table='pagelinks', $prefix='pl')
 Get an array of Title objects linked from this Title Also stores the IDs in the link cache.
 
 getTemplateLinksFrom ( $options=[])
 Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache.
 
 getBrokenLinksFrom ()
 Get an array of Title objects referring to non-existent articles linked from this page.
 
 getCdnUrls ()
 Get a list of URLs to purge from the CDN cache when this page changes.
 
 getSquidURLs ()
 
 purgeSquid ()
 Purge all applicable CDN URLs.
 
 isValidMoveOperation (&$nt, $auth=true, $reason='')
 Check whether a given move operation would be valid.
 
 moveTo (&$nt, $auth=true, $reason='', $createRedirect=true, array $changeTags=[])
 Move a title to a new location.
 
 moveSubpages ( $nt, $auth=true, $reason='', $createRedirect=true, array $changeTags=[])
 Move this page's subpages to be subpages of $nt.
 
 isSingleRevRedirect ()
 Checks if this page is just a one-rev redirect.
 
 isValidMoveTarget ( $nt)
 Checks if $this can be moved to a given Title.
 
 getParentCategories ()
 Get categories to which this Title belongs and return an array of categories' names.
 
 getParentCategoryTree ( $children=[])
 Get a tree of parent categories.
 
 pageCond ()
 Get an associative array for selecting this title from the "page" table.
 
 getPreviousRevisionID ( $revId, $flags=0)
 Get the revision ID of the previous revision.
 
 getNextRevisionID ( $revId, $flags=0)
 Get the revision ID of the next revision.
 
 getFirstRevision ( $flags=0)
 Get the first revision of the page.
 
 getEarliestRevTime ( $flags=0)
 Get the oldest revision timestamp of this page.
 
 isNewPage ()
 Check if this is a new page.
 
 isBigDeletion ()
 Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
 
 estimateRevisionCount ()
 Get the approximate revision count of this page.
 
 countRevisionsBetween ( $old, $new, $max=null)
 Get the number of revisions between the given revision.
 
 getAuthorsBetween ( $old, $new, $limit, $options=[])
 Get the authors between the given revisions or revision IDs.
 
 countAuthorsBetween ( $old, $new, $limit, $options=[])
 Get the number of authors between the given revisions or revision IDs.
 
 equals (Title $title)
 Compare with another title.
 
 isSubpageOf (Title $title)
 Check if this title is a subpage of another title.
 
 exists ( $flags=0)
 Check if page exists.
 
 isAlwaysKnown ()
 Should links to this title be shown as potentially viewable (i.e.
 
 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).
 
 hasSourceText ()
 Does this page have source text?
 
 getDefaultMessageText ()
 Get the default message text or false if the message doesn't exist.
 
 invalidateCache ( $purgeTime=null)
 Updates page_touched for this page; called from LinksUpdate.php.
 
 touchLinks ()
 Update page_touched timestamps and send CDN purge messages for pages linking to this title.
 
 getTouched ( $db=null)
 Get the last touched timestamp.
 
 getNotificationTimestamp ( $user=null)
 Get the timestamp when this page was updated since the user last saw it.
 
 getNamespaceKey ( $prepend='nstab-')
 Generate strings used for xml 'id' names in monobook tabs.
 
 getRedirectsHere ( $ns=null)
 Get all extant redirects to this Title.
 
 isValidRedirectTarget ()
 Check if this Title is a valid redirect target.
 
 getBacklinkCache ()
 Get a backlink cache object.
 
 canUseNoindex ()
 Whether the magic words INDEX and NOINDEX function for this page.
 
 getCategorySortkey ( $prefix='')
 Returns the raw sort key to be used for categories, with the specified prefix.
 
 getPageLanguage ()
 Get the language in which the content of this page is written in wikitext.
 
 getPageViewLanguage ()
 Get the language in which the content of this page is written when viewed by user.
 
 getEditNotices ( $oldid=0)
 Get a list of rendered edit notices for this page.
 
 __sleep ()
 
 __wakeup ()
 Text form (spaces not underscores) of the main part.
 
static newFromDBkey ( $key)
 Create a new Title from a prefixed DB key.
 
static newFromTitleValue (TitleValue $titleValue)
 Create a new Title from a TitleValue.
 
static newFromLinkTarget (LinkTarget $linkTarget)
 Create a new Title from a LinkTarget.
 
static newFromText ( $text, $defaultNamespace=NS_MAIN)
 Create a new Title from text, such as what one would find in a link.
 
static newFromTextThrow ( $text, $defaultNamespace=NS_MAIN)
 Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.
 
static newFromURL ( $url)
 THIS IS NOT THE FUNCTION YOU WANT.
 
static newFromID ( $id, $flags=0)
 Create a new Title from an article ID.
 
static newFromIDs ( $ids)
 Make an array of titles from an array of IDs.
 
static newFromRow ( $row)
 Make a Title object from a DB row.
 
static makeTitle ( $ns, $title, $fragment='', $interwiki='')
 Create a new Title from a namespace index and a DB key.
 
static makeTitleSafe ( $ns, $title, $fragment='', $interwiki='')
 Create a new Title from a namespace index and a DB key.
 
static newMainPage ()
 Create a new Title for the Main Page.
 
static nameOf ( $id)
 Get the prefixed DB key associated with an ID.
 
static legalChars ()
 Get a regex character class describing the legal characters in a link.
 
static getTitleInvalidRegex ()
 Returns a simple regex that will match on characters and sequences invalid in titles.
 
static convertByteClassToUnicodeClass ( $byteClass)
 Utility method for converting a character sequence from bytes to Unicode.
 
static makeName ( $ns, $title, $fragment='', $interwiki='', $canonicalNamespace=false)
 Make a prefixed DB key from a DB key and a namespace index.
 
static escapeFragmentForURL ( $fragment)
 Escape a text fragment, say from a link, for a URL.
 
static compare (LinkTarget $a, LinkTarget $b)
 Callback for usort() to do title sorts by (namespace, title)
 
static getFilteredRestrictionTypes ( $exists=true)
 Get a filtered list of all restriction types supported by this wiki.
 
static purgeExpiredRestrictions ()
 Purge expired restrictions from the page_restrictions table.
 
static clearCaches ()
 Text form (spaces not underscores) of the main part.
 
static capitalize ( $text, $ns=NS_MAIN)
 Capitalize a text string for a title if it belongs to a namespace that capitalizes.
 
static getSelectFields ()
 Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries.
 
 prefix ( $name)
 Prefix some arbitrary text with the namespace or interwiki prefix of this object.
 
 checkQuickPermissions ( $action, $user, $errors, $rigor, $short)
 Permissions checks that fail most often, and which are easiest to test.
 
 resultToError ( $errors, $result)
 Add the resulting error code to the errors array.
 
 checkPermissionHooks ( $action, $user, $errors, $rigor, $short)
 Check various permission hooks.
 
 checkSpecialsAndNSPermissions ( $action, $user, $errors, $rigor, $short)
 Check permissions on special pages & namespaces.
 
 checkCSSandJSPermissions ( $action, $user, $errors, $rigor, $short)
 Check CSS/JS sub-page permissions.
 
 checkPageRestrictions ( $action, $user, $errors, $rigor, $short)
 Check against page_restrictions table requirements on this page.
 
 checkCascadingSourcesRestrictions ( $action, $user, $errors, $rigor, $short)
 Check restrictions on cascading pages.
 
 checkActionPermissions ( $action, $user, $errors, $rigor, $short)
 Check action permissions not already checked in checkQuickPermissions.
 
 checkUserBlock ( $action, $user, $errors, $rigor, $short)
 Check that the user isn't blocked from editing.
 
 checkReadPermissions ( $action, $user, $errors, $rigor, $short)
 Check that the user is allowed to read this page.
 
 missingPermissionError ( $action, $short)
 Get a description array when the user doesn't have the right to perform $action (i.e.
 
 secureAndSplit ()
 Secure and split - main initialisation function for this object.
 
 getRelativeRevisionID ( $revId, $flags, $dir)
 Get next/previous revision ID relative to another revision ID.
 
 getDbPageLanguageCode ()
 Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false.
 
 getUserPermissionsErrorsInternal ( $action, $user, $rigor='secure', $short=false)
 Can $user perform $action on this page? This is an internal function, with multiple levels of checks depending on performance needs; see $rigor below.
 
 getTitleProtectionInternal ()
 Fetch title protection settings.
 
 validateFileMoveOperation ( $nt)
 Check if the requested move target is a valid file move target.
 

Additional Inherited Members

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

Constructor & Destructor Documentation

◆ __construct()

Title::__construct ( )
Access:\n protected

Definition at line 198 of file Title.php.

Member Function Documentation

◆ __sleep()

Title::__sleep ( )
Returns
array

Definition at line 5009 of file Title.php.

◆ __toString()

Title::__toString ( )

Return a string representation of this title.

Returns
string Representation of this title

Definition at line 1564 of file Title.php.

References getPrefixedText().

◆ __wakeup()

Title::__wakeup ( )

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

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

◆ areRestrictionsCascading()

Title::areRestrictionsCascading ( )

Returns cascading restrictions for the current article.

Returns
bool

Definition at line 3035 of file Title.php.

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

◆ canExist()

Title::canExist ( )

Is this in a namespace that allows actual pages?

Returns
bool

Definition at line 1104 of file Title.php.

References NS_MAIN.

Referenced by RequestContext\canUseWikiPage().

◆ canHaveTalkPage()

Title::canHaveTalkPage ( )

Can this title have a corresponding talk page?

See also
MWNamespace::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 1095 of file Title.php.

Referenced by canTalk(), getOtherPage(), and getTalkPageIfDefined().

◆ canTalk()

Title::canTalk ( )

Can this title have a corresponding talk page?

Deprecated:
since 1.30, use canHaveTalkPage() instead.
Returns
bool True if this title either is a talk page or can have a talk page associated.

Definition at line 1083 of file Title.php.

References canHaveTalkPage().

◆ canUseNoindex()

Title::canUseNoindex ( )

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

Returns
bool

Definition at line 4788 of file Title.php.

References $wgExemptFromUserRobotsControl, and global.

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

References $wgContLang, and global.

◆ checkActionPermissions()

Title::checkActionPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check action permissions not already checked in checkQuickPermissions.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2371 of file Title.php.

References $user, $wgDeleteRevisionsLimit, $wgLang, checkCascadingSourcesRestrictions(), checkPageRestrictions(), exists(), getNsText(), getTitleProtection(), getUserPermissionsErrorsInternal(), global, isBigDeletion(), isMovable(), and userCan().

◆ checkCascadingSourcesRestrictions()

Title::checkCascadingSourcesRestrictions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check restrictions on cascading pages.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2324 of file Title.php.

References $user, as, getCascadeProtectionSources(), isCssJsSubpage(), and list.

Referenced by checkActionPermissions().

◆ checkCSSandJSPermissions()

Title::checkCSSandJSPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check CSS/JS sub-page permissions.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2255 of file Title.php.

References $user, isCssSubpage(), and isJsSubpage().

◆ checkPageRestrictions()

Title::checkPageRestrictions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check against page_restrictions table requirements on this page.

The user must possess all required rights for this action.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2290 of file Title.php.

References $user, as, and getRestrictions().

Referenced by checkActionPermissions().

◆ checkPermissionHooks()

Title::checkPermissionHooks (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check various permission hooks.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2189 of file Title.php.

References $user, and resultToError().

◆ checkQuickPermissions()

Title::checkQuickPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Permissions checks that fail most often, and which are easiest to test.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2088 of file Title.php.

References $user, isTalkPage(), missingPermissionError(), NS_CATEGORY, NS_FILE, and NS_USER.

◆ checkReadPermissions()

Title::checkReadPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check that the user is allowed to read this page.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2493 of file Title.php.

References $name, $user, $wgWhitelistRead, $wgWhitelistReadRegexp, as, getDBkey(), getNamespace(), getPrefixedDBkey(), getPrefixedText(), SpecialPage\getTitleFor(), global, isSpecial(), isSpecialPage(), list, missingPermissionError(), NS_MAIN, and SpecialPageFactory\resolveAlias().

◆ checkSpecialsAndNSPermissions()

Title::checkSpecialsAndNSPermissions (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check permissions on special pages & namespaces.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2226 of file Title.php.

References $user, getNsText(), isNamespaceProtected(), isSpecialPage(), NS_MAIN, NS_MEDIAWIKI, and wfMessage().

◆ checkUserBlock()

Title::checkUserBlock (   $action,
  $user,
  $errors,
  $rigor,
  $short 
)
private

Check that the user isn't blocked from editing.

Parameters
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
string$rigorSame format as Title::getUserPermissionsErrors()
bool$shortShort circuit on first error
Returns
array List of errors

Definition at line 2448 of file Title.php.

References $user, $wgBlockDisablesLogin, $wgEmailConfirmToEdit, RequestContext\getMain(), and global.

◆ clearCaches()

static Title::clearCaches ( )
static

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

Definition at line 3477 of file Title.php.

References HashBagOStuff\clear().

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

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

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

References $out.

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

References $dbr, DB_REPLICA, getArticleID(), Revision\newFromTitle(), 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 1495 of file Title.php.

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

◆ deleteTitleProtection()

Title::deleteTitleProtection ( )

Remove any title protection due to page existing.

Definition at line 2767 of file Title.php.

References DB_MASTER, getDBkey(), getNamespace(), and wfGetDB().

◆ equals()

Title::equals ( Title  $title)

Compare with another title.

Parameters
Title$title
Returns
bool

Definition at line 4419 of file Title.php.

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

Referenced by getLocalURL(), and isMainPage().

◆ escapeFragmentForURL()

static Title::escapeFragmentForURL (   $fragment)
static

Escape a text fragment, say from a link, for a URL.

Deprecated:
since 1.30, use Sanitizer::escapeIdForLink() or escapeIdForExternalInterwiki()
Parameters
string$fragmentContaining a URL or link fragment (after the "#")
Returns
string Escaped string

Definition at line 778 of file Title.php.

◆ estimateRevisionCount()

Title::estimateRevisionCount ( )

Get the approximate revision count of this page.

Returns
int

Definition at line 4268 of file Title.php.

References $dbr, DB_REPLICA, exists(), getArticleID(), and wfGetDB().

◆ exists()

Title::exists (   $flags = 0)

Check if page exists.

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

Parameters
int$flagsAn optional bit field; may be Title::GAID_FOR_UPDATE to check from master/for update
Returns
bool

Definition at line 4449 of file Title.php.

References $flags, and getArticleID().

Referenced by checkActionPermissions(), estimateRevisionCount(), getRestrictionTypes(), getTitleProtectionInternal(), SpecialUpload\getUploadForm(), hasSourceText(), and isKnown().

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

References SpecialPageFactory\getLocalNameFor(), isSpecialPage(), list, NS_SPECIAL, and SpecialPageFactory\resolveAlias().

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

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

References loadRestrictions().

◆ getArticleID()

Title::getArticleID (   $flags = 0)

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

References $dbr, $options, $res, array(), as, DB_REPLICA, getArticleID(), Revision\newFromTitle(), Revision\RAW, and wfGetDB().

Referenced by countAuthorsBetween().

◆ getBacklinkCache()

Title::getBacklinkCache ( )

Get a backlink cache object.

Returns
BacklinkCache

Definition at line 4779 of file Title.php.

References BacklinkCache\get().

◆ 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'
static newFromText( $text, $defaultNamespace=NS_MAIN)
Create a new Title from text, such as what one would find in a link.
Definition Title.php:268
Returns
string Base name

Definition at line 1629 of file Title.php.

References getText().

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

References getBaseText(), and getNamespace().

◆ 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 3685 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$query
string | bool$query2
Returns
string The URL
Since
1.18

Definition at line 1983 of file Title.php.

References $query, getFragmentForURL(), getLocalURL(), PROTO_CANONICAL, 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 2894 of file Title.php.

References $dbr, $res, $tables, as, DB_REPLICA, getDBkey(), getNamespace(), NS_FILE, wfGetDB(), and wfTimestampNow().

Referenced by checkCascadingSourcesRestrictions(), and 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 4808 of file Title.php.

References getText().

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

References $urls, as, getInternalURL(), getPageLanguage(), isCssSubpage(), and isJsSubpage().

Referenced by getSquidURLs(), HTMLCacheUpdateJob\invalidateTitles(), MediaWiki\performAction(), and purgeSquid().

◆ getContentModel()

Title::getContentModel (   $flags = 0)

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

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

Definition at line 988 of file Title.php.

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

Referenced by SpecialChangeContentModel\getOptionsForTitle(), hasContentModel(), loadFromRow(), and makeTitle().

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

References $wgPageLanguageUseDB, and global.

Referenced by getPageLanguage(), and getPageViewLanguage().

◆ getDefaultMessageText()

Title::getDefaultMessageText ( )

Get the default message text or false if the message doesn't exist.

Returns
string|bool

Definition at line 4559 of file Title.php.

References $lang, $name, $wgContLang, getNamespace(), global, 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 1433 of file Title.php.

Referenced by secureAndSplit().

◆ getEarliestRevTime()

Title::getEarliestRevTime (   $flags = 0)

Get the oldest revision timestamp of this page.

Parameters
int$flagsTitle::GAID_FOR_UPDATE
Returns
string MW timestamp

Definition at line 4219 of file Title.php.

References $flags, $rev, and getFirstRevision().

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

References $html, getDBkey(), getNamespace(), 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 1997 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 2652 of file Title.php.

References $wgRestrictionTypes, and global.

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

References $flags, DB_MASTER, DB_REPLICA, getArticleID(), Revision\selectFields(), 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 1444 of file Title.php.

Referenced by getFragmentForURL(), getFullText(), getTitleValue(), and 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 1463 of file Title.php.

References getFragment(), getTransWikiID(), 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 1574 of file Title.php.

References getFragment(), 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$protoProtocol type to use in URL
Returns
string The URL

Definition at line 1767 of file Title.php.

References $query, getFragmentForURL(), getLocalURL(), and wfExpandUrl().

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

◆ getFullUrlForRedirect()

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

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

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

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

Definition at line 1802 of file Title.php.

References $query, 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$query
string | bool$query2
Returns
string The URL

Definition at line 1959 of file Title.php.

References $query, $wgInternalServer, $wgServer, getLocalURL(), global, PROTO_HTTP, 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 865 of file Title.php.

Referenced by createFragmentTarget(), equals(), getRedirectsHere(), getTitleValue(), WikiPage\insertRedirectEntry(), isSubpageOf(), and WikitextContentHandler\makeRedirectContent().

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

References $flags, article, getArticleID(), and in.

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

References $flags, article, getArticleID(), and in.

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

References $options, $res, as, DB_REPLICA, getArticleID(), WikiPage\selectFields(), 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 3562 of file Title.php.

References $options, $res, as, DB_MASTER, DB_REPLICA, getDBkey(), getNamespace(), 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 1934 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[]$queryAn 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$query2An optional secondary query array. This one MUST be an array. If a string is passed it will be interpreted as a deprecated variant argument and urlencoded into a variant= argument. This second query argument will be added to the $query The second parameter is deprecated since 1.19. Pass it as a key,value pair in the first parameter array instead.
Returns
string String of the URL.

Definition at line 1836 of file Title.php.

References $matches, $query, $wgActionPaths, $wgArticlePath, $wgContLang, $wgRequest, $wgScript, $wgServer, $wgVariantArticlePath, equals(), getDBkey(), getNsText(), getPageLanguage(), getPrefixedDBkey(), global, wfAppendQuery(), and wfUrlencode().

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

◆ getNamespace()

◆ getNamespaceKey()

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

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

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

Definition at line 4688 of file Title.php.

References $wgContLang, getNamespace(), getSubjectNsText(), and global.

◆ getNextRevisionID()

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

Get the revision ID of the next revision.

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

References $flags, and getRelativeRevisionID().

◆ getNotificationTimestamp()

Title::getNotificationTimestamp (   $user = null)

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

Parameters
User$user
Returns
string|null

Definition at line 4650 of file Title.php.

References $user, $wgUser, and global.

◆ getNsText()

Title::getNsText ( )

Get the namespace text.

Returns
string|false Namespace text

Definition at line 1036 of file Title.php.

References isExternal(), and wfDebug().

Referenced by checkActionPermissions(), checkSpecialsAndNSPermissions(), getLocalURL(), 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.

Since
1.25
Exceptions
MWExceptionIf the page doesn't have an other page
Returns
Title

Definition at line 1414 of file Title.php.

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

◆ getPageLanguage()

Title::getPageLanguage ( )

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

Defaults to $wgContLang, 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 4856 of file Title.php.

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

Referenced by getCdnUrls(), and getLocalURL().

◆ getPageViewLanguage()

Title::getPageViewLanguage ( )

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

Defaults to $wgContLang, 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 4894 of file Title.php.

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

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

References $dbr, $res, $wgContLang, as, DB_REPLICA, getArticleID(), getFullText(), global, 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 4074 of file Title.php.

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

◆ getPrefixedDBkey()

Title::getPrefixedDBkey ( )

Get the prefixed database key form.

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

Definition at line 1538 of file Title.php.

References $s, and prefix().

Referenced by checkReadPermissions(), DoubleRedirectJob\fixRedirects(), DoubleRedirectJob\getFinalDestination(), getLocalURL(), and RecentChange\newForCategorization().

◆ getPrefixedText()

Title::getPrefixedText ( )

◆ getPrefixedURL()

Title::getPrefixedURL ( )

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

Returns
string The URL-encoded form

Definition at line 1710 of file Title.php.

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

◆ getPreviousRevisionID()

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

Get the revision ID of the previous revision.

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

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

References $dbr, $res, as, DB_REPLICA, getDBkey(), getInterwiki(), getNamespace(), 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 4117 of file Title.php.

References $flags, $sort, DB_MASTER, DB_REPLICA, getArticleID(), and wfGetDB().

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

References loadRestrictions().

Referenced by checkPageRestrictions(), isProtected(), and isSemiProtected().

◆ getRestrictionTypes()

Title::getRestrictionTypes ( )

Returns restriction types for the current Title.

Returns
array Applicable restriction types

Definition at line 2670 of file Title.php.

References exists(), getNamespace(), getPrefixedText(), isSpecialPage(), NS_FILE, 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 1594 of file Title.php.

References getText().

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

References getNamespace(), and getRootText().

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

References $wgContentHandlerUseDB, $wgPageLanguageUseDB, and global.

◆ getSkinFromCssJsSubpage()

Title::getSkinFromCssJsSubpage ( )

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

Returns
string Containing skin name from .css or .js subpage title

Definition at line 1326 of file Title.php.

References in, names, and or.

◆ getSquidURLs()

Title::getSquidURLs ( )
Deprecated:
since 1.27 use getCdnUrls()

Definition at line 3749 of file Title.php.

References getCdnUrls().

◆ getSubjectNsText()

Title::getSubjectNsText ( )

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

Returns
string Namespace text

Definition at line 1061 of file Title.php.

References $wgContLang, and global.

Referenced by getNamespaceKey().

◆ getSubjectPage()

Title::getSubjectPage ( )

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

Returns
Title The object for the subject page

Definition at line 1397 of file Title.php.

References getDBkey(), and getNamespace().

Referenced by getOtherPage().

◆ getSubpage()

Title::getSubpage (   $text)

Get the title for a subpage of the current page.

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

Definition at line 1690 of file Title.php.

References getNamespace(), and 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 3256 of file Title.php.

References $dbr, $options, DB_REPLICA, getDBkey(), getNamespace(), TitleArray\newFromResult(), and wfGetDB().

Referenced by hasSubpages(), and moveSubpages().

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

Referenced by getSubpageUrlForm().

◆ getSubpageUrlForm()

Title::getSubpageUrlForm ( )

Get a URL-encoded form of the subpage text.

Returns
string URL-encoded subpage name

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

References $wgContLang, and global.

◆ getTalkPage()

Title::getTalkPage ( )

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

Returns
Title The object for the talk page

Definition at line 1370 of file Title.php.

References getDBkey(), and getNamespace().

Referenced by getOtherPage(), and getTalkPageIfDefined().

◆ getTalkPageIfDefined()

Title::getTalkPageIfDefined ( )

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

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

Definition at line 1383 of file Title.php.

References canHaveTalkPage(), and getTalkPage().

◆ getTemplateLinksFrom()

Title::getTemplateLinksFrom (   $options = [])

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

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

Parameters
array$optionsMay be FOR UPDATE
Returns
Title[] Array of Title the Title objects used here

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

References $options, and getLinksTo().

◆ getText()

◆ getTitleCache()

static Title::getTitleCache ( )
staticprivate
Returns
HashBagOStuff

Definition at line 371 of file Title.php.

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

◆ getTitleInvalidRegex()

static Title::getTitleInvalidRegex ( )
static

Returns a simple regex that will match on characters and sequences invalid in titles.

Note that this doesn't pick up many things that could be wrong with titles, but that replacing this regex with something valid will make many titles valid.

Deprecated:
since 1.25, use MediaWikiTitleCodec::getTitleInvalidRegex() instead
Returns
string Regex string

Definition at line 632 of file Title.php.

References MediaWikiTitleCodec\getTitleInvalidRegex(), and wfDeprecated().

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

References getTitleProtectionInternal().

Referenced by checkActionPermissions().

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

References $dbr, $res, DB_REPLICA, exists(), getDBkey(), getNamespace(), 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 914 of file Title.php.

References getDBkey(), getFragment(), getInterwiki(), getNamespace(), getPrefixedText(), and wfDebug().

◆ getTouched()

Title::getTouched (   $db = null)

Get the last touched timestamp.

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

Definition at line 4636 of file Title.php.

References DB_REPLICA, 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 897 of file Title.php.

References isExternal().

Referenced by getFragmentForURL().

◆ getUserCaseDBKey()

Title::getUserCaseDBKey ( )

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

Returns
string DB key

Definition at line 964 of file Title.php.

◆ getUserPermissionsErrors()

Title::getUserPermissionsErrors (   $action,
  $user,
  $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.

Definition at line 2057 of file Title.php.

References $user, as, and getUserPermissionsErrorsInternal().

◆ getUserPermissionsErrorsInternal()

Title::getUserPermissionsErrorsInternal (   $action,
  $user,
  $rigor = 'secure',
  $short = false 
)
protected

Can $user perform $action on this page? This is an internal function, with multiple levels of checks depending on performance needs; see $rigor below.

It does not check wfReadOnly().

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
bool$shortSet this to true to stop after the first permission error.
Returns
array Array of arrays of the arguments to wfMessage to explain permissions problems.

Definition at line 2591 of file Title.php.

References $user.

Referenced by checkActionPermissions(), getUserPermissionsErrors(), and userCan().

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

References getContentModel().

Referenced by isCssJsSubpage(), isCssOrJsPage(), isCssSubpage(), isJsSubpage(), and isWikitextPage().

◆ hasFragment()

Title::hasFragment ( )

Check if a Title fragment is set.

Returns
bool
Since
1.23

Implements MediaWiki\Linker\LinkTarget.

Definition at line 1454 of file Title.php.

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

◆ hasSourceText()

Title::hasSourceText ( )

Does this page have source text?

Returns
bool

Definition at line 4533 of file Title.php.

References $name, $wgContLang, exists(), global, 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 1210 of file Title.php.

References getNamespace().

◆ hasSubpages()

Title::hasSubpages ( )

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

Returns
bool

Definition at line 3228 of file Title.php.

References getSubpages().

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

References getNamespace().

Referenced by inNamespaces().

◆ 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 1182 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$purgeTime[optional] TS_MW timestamp
Returns
bool True if the update succeeded

Definition at line 4584 of file Title.php.

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

Referenced by File\purgeDescription().

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

References SpecialPageFactory\exists(), getDBkey(), hasSourceText(), isExternal(), NS_FILE, NS_MAIN, NS_MEDIA, NS_MEDIAWIKI, NS_SPECIAL, and wfFindFile().

Referenced by isKnown().

◆ isBigDeletion()

Title::isBigDeletion ( )

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

Returns
bool

Definition at line 4239 of file Title.php.

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

Referenced by checkActionPermissions().

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

References getCascadeProtectionSources(), and list.

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

References getNamespace().

◆ isConversionTable()

Title::isConversionTable ( )

Is this a conversion table for the LanguageConverter?

Returns
bool

Definition at line 1272 of file Title.php.

References getNamespace(), getText(), and NS_MEDIAWIKI.

◆ isCssJsSubpage()

Title::isCssJsSubpage ( )

Is this a .css or .js subpage of a user page?

Returns
bool
Todo:
FIXME: Rename to isUserConfigPage()

Definition at line 1315 of file Title.php.

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

Referenced by checkCascadingSourcesRestrictions().

◆ isCssOrJsPage()

Title::isCssOrJsPage ( )

Could this page contain custom CSS or JavaScript for the global UI.

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

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

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

Returns
bool
Todo:
FIXME: Rename to isSiteConfigPage() and remove deprecated hook

Definition at line 1302 of file Title.php.

References CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, hasContentModel(), and NS_MEDIAWIKI.

◆ isCssSubpage()

Title::isCssSubpage ( )

Is this a .css subpage of a user page?

Returns
bool

Definition at line 1341 of file Title.php.

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

Referenced by checkCSSandJSPermissions(), and getCdnUrls().

◆ isDeleted()

Title::isDeleted ( )

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

Returns
int The number of archived revisions

Definition at line 3283 of file Title.php.

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

◆ isDeletedQuick()

Title::isDeletedQuick ( )

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

Returns
bool

Definition at line 3308 of file Title.php.

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

Referenced by File\wasDeleted().

◆ isExternal()

◆ isJsSubpage()

Title::isJsSubpage ( )

Is this a .js subpage of a user page?

Returns
bool

Definition at line 1351 of file Title.php.

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

Referenced by checkCSSandJSPermissions(), and getCdnUrls().

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

References exists(), and isAlwaysKnown().

◆ isLocal()

Title::isLocal ( )

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

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

Definition at line 839 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 1252 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 1231 of file Title.php.

References getNamespace(), and isExternal().

Referenced by checkActionPermissions().

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

References $user, $wgNamespaceProtection, array(), as, and global.

Referenced by checkSpecialsAndNSPermissions().

◆ isNewPage()

Title::isNewPage ( )

Check if this is a new page.

Returns
bool

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

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

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

References $flags, article, getArticleID(), and in.

Referenced by CategoryViewer\addSubcategoryObject().

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

References $wgSemiprotectedRestrictionLevels, as, getRestrictions(), and global.

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

References $wgContentHandlerUseDB, DB_MASTER, getDBkey(), getNamespace(), global, pageCond(), and wfGetDB().

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

References $name, getDBkey(), isSpecialPage(), list, and SpecialPageFactory\resolveAlias().

Referenced by checkReadPermissions(), and isValidRedirectTarget().

◆ isSpecialPage()

◆ isSubpage()

Title::isSubpage ( )

Is this a subpage?

Returns
bool

Definition at line 1261 of file Title.php.

References false, and getText().

Referenced by isCssJsSubpage(), isCssSubpage(), and isJsSubpage().

◆ isSubpageOf()

Title::isSubpageOf ( Title  $title)

Check if this title is a subpage of another title.

Parameters
Title$title
Returns
bool

Definition at line 4432 of file Title.php.

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

◆ isTalkPage()

Title::isTalkPage ( )

Is this a talk page of some sort?

Returns
bool

Definition at line 1361 of file Title.php.

References getNamespace().

Referenced by checkQuickPermissions(), and getOtherPage().

◆ isTrans()

Title::isTrans ( )

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

Returns
bool True if this is transcludable

Definition at line 884 of file Title.php.

References isExternal().

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

References $parser, getDBkey(), and getNamespace().

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

References $wgUser, global, and wfMergeErrorArrays().

Referenced by moveTo(), and MovePageForm\showForm().

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

References $rev, Revision\newFromTitle(), NS_FILE, wfDebug(), and wfLocalFile().

◆ isValidRedirectTarget()

Title::isValidRedirectTarget ( )

Check if this Title is a valid redirect target.

Returns
bool

Definition at line 4755 of file Title.php.

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

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

◆ isWatchable()

Title::isWatchable ( )

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

Returns
bool

Definition at line 1113 of file Title.php.

References getNamespace(), and isExternal().

◆ isWikitextPage()

Title::isWikitextPage ( )

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

Returns
bool

Definition at line 1284 of file Title.php.

References CONTENT_MODEL_WIKITEXT, and hasContentModel().

◆ legalChars()

static Title::legalChars ( )
static

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

Returns
string The list of characters, not delimited

Definition at line 618 of file Title.php.

References $wgLegalTitleChars, and global.

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

References getContentModel(), in, and string.

◆ loadRestrictions()

Title::loadRestrictions (   $oldFashionedRestrictions = null)

Load restrictions from the page_restrictions table.

Parameters
string$oldFashionedRestrictionsComma-separated list of page restrictions from page table (pre 1.10)

Definition at line 3122 of file Title.php.

References $cache, $dbr, $rows, array(), DB_REPLICA, function, getArticleID(), getTitleProtectionInternal(), loadRestrictionsFromRows(), 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$oldFashionedRestrictionsComma-separated list of page restrictions from page table (pre 1.10)

Definition at line 3052 of file Title.php.

References $dbr, $rows, $type, as, DB_REPLICA, getArticleID(), getRestrictionTypes(), 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 750 of file Title.php.

References $name, $title, $wgContLang, and global.

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

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

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

References $t, and $title.

◆ missingPermissionError()

Title::missingPermissionError (   $action,
  $short 
)
private

Get a description array when the user doesn't have the right to perform $action (i.e.

when User::isAllowed() returns false)

Parameters
string$actionThe action to check
bool$shortShort circuit on first error
Returns
array Array containing an error message key and any parameters

Definition at line 2568 of file Title.php.

Referenced by checkQuickPermissions(), and checkReadPermissions().

◆ moveSubpages()

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

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

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

References $retval, $success, $wgMaximumMovedPages, as, StringUtils\escapeRegexReplacement(), getDBkey(), getNamespace(), getSubpages(), global, and userCan().

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

References $wgUser, global, and isValidMoveOperation().

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

References $dbr, $s, DB_REPLICA, 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 209 of file Title.php.

References $t.

◆ newFromID()

static Title::newFromID (   $id,
  $flags = 0 
)
static

Create a new Title from an article ID.

Parameters
int$idThe page_id corresponding to the Title to create
int$flagsUse Title::GAID_FOR_UPDATE to use master
Returns
Title|null The new object, or null on an error

Definition at line 411 of file Title.php.

References $flags, $title, DB_MASTER, DB_REPLICA, and wfGetDB().

◆ newFromIDs()

static Title::newFromIDs (   $ids)
static

Make an array of titles from an array of IDs.

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

Definition at line 433 of file Title.php.

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

◆ newFromLinkTarget()

◆ newFromRow()

static Title::newFromRow (   $row)
static

Make a Title object from a DB row.

Parameters
stdClass$rowObject database row (needs at least page_title,page_namespace)
Returns
Title Corresponding Title

Definition at line 459 of file Title.php.

References $t.

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

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

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

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

References $t, BagOStuff\get(), NS_MAIN, and HashBagOStuff\set().

◆ newFromTitleValue()

static Title::newFromTitleValue ( TitleValue  $titleValue)
static

Create a new Title from a TitleValue.

Parameters
TitleValue$titleValueAssumed to be safe.
Returns
Title

Definition at line 228 of file Title.php.

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

References $t.

◆ newMainPage()

static Title::newMainPage ( )
static

Create a new Title for the Main Page.

Returns
Title The new object

Definition at line 581 of file Title.php.

References $title, text, and wfMessage().

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

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

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

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

◆ purgeExpiredRestrictions()

static Title::purgeExpiredRestrictions ( )
static

Purge expired restrictions from the page_restrictions table.

This will purge no more than $wgUpdateRowsPerQuery page_restrictions rows

Definition at line 3187 of file Title.php.

References $fname, Wikimedia\Rdbms\IDatabase\addQuotes(), DB_MASTER, Wikimedia\Rdbms\IDatabase\delete(), Wikimedia\Rdbms\IDatabase\selectFieldValues(), Wikimedia\Rdbms\IDatabase\timestamp(), wfGetDB(), and wfReadOnly().

◆ purgeSquid()

Title::purgeSquid ( )

Purge all applicable CDN URLs.

Definition at line 3756 of file Title.php.

References getCdnUrls().

Referenced by File\purgeDescription().

◆ 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$userUser to check (since 1.19); $wgUser will be used if not provided.
Returns
bool

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

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

Referenced by checkPermissionHooks().

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

References getDefaultNamespace(), isExternal(), isSpecialPage(), NS_MAIN, 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 1026 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:\n private
Parameters
string$fragmentText

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

References getNamespace(), and NS_CATEGORY.

◆ userCan()

Title::userCan (   $action,
  $user = null,
  $rigor = 'secure' 
)

Can $user perform $action on this page?

Parameters
string$actionAction that permission needs to be checked for
User$userUser to check (since 1.19); $wgUser will be used if not provided.
string$rigorSame format as Title::getUserPermissionsErrors()
Returns
bool

Definition at line 2033 of file Title.php.

References $user, $wgUser, getUserPermissionsErrorsInternal(), and global.

Referenced by checkActionPermissions(), moveSubpages(), and quickUserCan().

◆ validateFileMoveOperation()

Title::validateFileMoveOperation (   $nt)
protected

Check if the requested move target is a valid file move target.

Todo:
move this to MovePage
Parameters
Title$ntTarget title
Returns
array List of errors

Definition at line 3800 of file Title.php.

References $wgUser, global, wfFindFile(), and wfLocalFile().

◆ wasLocalInterwiki()

Title::wasLocalInterwiki ( )

Was this a local interwiki link?

Returns
bool

Definition at line 874 of file Title.php.

Member Data Documentation

◆ $mArticleID

int Title::$mArticleID = -1

Article ID, fetched from the link cache on demand.

Definition at line 88 of file Title.php.

◆ $mCascadeRestriction

bool Title::$mCascadeRestriction

Cascade restrictions on this page to included templates and images?

Definition at line 115 of file Title.php.

◆ $mCascadeSources

array Title::$mCascadeSources

Where are the cascading restrictions coming from on this page?

Definition at line 127 of file Title.php.

◆ $mCascadingRestrictions

Title::$mCascadingRestrictions

Caching the results of getCascadeProtectionSources.

Definition at line 118 of file Title.php.

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

◆ $mDbkeyform

string Title::$mDbkeyform = ''

Main part with underscores.

Definition at line 70 of file Title.php.

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

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

◆ $mEstimateRevisions

int Title::$mEstimateRevisions
private

Estimated number of revisions; null of not loaded.

Definition at line 106 of file Title.php.

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

◆ $mFragment

string Title::$mFragment = ''

Title fragment (i.e.

the bit after the #)

Definition at line 85 of file Title.php.

◆ $mHasCascadingRestrictions

bool Title::$mHasCascadingRestrictions
protected

Are cascading restrictions in effect on this page?

Definition at line 124 of file Title.php.

◆ $mHasSubpages

bool Title::$mHasSubpages
private

Whether a page has any subpages.

Definition at line 155 of file Title.php.

◆ $mInterwiki

string Title::$mInterwiki = ''

Interwiki prefix.

Definition at line 79 of file Title.php.

◆ $mIsBigDeletion

bool Title::$mIsBigDeletion = null
private

Would deleting this page be a big deletion?

Definition at line 168 of file Title.php.

◆ $mLatestID

bool int Title::$mLatestID = false
protected

ID of most recent revision.

Definition at line 91 of file Title.php.

◆ $mLength

int Title::$mLength = -1
protected

The page length, 0 for special pages.

Definition at line 146 of file Title.php.

◆ $mLocalInterwiki

bool Title::$mLocalInterwiki = false
private

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

Definition at line 82 of file Title.php.

◆ $mNamespace

int Title::$mNamespace = NS_MAIN

Namespace index, i.e.

one of the NS_xxxx constants

Definition at line 76 of file Title.php.

◆ $mNotificationTimestamp

array Title::$mNotificationTimestamp = []
private

Associative array of user ID -> timestamp/false.

Definition at line 152 of file Title.php.

◆ $mOldRestrictions

string bool Title::$mOldRestrictions = false
protected

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

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

◆ $mPrefixedText

string Title::$mPrefixedText = null
protected

Text form including namespace/interwiki, initialised on demand.

Definition at line 133 of file Title.php.

◆ $mRedirect

null Title::$mRedirect = null

Is the article at this title a redirect?

Definition at line 149 of file Title.php.

◆ $mRestrictions

array Title::$mRestrictions = []

Array of groups allowed to edit this article.

Definition at line 109 of file Title.php.

◆ $mRestrictionsExpiry

array Title::$mRestrictionsExpiry = []
protected

When do the restrictions on this page expire?

Definition at line 121 of file Title.php.

◆ $mRestrictionsLoaded

bool Title::$mRestrictionsLoaded = false

Boolean for initialisation on demand.

Definition at line 130 of file Title.php.

◆ $mTextform

string Title::$mTextform = ''

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

Definition at line 64 of file Title.php.

◆ $mTitleProtection

mixed Title::$mTitleProtection

Cached value for getTitleProtection (create protection)

Definition at line 136 of file Title.php.

◆ $mTitleValue

TitleValue Title::$mTitleValue = null
private

A corresponding TitleValue object.

Definition at line 165 of file Title.php.

◆ $mUrlform

string Title::$mUrlform = ''

URL-encoded form of the main part.

Definition at line 67 of file Title.php.

◆ $mUserCaseDBKey

string Title::$mUserCaseDBKey
protected

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

Definition at line 73 of file Title.php.

◆ $titleCache

HashBagOStuff Title::$titleCache = null
staticprivate

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

◆ GAID_FOR_UPDATE

const Title::GAID_FOR_UPDATE = 1

Used to be GAID_FOR_UPDATE define.

Used with getArticleID() and friends to use the master DB

Definition at line 54 of file Title.php.


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