MediaWiki  REL1_24
Title Class Reference

Represents a title within MediaWiki. More...

Collaboration diagram for Title:

List of all members.

Public Member Functions

 __construct ()
 __toString ()
 Return a string representation of this title.
 areCascadeProtectionSourcesLoaded ($getPages=true)
 Determines whether cascading protection sources have already been loaded from the database.
 areRestrictionsCascading ()
 Returns cascading restrictions for the current article.
 areRestrictionsLoaded ()
 Accessor for mRestrictionsLoaded.
 canExist ()
 Is this in a namespace that allows actual pages?
 canTalk ()
 Could this title have a corresponding talk page?
 canUseNoindex ()
 Whether the magic words __INDEX__ and __NOINDEX__ function for this page.
 countAuthorsBetween ($old, $new, $limit, $options=array())
 Get the number of authors between the given revisions or revision IDs.
 countRevisionsBetween ($old, $new, $max=null)
 Get the number of revisions between the given revision.
 deleteTitleProtection ()
 Remove any title protection due to page existing.
 equals (Title $title)
 Compare with another title.
 estimateRevisionCount ()
 Get the approximate revision count of this page.
 exists ()
 Check if page exists.
 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.
 flushRestrictions ()
 Flush the protection cache in this object and force reload from the database.
 getAllRestrictions ()
 Accessor/initialisation for mRestrictions.
 getArticleID ($flags=0)
 Get the article ID for this Title from the link cache, adding it if necessary.
 getAuthorsBetween ($old, $new, $limit, $options=array())
 Get the authors between the given revisions or revision IDs.
 getBacklinkCache ()
 Get a backlink cache object.
 getBaseText ()
 Get the base page name without a namespace, i.e.
 getBaseTitle ()
 Get the base page name title, i.e.
 getBrokenLinksFrom ()
 Get an array of Title objects referring to non-existent articles linked from this page.
 getCanonicalURL ($query= '', $query2=false)
 Get the URL for a canonical link, for use in things like IRC and e-mail notifications.
 getCascadeProtectionSources ($getPages=true)
 Cascading protection: Get the source of any cascading restrictions on this page.
 getCategorySortkey ($prefix= '')
 Returns the raw sort key to be used for categories, with the specified prefix.
 getContentModel ($flags=0)
 Get the page's content model id, see the CONTENT_MODEL_XXX constants.
 getDBkey ()
 Get the main part with underscores.
 getDefaultMessageText ()
 Get the default message text or false if the message doesn't exist.
 getDefaultNamespace ()
 Get the default namespace index, for when there is no namespace.
 getEarliestRevTime ($flags=0)
 Get the oldest revision timestamp of this page.
 getEditNotices ($oldid=0)
 Get a list of rendered edit notices for this page.
 getEditURL ()
 Get the edit URL for this Title.
 getFirstRevision ($flags=0)
 Get the first revision of the page.
 getFragment ()
 Get the Title fragment (i.e. the bit after the #) in text form.
 getFragmentForURL ()
 Get the fragment in URL form, including the "#" character if there is one.
 getFullText ()
 Get the prefixed title with spaces, plus any fragment (part beginning with '#')
 getFullURL ($query= '', $query2=false, $proto=PROTO_RELATIVE)
 Get a real URL referring to this title, with interwiki link and fragment.
 getInternalURL ($query= '', $query2=false)
 Get the URL form for an internal link.
 getInterwiki ()
 Get the interwiki prefix.
 getLatestRevID ($flags=0)
 What is the page_latest field for this page?
 getLength ($flags=0)
 What is the length of this page? Uses link cache, adding it if necessary.
 getLinksFrom ($options=array(), $table= 'pagelinks', $prefix= 'pl')
 Get an array of Title objects linked from this Title Also stores the IDs in the link cache.
 getLinksTo ($options=array(), $table= 'pagelinks', $prefix= 'pl')
 Get an array of Title objects linking to this Title Also stores the IDs in the link cache.
 getLinkURL ($query= '', $query2=false, $proto=PROTO_RELATIVE)
 Get a URL that's the simplest URL that will be valid to link, locally, to the current Title.
 getLocalURL ($query= '', $query2=false)
 Get a URL with no fragment or server name (relative URL) from a Title object.
 getNamespace ()
 Get the namespace index, i.e.
 getNamespaceKey ($prepend= 'nstab-')
 Generate strings used for xml 'id' names in monobook tabs.
 getNextRevisionID ($revId, $flags=0)
 Get the revision ID of the next revision.
 getNotificationTimestamp ($user=null)
 Get the timestamp when this page was updated since the user last saw it.
 getNsText ()
 Get the namespace text.
 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.
 getParentCategories ()
 Get categories to which this Title belongs and return an array of categories' names.
 getParentCategoryTree ($children=array())
 Get a tree of parent categories.
 getPartialURL ()
 Get the URL-encoded form of the main part.
 getPrefixedDBkey ()
 Get the prefixed database key form.
 getPrefixedText ()
 Get the prefixed title with spaces.
 getPrefixedURL ()
 Get a URL-encoded title (not an actual URL) including interwiki.
 getPreviousRevisionID ($revId, $flags=0)
 Get the revision ID of the previous revision.
 getRedirectsHere ($ns=null)
 Get all extant redirects to this Title.
 getRestrictionExpiry ($action)
 Get the expiry time for the restriction against a given action.
 getRestrictions ($action)
 Accessor/initialisation for mRestrictions.
 getRestrictionTypes ()
 Returns restriction types for the current Title.
 getRootText ()
 Get the root page name text without a namespace, i.e.
 getRootTitle ()
 Get the root page name title, i.e.
 getSkinFromCssJsSubpage ()
 Trim down a .css or .js subpage title to get the corresponding skin name.
 getSquidURLs ()
 Get a list of URLs to purge from the Squid cache when this page changes.
 getSubjectNsText ()
 Get the namespace text of the subject (rather than talk) page.
 getSubjectPage ()
 Get a title object associated with the subject page of this talk page.
 getSubpage ($text)
 Get the title for a subpage of the current page.
 getSubpages ($limit=-1)
 Get all subpages of this page.
 getSubpageText ()
 Get the lowest-level subpage name, i.e.
 getSubpageUrlForm ()
 Get a URL-encoded form of the subpage text.
 getTalkNsText ()
 Get the namespace text of the talk page.
 getTalkPage ()
 Get a Title object associated with the talk page of this article.
 getTemplateLinksFrom ($options=array())
 Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache.
 getTemplateLinksTo ($options=array())
 Get an array of Title objects using this Title as a template Also stores the IDs in the link cache.
 getText ()
 Get the text form (spaces not underscores) of the main part.
 getTitleValue ()
 Get a TitleValue object representing this Title.
 getTouched ($db=null)
 Get the last touched timestamp.
 getTransWikiID ()
 Returns the DB name of the distant wiki which owns the object.
 getUserCaseDBKey ()
 Get the DB key with the initial letter case as specified by the user.
 getUserPermissionsErrors ($action, $user, $doExpensiveQueries=true, $ignoreErrors=array())
 Can $user perform $action on this page?
 hasContentModel ($id)
 Convenience method for checking a title's content model name.
 hasFragment ()
 Check if a Title fragment is set.
 hasSourceText ()
 Does this page have source text?
 hasSubjectNamespace ($ns)
 Returns true if the title has the same subject namespace as the namespace specified.
 hasSubpages ()
 Does this have subpages? (Warning, usually requires an extra DB query.)
 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.
 invalidateCache ()
 Updates page_touched for this page; called from LinksUpdate.php.
 isAlwaysKnown ()
 Should links to this title be shown as potentially viewable (i.e.
 isBigDeletion ()
 Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
 isCascadeProtected ()
 Cascading protection: Return true if cascading restrictions apply to this page, false if not.
 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?
 isConversionTable ()
 Is this a conversion table for the LanguageConverter?
 isCssJsSubpage ()
 Is this a .css or .js subpage of a user page?
 isCssOrJsPage ()
 Could this page contain custom CSS or JavaScript for the global UI.
 isCssSubpage ()
 Is this a .css subpage of a user 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?
 isExternal ()
 Is this Title interwiki?
 isJsSubpage ()
 Is this a .js subpage of a user page?
 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).
 isLocal ()
 Determine whether the object refers to a page within this project.
 isMainPage ()
 Is this the mainpage?
 isMovable ()
 Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable.
 isNamespaceProtected (User $user)
 Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection.
 isNewPage ()
 Check if this is a new page.
 isProtected ($action= '')
 Does the title correspond to a protected article?
 isRedirect ($flags=0)
 Is this an article that is a redirect page? Uses link cache, adding it if necessary.
 isSemiProtected ($action= 'edit')
 Is this page "semi-protected" - the *only* protection levels are listed in $wgSemiprotectedRestrictionLevels?
 isSingleRevRedirect ()
 Checks if this page is just a one-rev redirect.
 isSpecial ($name)
 Returns true if this title resolves to the named special page.
 isSpecialPage ()
 Returns true if this is a special page.
 isSubpage ()
 Is this a subpage?
 isSubpageOf (Title $title)
 Check if this title is a subpage of another title.
 isTalkPage ()
 Is this a talk page of some sort?
 isTrans ()
 Determine whether the object refers to a page within this project and is transcludable.
 isValidMoveOperation (&$nt, $auth=true, $reason= '')
 Check whether a given move operation would be valid.
 isValidMoveTarget ($nt)
 Checks if $this can be moved to a given Title.
 isValidRedirectTarget ()
 Check if this Title is a valid redirect target.
 isWatchable ()
 Can this title be added to a user's watchlist?
 isWikitextPage ()
 Does that page contain wikitext, or it is JS, CSS or whatever?
 loadFromRow ($row)
 Load Title object fields from a DB row.
 loadRestrictions ($oldFashionedRestrictions=null)
 Load restrictions from the page_restrictions table.
 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.
 moveNoAuth (&$nt)
 Move this page without authentication.
 moveSubpages ($nt, $auth=true, $reason= '', $createRedirect=true)
 Move this page's subpages to be subpages of $nt.
 moveTo (&$nt, $auth=true, $reason= '', $createRedirect=true)
 Move a title to a new location.
 pageCond ()
 Get an associative array for selecting this title from the "page" table.
 purgeSquid ()
 Purge all applicable Squid URLs.
 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.
 resetArticleID ($newid)
 This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache.
 setFragment ($fragment)
 Set the fragment for this title.
 touchLinks ()
 Update page_touched timestamps and send squid purge messages for pages linking to this title.
 userCan ($action, $user=null, $doExpensiveQueries=true)
 Can $user perform $action on this page?
 userIsWatching ()
 Is $wgUser watching this page?
 wasLocalInterwiki ()
 Was this a local interwiki link?

Static Public Member Functions

static capitalize ($text, $ns=NS_MAIN)
 Capitalize a text string for a title if it belongs to a namespace that capitalizes.
static compare ($a, $b)
 Callback for usort() to do title sorts by (namespace, title)
static convertByteClassToUnicodeClass ($byteClass)
 Utility method for converting a character sequence from bytes to Unicode.
static escapeFragmentForURL ($fragment)
 Escape a text fragment, say from a link, for a URL.
static getFilteredRestrictionTypes ($exists=true)
 Get a filtered list of all restriction types supported by this wiki.
static getTitleInvalidRegex ()
 Returns a simple regex that will match on characters and sequences invalid in titles.
static legalChars ()
 Get a regex character class describing the legal characters in a link.
static makeName ($ns, $title, $fragment= '', $interwiki= '')
 Make a prefixed DB key from a DB key and a namespace index.
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 nameOf ($id)
 Get the prefixed DB key associated with an ID.
static newFromDBkey ($key)
 Create a new Title from a prefixed DB key.
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 newFromRedirect ($text)
 Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will only return the very next target, useful for the redirect table and other checks that don't need full recursion.
static newFromRedirectArray ($text)
 Extract a redirect destination from a string and return an array of Titles, or null if the text doesn't contain a valid redirect The last element in the array is the final destination after all redirects have been resolved (up to $wgMaxRedirects times)
static newFromRedirectRecurse ($text)
 Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will recurse down $wgMaxRedirects times or until a non-redirect target is hit in order to provide (hopefully) the Title of the final destination instead of another redirect.
static newFromRow ($row)
 Make a Title object from a DB row.
static newFromText ($text, $defaultNamespace=NS_MAIN)
 Create a new Title from text, such as what one would find in a link.
static newFromTitleValue (TitleValue $titleValue)
 Create a new Title from a TitleValue.
static newFromURL ($url)
 THIS IS NOT THE FUNCTION YOU WANT.
static newMainPage ()
 Create a new Title for the Main Page.
static purgeExpiredRestrictions ()
 Purge expired restrictions from the page_restrictions table.

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.

Protected Member Functions

 getUserPermissionsErrorsInternal ($action, $user, $doExpensiveQueries=true, $short=false)
 Can $user perform $action on this page? This is an internal function, which checks ONLY that previously checked by userCan (i.e.
 validateFileMoveOperation ($nt)
 Check if the requested move target is a valid file move target.

Static Protected Member Functions

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

Private Member Functions

 checkActionPermissions ($action, $user, $errors, $doExpensiveQueries, $short)
 Check action permissions not already checked in checkQuickPermissions.
 checkCascadingSourcesRestrictions ($action, $user, $errors, $doExpensiveQueries, $short)
 Check restrictions on cascading pages.
 checkCSSandJSPermissions ($action, $user, $errors, $doExpensiveQueries, $short)
 Check CSS/JS sub-page permissions.
 checkPageRestrictions ($action, $user, $errors, $doExpensiveQueries, $short)
 Check against page_restrictions table requirements on this page.
 checkPermissionHooks ($action, $user, $errors, $doExpensiveQueries, $short)
 Check various permission hooks.
 checkQuickPermissions ($action, $user, $errors, $doExpensiveQueries, $short)
 Permissions checks that fail most often, and which are easiest to test.
 checkReadPermissions ($action, $user, $errors, $doExpensiveQueries, $short)
 Check that the user is allowed to read this page.
 checkSpecialsAndNSPermissions ($action, $user, $errors, $doExpensiveQueries, $short)
 Check permissions on special pages & namespaces.
 checkUserBlock ($action, $user, $errors, $doExpensiveQueries, $short)
 Check that the user isn't blocked from editing.
 getTitleProtection ()
 Is this title subject to title protection? Title protection is the one applied against creation of such title.
 loadRestrictionsFromResultWrapper ($res, $oldFashionedRestrictions=null)
 Loads a string into mRestrictions array.
 missingPermissionError ($action, $short)
 Get a description array when the user doesn't have the right to perform $action (i.e.
 prefix ($name)
 Prefix some arbitrary text with the namespace or interwiki prefix of this object.
 resultToError ($errors, $result)
 Add the resulting error code to the errors array.
 secureAndSplit ()
 Secure and split - main initialisation function for this object.

Static Private Member Functions

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

Static Private Attributes

static $titleCache = null

Private member variables

Please use the accessor functions instead.

Access:
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 *.
bool string $mContentModel = false
 ID of the page's content model, i.e.
array $mRestrictions = array()
 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 *.
bool $mOldRestrictions = false
 *
array $mRestrictionsExpiry = array()
 When do the restrictions on this page expire? *.
bool $mHasCascadingRestrictions
 Are cascading restrictions in effect on this page? *.
 $mPrefixedText = null
 Text form (spaces not underscores) of the main part *.
bool $mWatched = null
 Is $wgUser watching this page? null if unfilled, accessed through userIsWatching()
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? *.
int $mEstimateRevisions
 Estimated number of revisions; null of not loaded *.
 $mNotificationTimestamp = array()
 Text form (spaces not underscores) of the main part *.
bool $mHasSubpages
 Whether a page has any subpages *.
bool $mPageLanguage = false
 The (string) language code of the page's language and content code.
string $mDbPageLanguage = null
 The page language code from the database *.
TitleValue $mTitleValue = null
 A corresponding TitleValue object *.
bool $mIsBigDeletion = null
 Would deleting this page be a big deletion? *.

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


Constructor & Destructor Documentation

Definition at line 187 of file Title.php.


Member Function Documentation

Return a string representation of this title.

Returns:
string Representation of this title

Definition at line 1407 of file Title.php.

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

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

Returns cascading restrictions for the current article.

Returns:
bool

Definition at line 2815 of file Title.php.

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

Is this in a namespace that allows actual pages?

Returns:
bool

Definition at line 1011 of file Title.php.

Could this title have a corresponding talk page?

Returns:
bool

Definition at line 1001 of file Title.php.

Whether the magic words __INDEX__ and __NOINDEX__ function for this page.

Returns:
bool

Definition at line 4636 of file Title.php.

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

Referenced by UploadBase\checkWarnings(), and WithoutInterwikiPage\execute().

Title::checkActionPermissions ( action,
user,
errors,
doExpensiveQueries,
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
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2190 of file Title.php.

Title::checkCascadingSourcesRestrictions ( action,
user,
errors,
doExpensiveQueries,
short 
) [private]

Check restrictions on cascading pages.

Parameters:
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2141 of file Title.php.

Title::checkCSSandJSPermissions ( action,
user,
errors,
doExpensiveQueries,
short 
) [private]

Check CSS/JS sub-page permissions.

Parameters:
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2071 of file Title.php.

References $user, array(), getNsText(), isNamespaceProtected(), and wfMessage().

Title::checkPageRestrictions ( action,
user,
errors,
doExpensiveQueries,
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
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2107 of file Title.php.

Title::checkPermissionHooks ( action,
user,
errors,
doExpensiveQueries,
short 
) [private]

Check various permission hooks.

Parameters:
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2007 of file Title.php.

Title::checkQuickPermissions ( action,
user,
errors,
doExpensiveQueries,
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
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 1907 of file Title.php.

Title::checkReadPermissions ( action,
user,
errors,
doExpensiveQueries,
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
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2302 of file Title.php.

References array().

Title::checkSpecialsAndNSPermissions ( action,
user,
errors,
doExpensiveQueries,
short 
) [private]

Check permissions on special pages & namespaces.

Parameters:
string$actionThe action to check
User$userUser to check
array$errorsList of current errors
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2040 of file Title.php.

Title::checkUserBlock ( action,
user,
errors,
doExpensiveQueries,
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
bool$doExpensiveQueriesWhether or not to perform expensive queries
bool$shortShort circuit on first error
Returns:
array List of errors

Definition at line 2267 of file Title.php.

static Title::compare ( a,
b 
) [static]

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

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

Definition at line 759 of file Title.php.

Referenced by ApiQueryInfo\execute().

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

References is, legalChars(), and URL.

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

Title::countAuthorsBetween ( old,
new,
limit,
options = array() 
)

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

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

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

Remove any title protection due to page existing.

Definition at line 2538 of file Title.php.

References $dbr, $res, array(), exists(), getDBkey(), getNamespace(), and wfGetDB().

Title::equals ( Title title)

Compare with another title.

Parameters:
Title$title
Returns:
bool

Definition at line 4278 of file Title.php.

static Title::escapeFragmentForURL ( fragment) [static]

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

Parameters:
string$fragmentContaining a URL or link fragment (after the "#")
Returns:
string Escaped string

Definition at line 743 of file Title.php.

Referenced by prefix().

Get the approximate revision count of this page.

Returns:
int

Definition at line 4128 of file Title.php.

References $dbr, array(), getArticleID(), and wfGetDB().

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.

Returns:
bool

Definition at line 4306 of file Title.php.

Referenced by countRevisionsBetween(), deleteTitleProtection(), and validateFileMoveOperation().

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

static Title::fixUrlQueryArgs ( query,
query2 = false 
) [static, private]

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
bool$query2
Returns:
string

Definition at line 1572 of file Title.php.

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

Accessor/initialisation for mRestrictions.

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

Definition at line 2789 of file Title.php.

Title::getArticleID ( flags = 0)

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

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

Definition at line 3114 of file Title.php.

Referenced by ParserOutput\addLink(), countRevisionsBetween(), estimateRevisionCount(), getEarliestRevTime(), and InfoAction\pageCounts().

Title::getAuthorsBetween ( old,
new,
limit,
options = array() 
)

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

References $conds, $dbr, $res, and array().

Get a backlink cache object.

Returns:
BacklinkCache

Definition at line 4627 of file Title.php.

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

the part before the subpage name

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

Definition at line 1472 of file Title.php.

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

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

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.
Returns:
string The URL
Since:
1.18

Definition at line 1788 of file Title.php.

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

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

Title::getContentModel ( flags = 0)

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

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

Definition at line 921 of file Title.php.

Referenced by ContentHandler\getForTitle().

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

Returns:
string|bool

Definition at line 4416 of file Title.php.

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

Returns:
int Default namespace index

Definition at line 1305 of file Title.php.

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

References $flags, and getArticleID().

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

References $wgLang, and Language\factory().

Get the edit URL for this Title.

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

Definition at line 1800 of file Title.php.

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

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

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

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

Definition at line 1316 of file Title.php.

Referenced by getPartialURL(), Linker\normaliseSpecialPage(), and prefix().

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

Returns:
string Fragment in URL form

Definition at line 1334 of file Title.php.

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

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

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:
array | string$query
bool$query2
string$protoProtocol type to use in URL
Returns:
string The URL

Definition at line 1610 of file Title.php.

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

Referenced by SpecialPageFactory\executePath(), and FeedUtils\getDiffLink().

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

Get the URL form for an internal link.

  • Used in various Squid-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.
Returns:
string The URL

Definition at line 1768 of file Title.php.

Get the interwiki prefix.

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

Returns:
string Interwiki prefix

Definition at line 799 of file Title.php.

Referenced by WikitextContentHandler\makeRedirectContent().

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

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

Title::getLinksFrom ( options = array(),
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$optionsMay be FOR UPDATE
string$tableTable name
string$prefixFields prefix
Returns:
array Array of Title objects linking here

Definition at line 3392 of file Title.php.

Title::getLinksTo ( options = array(),
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 3334 of file Title.php.

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

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:
array$query
bool$query2
string$protoProtocol to use; setting this will cause a full URL to be used
See also:
self::getLocalURL for the arguments.
Returns:
string The URL

Definition at line 1743 of file Title.php.

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

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

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

See also:
self::getFullURL to always get an absolute URL.
self::getLinkURL to always get a URL that's the simplest URL that will be valid to link, locally, to the current Title.
self::newFromText to produce a Title object.
Parameters:
string | array$queryAn optional query string, not used for interwiki links. Can be specified as an associative array as well, e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped). Some query patterns will trigger various shorturl path replacements.
array$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 1651 of file Title.php.

Referenced by Linker\makeThumbLink2().

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

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

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

Get the namespace text.

Returns:
string Namespace text

Definition at line 954 of file Title.php.

Referenced by checkCSSandJSPermissions().

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

Referenced by WikitextContent\fillParserOutput().

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

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

Title::getParentCategoryTree ( children = array())

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

Get the URL-encoded form of the main part.

Returns:
string Main part of the title, URL-encoded

Definition at line 878 of file Title.php.

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

Get the prefixed database key form.

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

Definition at line 1381 of file Title.php.

Referenced by Linker\getRevDeleteLink(), WatchAction\getWatchToken(), and Linker\makeImageLink().

Get the prefixed title with spaces.

This is the form usually used for display

Returns:
string The prefixed title, with spaces

Definition at line 1393 of file Title.php.

Referenced by Linker\buildRollbackLink(), getPartialURL(), InfoAction\invalidateCache(), Linker\makeBrokenImageLinkObj(), StringPrefixSearch\titles(), and ApiWatch\watchTitle().

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

Returns:
string The URL-encoded form

Definition at line 1553 of file Title.php.

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

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

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

References loadRestrictions().

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.

Definition at line 2773 of file Title.php.

Returns restriction types for the current Title.

Returns:
array Applicable restriction types

Definition at line 2482 of file Title.php.

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

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

static Title::getSelectFields ( ) [static, protected]

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

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

References array(), hasContentModel(), and wfRunHooks().

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

Returns:
string[] Array of String the URLs

Definition at line 3512 of file Title.php.

Referenced by isValidMoveOperation().

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

Returns:
string Namespace text

Definition at line 981 of file Title.php.

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

Returns:
Title The object for the subject page

Definition at line 1291 of file Title.php.

References hasContentModel(), and isSubpage().

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

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

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

Get a URL-encoded form of the subpage text.

Returns:
string URL-encoded subpage name

Definition at line 1542 of file Title.php.

Get the namespace text of the talk page.

Returns:
string Namespace text

Definition at line 991 of file Title.php.

References MWNamespace\getCanonicalName().

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

Returns:
Title The object for the talk page

Definition at line 1281 of file Title.php.

References hasContentModel(), and isSubpage().

Title::getTemplateLinksFrom ( options = array())

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

Title::getTemplateLinksTo ( options = array())

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$optionsMay be FOR UPDATE
Returns:
Title[] Array of Title the Title objects linking here

Definition at line 3376 of file Title.php.

Get the text form (spaces not underscores) of the main part.

Returns:
string Main part of the title

Definition at line 869 of file Title.php.

Referenced by ContentHandler\getDefaultModelFor(), isCssOrJsPage(), isWikitextPage(), and Linker\makeMediaLinkFile().

static Title::getTitleCache ( ) [static, private]
Returns:
MapCacheLRU

Definition at line 307 of file Title.php.

static Title::getTitleFormatter ( ) [static, private]

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

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.

Todo:
move this into MediaWikiTitleCodec
Returns:
string Regex string

Definition at line 592 of file Title.php.

static Title::getTitleParser ( ) [static, private]

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:
TitleParser

Definition at line 145 of file Title.php.

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

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

Title::getTouched ( db = null)

Get the last touched timestamp.

Parameters:
DatabaseBase$dbOptional db
Returns:
string Last-touched timestamp

Definition at line 4485 of file Title.php.

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

Returns:
string The DB name

Definition at line 831 of file Title.php.

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

Returns:
string DB key

Definition at line 896 of file Title.php.

Title::getUserPermissionsErrors ( action,
user,
doExpensiveQueries = true,
ignoreErrors = array() 
)

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
bool$doExpensiveQueriesSet this to false to avoid doing unnecessary queries by skipping checks for cascading protections and user blocks.
array$ignoreErrorsArray of Strings Set this to a list of message keys whose corresponding errors may be ignored.
Returns:
array Array of arguments to wfMessage to explain permissions problems.

Definition at line 1879 of file Title.php.

Title::getUserPermissionsErrorsInternal ( action,
user,
doExpensiveQueries = true,
short = false 
) [protected]

Can $user perform $action on this page? This is an internal function, which checks ONLY that previously checked by userCan (i.e.

it leaves out checks on wfReadOnly() and blocks)

Parameters:
string$actionAction that permission needs to be checked for
User$userUser to check
bool$doExpensiveQueriesSet this to false to avoid doing unnecessary queries.
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 2409 of file Title.php.

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

Referenced by getSkinFromCssJsSubpage(), getSubjectPage(), and getTalkPage().

Check if a Title fragment is set.

Returns:
bool
Since:
1.23

Definition at line 1326 of file Title.php.

Referenced by prefix().

Does this page have source text?

Returns:
bool

Definition at line 4390 of file Title.php.

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

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

Returns:
bool

Definition at line 3007 of file Title.php.

Referenced by isWikitextPage().

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

Definition at line 1078 of file Title.php.

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

Parameters:
int$namespaces,...The namespaces to check for
Returns:
bool
Since:
1.19

Definition at line 1089 of file Title.php.

References makeTitle().

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

Returns:
bool True if the update succeeded

Definition at line 4440 of file Title.php.

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

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

Returns:
bool

Definition at line 4092 of file Title.php.

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

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

Is this a conversion table for the LanguageConverter?

Returns:
bool

Definition at line 1179 of file Title.php.

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

Returns:
bool

Definition at line 1226 of file Title.php.

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

Definition at line 1208 of file Title.php.

References getNamespace(), and getText().

Is this a .css subpage of a user page?

Returns:
bool

Definition at line 1252 of file Title.php.

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

Returns:
int The number of archived revisions

Definition at line 3063 of file Title.php.

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

Returns:
bool

Definition at line 3088 of file Title.php.

Is this Title interwiki?

Returns:
bool

Definition at line 788 of file Title.php.

Referenced by ParserOutput\addLink().

Is this a .js subpage of a user page?

Returns:
bool

Definition at line 1262 of file Title.php.

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

Referenced by WantedQueryPage\existenceCheck().

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

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

Definition at line 773 of file Title.php.

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

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

Returns:
bool

Definition at line 1138 of file Title.php.

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

Referenced by checkCSSandJSPermissions().

Check if this is a new page.

Returns:
bool

Definition at line 4082 of file Title.php.

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

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

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

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

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

Returns true if this is a special page.

Returns:
bool

Definition at line 1029 of file Title.php.

Referenced by Linker\normaliseSpecialPage().

Is this a subpage?

Returns:
bool

Definition at line 1168 of file Title.php.

Referenced by getSubjectPage(), and getTalkPage().

Title::isSubpageOf ( Title title)

Check if this title is a subpage of another title.

Parameters:
Title$title
Returns:
bool

Definition at line 4291 of file Title.php.

Is this a talk page of some sort?

Returns:
bool

Definition at line 1272 of file Title.php.

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

Returns:
bool True if this is transcludable

Definition at line 818 of file Title.php.

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

Todo:
move this into MovePage
Parameters:
Title$ntThe new title
bool$authIndicates whether $wgUser's permissions should be checked
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 3570 of file Title.php.

References $urls, and getSquidURLs().

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

  • Selects for update, so don't call it unless you mean business
Parameters:
Title$ntThe new title to check
Returns:
bool

Definition at line 3876 of file Title.php.

Referenced by validateFileMoveOperation().

Check if this Title is a valid redirect target.

Returns:
bool

Definition at line 4605 of file Title.php.

Referenced by WikitextContent\getRedirectTargetAndText().

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

Returns:
bool

Definition at line 1020 of file Title.php.

References $wgContLang, MWNamespace\getTalk(), and global.

Referenced by ApiWatch\watchTitle().

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

Returns:
bool

Definition at line 1191 of file Title.php.

References getText(), and hasSubpages().

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

References $dbr, $s, array(), and wfGetDB().

Referenced by ImageCleanup\buildSafeTitle(), convertByteClassToUnicodeClass(), ResourceLoaderStartUpModule\getConfigSettings(), TitleTest\testLegalChars(), and wfStripIllegalFilenameChars().

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

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

Referenced by getRestrictionExpiry().

Title::loadRestrictionsFromResultWrapper ( res,
oldFashionedRestrictions = null 
) [private]

Loads a string into mRestrictions array.

Parameters:
ResultWrapper$resResource restrictions as an SQL result.
string$oldFashionedRestrictionsComma-separated list of page restrictions from page table (pre 1.10)

Definition at line 2830 of file Title.php.

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

static Title::makeName ( ns,
title,
fragment = '',
interwiki = '' 
) [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
Returns:
string The prefixed form of the title

Definition at line 723 of file Title.php.

Referenced by TitleCleanup\processRow().

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 *valid*, for instance when they came directly from the database or a special page name. For convenience, spaces are converted to underscores so that eg user_text fields can be used directly.

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

Referenced by FakeDimensionFile\__construct(), LinkBatch\addResultToCache(), ChangesFeed\buildItems(), Orphans\checkSeparation(), CompressOld\compressWithConcat(), SpecialTags\doTagRow(), CheckBadRedirects\execute(), ApiQueryDeletedrevs\execute(), DeleteDefaultMessages\execute(), ApiQueryFilearchive\execute(), DumpSisterSites\execute(), AttachLatest\execute(), FixDoubleRedirects\execute(), DumpLinks\execute(), PurgeChangedPages\execute(), NukeNS\execute(), DeleteEqualMessages\execute(), ApiQueryRandom\extractRowInfo(), ApiQueryWatchlist\extractRowInfo(), ApiQueryContributions\extractRowInfo(), ApiQueryLogEvents\extractRowInfo(), ApiQueryRecentChanges\extractRowInfo(), ApiFeedContributions\feedItem(), SpecialNewpages\feedItem(), SpecialRecentChanges\filterByCategories(), FeedUtils\formatDiff(), UncategorizedCategoriesPage\formatResult(), UnusedCategoriesPage\formatResult(), AncientPagesPage\formatResult(), UnusedtemplatesPage\formatResult(), WantedCategoriesPage\formatResult(), ListDuplicatedFilesPage\formatResult(), BrokenRedirectsPage\formatResult(), ListredirectsPage\formatResult(), DoubleRedirectsPage\formatResult(), MIMEsearchPage\formatResult(), NewFilesPager\formatRow(), ImageListPager\formatValue(), RevDelLogItem\getHTML(), SpecialExport\getLinks(), ActionTest\getPage(), NewUsersLogFormatter\getPreloadTitles(), ApiQueryInfo\getProtectionInfo(), SpecialRandomInCategory\getRandomTitle(), SpecialMypage\getRedirect(), SpecialMytalk\getRedirect(), ListredirectsPage\getRedirectTarget(), RollbackEdits\getRollbackTitles(), SpecialPageTest\getTitleForWithWarningProvider(), ResourceLoaderWikiModule\getTitleInfo(), UserRightsProxy\getUserPage(), inNamespaces(), ForeignDBFile\newFromRow(), PageORMTableForTesting\newRow(), SqlSearchResultSet\next(), SpecialBlock\postText(), WatchlistCleanup\processRow(), CapsCleanup\processRow(), SpecialUnblock\processUnblock(), WikitextContentHandlerTest\provideMakeRedirectContent(), GlobalWithDBTest\provideWfIsBadImageList(), PurgeList\purgeNamespace(), ApiQueryLangBacklinks\run(), ApiQueryImages\run(), ApiQueryProtectedTitles\run(), ApiQueryIWBacklinks\run(), ApiQueryWatchlistRaw\run(), ApiQueryExtLinksUsage\run(), ApiQueryCategories\run(), ApiQueryAllCategories\run(), ApiQueryCategoryMembers\run(), ApiQueryPagesWithProp\run(), ApiQueryQueryPage\run(), ApiQueryAllPages\run(), ApiQueryAllImages\run(), ApiQueryLinks\run(), ApiQueryBacklinksprop\run(), ApiQueryAllLinks\run(), ApiQueryRecentChanges\run(), SpecialMIMESearchTest\setUp(), ArticleTest\setUp(), SpecialPrefixindex\showPrefixChunk(), SpecialPageTest\testGetTitleFor(), SpecialPageTest\testInvalidGetTitleFor(), TitleTest\testIsAlwaysKnownOnInterwiki(), RefreshLinksPartitionTest\testRefreshLinks(), LinksUpdateTest\testUpdate_pagelinks(), CoreParserFunctions\urlFunction(), Linker\userLink(), Linker\userTalkLink(), and wfIsBadImage().

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.

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

Definition at line 471 of file Title.php.

Referenced by UsersPager\__construct(), File\__get(), ImageCleanup\buildSafeTitle(), SpecialContributions\execute(), SpecialTrackingCategories\execute(), SpecialExport\execute(), ApiFeedContributions\execute(), ImportSiteScripts\execute(), SpecialLog\execute(), RebuildFileCache\execute(), ApiQueryInfo\execute(), SpecialNewpages\form(), Linker\formatAutocomments(), Linker\formatLinksInComment(), PageQueryPage\formatResult(), PopularPagesPage\formatResult(), FewestrevisionsPage\formatResult(), WantedQueryPage\formatResult(), MostlinkedCategoriesPage\formatResult(), UnwatchedpagesPage\formatResult(), ShortPagesPage\formatResult(), MostcategoriesPage\formatResult(), MostinterwikisPage\formatResult(), MostlinkedTemplatesPage\formatResult(), MostlinkedPage\formatResult(), SpecialProtectedtitles\formatRow(), ProtectedPagesPager\formatValue(), ImageListPager\formatValue(), Preferences\generateSkinOptions(), CategoryPager\getBody(), OutputPage\getCategories(), ImagePageTest\getImagePage(), ImagePage404Test\getImagePage(), JobQueueRedis\getJobFromFields(), SpecialStatistics\getMostViewedPages(), ArchivedFile\getName(), SpecialEditWatchlist\getNormalForm(), WantedFilesPage\getPageHeader(), ResourceLoaderUserModule\getPages(), RandomPage\getRandomTitle(), UploadBase\getTitle(), SpecialEditWatchlist\getWatchlist(), Skin\makeNSUrl(), Linker\makeThumbLink2(), TitleCleanup\moveInconsistentPage(), SpecialRandomInCategory\onSubmit(), ImageQueryPage\outputResults(), CoreParserFunctions\pagesincategory(), ImageCleanup\processRow(), WikiImporter\processTitle(), RefreshLinksJob\run(), RevisionDeleteUser\setUsernameBitfields(), SpecialBookSources\showList(), Preferences\skinPreferences(), CoreParserFunctions\special(), PrefixSearch\specialSearch(), LinksUpdateTest\testUpdate_iwlinks(), ApiQueryBase\titlePartToKey(), and wfStreamThumb().

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 List of errors

Definition at line 2377 of file Title.php.

Title::moveNoAuth ( &$  nt)

Move this page without authentication.

Parameters:
Title$ntThe new page Title
Returns:
array|bool True on success, getUserPermissionsErrors()-like array on failure

Definition at line 3555 of file Title.php.

References $urls.

Title::moveSubpages ( nt,
auth = true,
reason = '',
createRedirect = true 
)

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
Returns:
array Array with old page titles as keys, and strings (new page titles) or arrays (errors) as values, or an error array with numeric indices if no pages were moved

Definition at line 3759 of file Title.php.

Title::moveTo ( &$  nt,
auth = true,
reason = '',
createRedirect = true 
)

Move a title to a new location.

Todo:
Deprecate this in favor of MovePage
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.
Returns:
array|bool True on success, getUserPermissionsErrors()-like array on failure

Definition at line 3723 of file Title.php.

References array().

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

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

Referenced by LinkCache\addLink(), ApiQueryBase\keyToTitle(), and TitleTest\testWgWhitelistReadRegexp().

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

Referenced by CleanupSpam\cleanupArticle(), ApiMove\execute(), and ApiComparePages\revisionOrTitleOrId().

static Title::newFromIDs ( ids) [static]

Make an array of titles from an array of IDs.

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

Definition at line 365 of file Title.php.

static Title::newFromRedirect ( text) [static]

Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will only return the very next target, useful for the redirect table and other checks that don't need full recursion.

Parameters:
string$textText with possible redirect
Returns:
Title The corresponding Title
Deprecated:
since 1.21, use Content::getRedirectTarget instead.

Definition at line 509 of file Title.php.

static Title::newFromRedirectArray ( text) [static]

Extract a redirect destination from a string and return an array of Titles, or null if the text doesn't contain a valid redirect The last element in the array is the final destination after all redirects have been resolved (up to $wgMaxRedirects times)

Parameters:
string$textText with possible redirect
Returns:
Title[] Array of Titles, with the destination last
Deprecated:
since 1.21, use Content::getRedirectChain instead.

Definition at line 543 of file Title.php.

static Title::newFromRedirectRecurse ( text) [static]

Extract a redirect destination from a string and return the Title, or null if the text doesn't contain a valid redirect This will recurse down $wgMaxRedirects times or until a non-redirect target is hit in order to provide (hopefully) the Title of the final destination instead of another redirect.

Parameters:
string$textText with possible redirect
Returns:
Title
Deprecated:
since 1.21, use Content::getUltimateRedirectTarget instead.

Definition at line 526 of file Title.php.

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

Referenced by PrefixSearch\defaultSearchBackend(), CompareParserCache\execute(), UpdateCollation\execute(), SpecialPagesWithProp\formatResult(), ApiQueryIWBacklinks\run(), and ApiQueryLangBacklinks\run().

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.

Parameters:
string$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:
MWException
Returns:
Title|null Title or null on an error.

Definition at line 235 of file Title.php.

Referenced by RecentChangeTest\__construct(), PreferencesTest\__construct(), ImageListPager\__construct(), ParserTest\addArticle(), SpecialMyLanguageTest\addDBData(), BackupDumperPageTest\addDBData(), TextPassDumperTest\addDBData(), ApiQueryBasicTest\addDBData(), BackupDumperLoggerTest\addLogEntry(), ApiQueryLogEvents\addLogParams(), Skin\addToSidebarPlain(), ApiFormatXml\addXslt(), ApiQuerySiteinfo\appendRightsInfo(), EditPageTest\assertEdit(), CoreParserFunctions\basepagename(), CoreParserFunctions\basepagenamee(), CoreParserFunctions\cascadingsources(), SpecialComparePages\checkExistingTitle(), Skin\checkTitle(), ApiFeedWatchlist\createFeedItem(), RevisionStorageTest\createPage(), PrefixSearch\defaultSearchBackend(), UploadFromUrlTest\deleteFile(), ApiTestCaseUpload\deleteFileByFileName(), ApiTestCaseUpload\deleteFileByTitle(), CoreParserFunctions\displaytitle(), SpecialExport\doExport(), PurgeList\doPurge(), GenderCache\doTitlesArray(), Skin\drawCategoryBrowser(), ApiUndelete\execute(), ApiMove\execute(), ApiRevisionDelete\execute(), PageExists\execute(), ApiWatch\execute(), Undelete\execute(), ApiExpandTemplates\execute(), ApiQueryAllMessages\execute(), ApiQueryLangLinks\execute(), ApiQueryIWLinks\execute(), MaintenanceFormatInstallDoc\execute(), SpecialListGroupRights\execute(), GetTextMaint\execute(), NukePage\execute(), ApiQueryLogEvents\execute(), Protect\execute(), FixDoubleRedirects\execute(), EditCLI\execute(), SpecialLog\execute(), DumpIterator\execute(), RollbackEdits\execute(), DeleteBatch\execute(), MoveBatch\execute(), FileDuplicateSearchPage\execute(), SpecialEditWatchlist\extractTitles(), SpecialMyLanguage\findTitle(), Skin\footerLink(), foreach(), Linker\formatAutocomments(), Linker\formatLinksInComment(), MIMEsearchPage\formatResult(), CoreParserFunctions\fullpagename(), CoreParserFunctions\fullpagenamee(), CoreParserFunctions\gender(), MoveLogFormatter\getActionLinks(), Skin\getCategoryLinks(), RCCacheEntryFactoryTest\getContext(), Skin\getCopyright(), ApiFeedRecentChanges\getFeedObject(), SpecialStatistics\getGroupStats(), IRCColourfulRCFeedFormatter\getLine(), SpecialExport\getLinks(), MoveLogFormatter\getMessageParameters(), WantedFilesPage\getPageHeader(), MoveLogFormatter\getPreloadTitles(), WikitextContent\getRedirectTargetAndText(), ResourceLoaderWikiModule\getScript(), ParserOutput\getSecondaryDataUpdates(), ResourceLoaderWikiModule\getStyles(), TestRecentChangesHelper\getTestContext(), DifferenceEngineTest\getTitle(), CLIParser\getTitle(), UploadBase\getTitle(), ResourceLoaderWikiModule\getTitleInfo(), ParserMethodsTest\helperParserFunc(), Skin\makeI18nUrl(), Skin\makeKnownUrlDetails(), MessageCacheTest\makePage(), PPFuzzTester\makeTitle(), LinksUpdateTest\makeTitleAndParserOutput(), Skin\makeUrl(), Skin\makeUrlDetails(), TitleCleanup\moveIllegalPage(), CoreParserFunctions\mwnamespace(), CoreParserFunctions\namespacee(), CoreParserFunctions\namespacenumber(), ForeignAPIFile\newFromTitle(), WikiPageTest\newPage(), RevisionTest\newTestRevision(), MediaWikiSite\normalizePageName(), SpecialRandomInCategory\onSubmit(), SpecialChangePassword\onSubmit(), SpecialChangeEmail\onSuccess(), CoreParserFunctions\pageid(), CoreParserFunctions\pagename(), CoreParserFunctions\pagenamee(), CoreParserFunctions\pagesize(), WikiImporter\processLogItem(), TitleCleanup\processRow(), WatchlistCleanup\processRow(), WikiImporter\processTitle(), CoreParserFunctions\protectionlevel(), CoreParserFunctions\revisionday(), CoreParserFunctions\revisionday2(), CoreParserFunctions\revisionid(), CoreParserFunctions\revisionmonth(), CoreParserFunctions\revisionmonth1(), ApiComparePages\revisionOrTitleOrId(), CoreParserFunctions\revisiontimestamp(), CoreParserFunctions\revisionuser(), CoreParserFunctions\revisionyear(), SpecialComparePages\revOrTitle(), CoreParserFunctions\rootpagename(), CoreParserFunctions\rootpagenamee(), ApiQueryImages\run(), ApiQueryCategories\run(), ApiQueryLinks\run(), PrefixSearch\search(), WikiImporter\setTargetRootPage(), TextContentTest\setUp(), ApiRevisionDeleteTest\setUp(), SpecialEditWatchlist\showTitles(), CoreParserFunctions\subjectpagename(), CoreParserFunctions\subjectpagenamee(), CoreParserFunctions\subjectspace(), CoreParserFunctions\subjectspacee(), CoreParserFunctions\subpagename(), CoreParserFunctions\subpagenamee(), Skin\subPageSubtitle(), CoreParserFunctions\talkpagename(), CoreParserFunctions\talkpagenamee(), CoreParserFunctions\talkspace(), CoreParserFunctions\talkspacee(), EditPageTest\testAutoMerge(), TagHookTest\testBadFunctionTagHooks(), TagHookTest\testBadTagHooks(), ApiQueryAllPagesTest\testBug25702(), SpecialPreferencesTest\testBug41337(), ParserMethodsTest\testCallParserFunction(), RevisionTest\testConstructWithContent(), ApiQueryRevisionsTest\testContentComesWithContentModelAndFormat(), TestSample\testCreateBasicListOfTitles(), TextContentTest\testDeletionUpdates(), WikiPageTest\testDoDeleteArticle(), WikiPageTest\testDoEdit(), ApiEditPageTest\testEdit_redirect(), ApiEditPageTest\testEdit_redirectText(), ApiEditPageTest\testEditAppend(), ApiEditPageTest\testEditConflict(), ApiEditPageTest\testEditConflict_bug41990(), ApiEditPageTest\testEditConflict_newSection(), ApiEditPageTest\testEditNewSection(), ApiEditPageTest\testEditSection(), TitleMethodsTest\testEquals(), TitleTest\testFixSpecialNameRetainsParameter(), LinkerTest\testFormatComment(), TagHookTest\testFunctionTagHooks(), ContentHandlerTest\testGetAutosummary(), TitleTest\testGetBaseText(), RevisionTest\testGetContentClone(), TitleMethodsTest\testGetContentModel(), ContentHandlerTest\testGetDefaultModelFor(), ContentHandlerTest\testGetForTitle(), TitleTest\testGetFragment(), ContentHandlerTest\testGetPageLanguage(), TitleTest\testGetPageViewLanguage(), TextContentTest\testGetParserOutput(), ApiWatchTest\testGetRollbackToken(), TitleTest\testGetRootText(), WikitextContentTest\testGetSecondaryDataUpdates(), ParserMethodsTest\testGetSections(), TitleTest\testGetSubpageText(), TitleTest\testGetTitleValue(), TitleMethodsTest\testHasContentModel(), TitleMethodsTest\testHasSubjectNamespace(), TitleMethodsTest\testInNamespace(), TitleMethodsTest\testInNamespaces(), TitleTest\testIsAlwaysKnown(), WikiPageTest\testIsCountable(), TitleMethodsTest\testIsCssJsSubpage(), TitleMethodsTest\testIsCssOrJsPage(), TitleMethodsTest\testIsCssSubpage(), TitleMethodsTest\testIsJsSubpage(), TitleTest\testIsValidMoveOperation(), TitleMethodsTest\testIsWikitextPage(), ContentHandlerTest\testMakeContent(), ApiEditPageTest\testNonTextEdit(), ParserMethodsTest\testPreSaveTransform(), ApiPurgeTest\testPurgeMainPage(), ParserMethodsTest\testRecursiveParse(), SpecialSearchTest\testSearchTermIsNotExpanded(), TitleTest\testSecureAndSplitInvalid(), TitleTest\testSecureAndSplitValid(), TagHookTest\testTagHooks(), TemplateCategoriesTest\testTemplateCategories(), ArticleTablesTest\testTemplatelinksUsesContentLanguage(), TestSample\testTitleObjectFromObject(), TestSample\testTitleObjectStringConversion(), ApiQueryTest\testTitlesAreRejectedIfInvalid(), ApiQueryTest\testTitlesGetNormalized(), LinksUpdateTest\testUpdate_langlinks(), LinksUpdateTest\testUpdate_pagelinks(), LinksUpdateTest\testUpdate_templatelinks(), JavaScriptContentTest\testUpdateRedirect(), RequestContextTest\testWikiPageTitle(), ApiQueryBase\titleToKey(), SpecialEditWatchlist\unwatchTitles(), CoreParserFunctions\urlFunction(), SpecialEditWatchlist\watchTitles(), and wfIsBadImage().

static Title::newFromTitleValue ( TitleValue titleValue) [static]

Create a new Title from a TitleValue.

Parameters:
TitleValue$titleValueAssumed to be safe.
Returns:
Title

Definition at line 215 of file Title.php.

Referenced by TitleTest\testNewFromTitleValue().

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

Referenced by ImageListPager\__construct(), ImageListPager\buildQueryConds(), SpecialRecentChangesLinked\doMainQuery(), NewFilesPager\getQueryInfo(), and CoreParserFunctions\urlFunction().

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

Referenced by touchLinks().

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

References escapeFragmentForURL(), getFragment(), and hasFragment().

static Title::purgeExpiredRestrictions ( ) [static]

Purge expired restrictions from the page_restrictions table.

Definition at line 2981 of file Title.php.

Referenced by SpecialProtectedpages\execute(), and SpecialProtectedtitles\execute().

Purge all applicable Squid URLs.

Definition at line 3540 of file Title.php.

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

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

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

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.

Returns:
bool True on success

Definition at line 3285 of file Title.php.

References $wgContLang, global, and MWNamespace\isCapitalized().

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. Still in active use privately.

Parameters:
string$fragmentText

Definition at line 1352 of file Title.php.

Update page_touched timestamps and send squid 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 4469 of file Title.php.

References $conds, array(), pageCond(), wfGetDB(), and wfReadOnly().

Title::userCan ( action,
user = null,
doExpensiveQueries = true 
)

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.
bool$doExpensiveQueriesSet this to false to avoid doing unnecessary queries.
Returns:
bool

Definition at line 1856 of file Title.php.

References $user.

Is $wgUser watching this page?

Deprecated:
since 1.20; use User::isWatched() instead.
Returns:
bool

Definition at line 1815 of file Title.php.

Title::validateFileMoveOperation ( nt) [protected]

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

Parameters:
Title$ntTarget title
Returns:
array List of errors

Definition at line 3677 of file Title.php.

References array(), check, exists(), and isValidMoveTarget().

Was this a local interwiki link?

Returns:
bool

Definition at line 808 of file Title.php.


Member Data Documentation

int Title::$mArticleID = -1

Article ID, fetched from the link cache on demand *.

Definition at line 75 of file Title.php.

bool Title::$mCascadeRestriction

Cascade restrictions on this page to included templates and images? *.

Definition at line 90 of file Title.php.

array Title::$mCascadeSources

Where are the cascading restrictions coming from on this page? *.

Definition at line 99 of file Title.php.

Title::$mCascadingRestrictions

Caching the results of getCascadeProtectionSources.

Definition at line 93 of file Title.php.

bool string Title::$mContentModel = false

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

one of the CONTENT_MODEL_XXX constants

Definition at line 82 of file Title.php.

string Title::$mDbkeyform = ''

Main part with underscores *.

Definition at line 63 of file Title.php.

string Title::$mDbPageLanguage = null [private]

The page language code from the database *.

Definition at line 130 of file Title.php.

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 bug 696. Zero except in {{transclusion}} tags.

Definition at line 112 of file Title.php.

int Title::$mEstimateRevisions [private]

Estimated number of revisions; null of not loaded *.

Definition at line 84 of file Title.php.

string Title::$mFragment = ''

Title fragment (i.e.

the bit after the #) *

Definition at line 73 of file Title.php.

bool Title::$mHasCascadingRestrictions [protected]

Are cascading restrictions in effect on this page? *.

Definition at line 97 of file Title.php.

bool Title::$mHasSubpages [private]

Whether a page has any subpages *.

Definition at line 126 of file Title.php.

string Title::$mInterwiki = ''

Interwiki prefix *.

Definition at line 69 of file Title.php.

bool Title::$mIsBigDeletion = null [private]

Would deleting this page be a big deletion? *.

Definition at line 134 of file Title.php.

bool int Title::$mLatestID = false [protected]

ID of most recent revision *.

Definition at line 77 of file Title.php.

int Title::$mLength = -1 [protected]

The page length, 0 for special pages *.

Definition at line 119 of file Title.php.

bool Title::$mLocalInterwiki = false [private]

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

Definition at line 71 of file Title.php.

int Title::$mNamespace = NS_MAIN

Namespace index, i.e.

one of the NS_xxxx constants *

Definition at line 67 of file Title.php.

Title::$mNotificationTimestamp = array() [private]

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

Definition at line 124 of file Title.php.

bool Title::$mOldRestrictions = false [protected]

*

Definition at line 88 of file Title.php.

bool Title::$mPageLanguage = false [private]

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

*

Definition at line 128 of file Title.php.

Title::$mPrefixedText = null [protected]

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

Definition at line 104 of file Title.php.

null Title::$mRedirect = null

Is the article at this title a redirect? *.

Definition at line 121 of file Title.php.

array Title::$mRestrictions = array()

Array of groups allowed to edit this article *.

Definition at line 86 of file Title.php.

array Title::$mRestrictionsExpiry = array() [protected]

When do the restrictions on this page expire? *.

Definition at line 95 of file Title.php.

bool Title::$mRestrictionsLoaded = false

Boolean for initialisation on demand *.

Definition at line 101 of file Title.php.

string Title::$mTextform = ''

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

Definition at line 59 of file Title.php.

mixed Title::$mTitleProtection

Cached value for getTitleProtection (create protection) *.

Definition at line 106 of file Title.php.

TitleValue Title::$mTitleValue = null [private]

A corresponding TitleValue object *.

Definition at line 132 of file Title.php.

string Title::$mUrlform = ''

URL-encoded form of the main part *.

Definition at line 61 of file Title.php.

string Title::$mUserCaseDBKey [protected]

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

Definition at line 65 of file Title.php.

bool Title::$mWatched = null [protected]

Is $wgUser watching this page? null if unfilled, accessed through userIsWatching()

Definition at line 117 of file Title.php.

Title::$titleCache = null [static, private]

Definition at line 37 of file Title.php.

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

Used to be GAID_FOR_UPDATE define.

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

Definition at line 50 of file Title.php.

Referenced by ApiRevisionDeleteTest\setUp(), and UploadFromUrlTest\testLeaveMessage().


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