MediaWiki REL1_31
|
Represents a title within MediaWiki. More...
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. | |
Public Attributes inherited from IDBAccessObject | |
const | READ_LOCKING = 3 |
Constants for object loading bitfield flags (higher => higher QoS) | |
const | READ_NONE = -1 |
Static Private Attributes | |
static HashBagOStuff | $titleCache = null |
Private member variables | |
Please use the accessor functions instead.
| |
string | $mTextform = '' |
Text form (spaces not underscores) of the main part. | |
string | $mUrlform = '' |
URL-encoded form of the main part. | |
string | $mDbkeyform = '' |
Main part with underscores. | |
int | $mNamespace = NS_MAIN |
Namespace index, i.e. | |
string | $mInterwiki = '' |
Interwiki prefix. | |
string | $mFragment = '' |
Title fragment (i.e. | |
int | $mArticleID = -1 |
Article ID, fetched from the link cache on demand. | |
array | $mRestrictions = [] |
Array of groups allowed to edit this article. | |
bool | $mCascadeRestriction |
Cascade restrictions on this page to included templates and images? | |
$mCascadingRestrictions | |
Caching the results of getCascadeProtectionSources. | |
array | $mCascadeSources |
Where are the cascading restrictions coming from on this page? | |
bool | $mRestrictionsLoaded = false |
Boolean for initialisation on demand. | |
mixed | $mTitleProtection |
Cached value for getTitleProtection (create protection) | |
int | $mDefaultNamespace = NS_MAIN |
Namespace index when there is no namespace. | |
null | $mRedirect = null |
Is the article at this title a redirect? | |
string | $mUserCaseDBKey |
Database key with the initial letter in the case specified by the user. | |
bool int | $mLatestID = false |
ID of most recent revision. | |
string bool | $mOldRestrictions = false |
Comma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. | |
array | $mRestrictionsExpiry = [] |
When do the restrictions on this page expire? | |
bool | $mHasCascadingRestrictions |
Are cascading restrictions in effect on this page? | |
string | $mPrefixedText = null |
Text form including namespace/interwiki, initialised on demand. | |
int | $mLength = -1 |
The page length, 0 for special pages. | |
bool | $mLocalInterwiki = false |
Was this Title created from a string with a local interwiki prefix? | |
bool string | $mContentModel = false |
ID of the page's content model, i.e. | |
bool | $mForcedContentModel = false |
If a content model was forced via setContentModel() this will be true to avoid having other code paths reset it. | |
int | $mEstimateRevisions |
Estimated number of revisions; null of not loaded. | |
array | $mNotificationTimestamp = [] |
Associative array of user ID -> timestamp/false. | |
bool | $mHasSubpages |
Whether a page has any subpages. | |
bool | $mPageLanguage = false |
The (string) language code of the page's language and content code. | |
string bool null | $mDbPageLanguage = false |
The page language code from the database, null if not saved in the database or false if not loaded, yet. | |
TitleValue | $mTitleValue = null |
A corresponding TitleValue object. | |
bool | $mIsBigDeletion = null |
Would deleting this page be a big deletion? | |
static | getTitleFormatter () |
B/C kludge: provide a TitleParser for use by Title. | |
static | getInterwikiLookup () |
B/C kludge: provide an InterwikiLookup for use by Title. | |
static | getTitleCache () |
static | fixUrlQueryArgs ( $query, $query2=false) |
Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args get{Canonical,Full,Link,Local,Internal}URL methods accepted an optional second argument named variant. | |
__construct () | |
loadFromRow ( $row) | |
Load Title object fields from a DB row. | |
isValid () | |
Returns true if the title is valid, false if it is invalid. | |
isLocal () | |
Determine whether the object refers to a page within this project (either this wiki or a wiki with a local interwiki, see https://www.mediawiki.org/wiki/Manual:Interwiki_table#iw_local ) | |
isExternal () | |
Is this Title interwiki? | |
getInterwiki () | |
Get the interwiki prefix. | |
wasLocalInterwiki () | |
Was this a local interwiki link? | |
isTrans () | |
Determine whether the object refers to a page within this project and is transcludable. | |
getTransWikiID () | |
Returns the DB name of the distant wiki which owns the object. | |
getTitleValue () | |
Get a TitleValue object representing this Title. | |
getText () | |
Get the text form (spaces not underscores) of the main part. | |
getPartialURL () | |
Get the URL-encoded form of the main part. | |
getDBkey () | |
Get the main part with underscores. | |
getUserCaseDBKey () | |
Get the DB key with the initial letter case as specified by the user. | |
getNamespace () | |
Get the namespace index, i.e. | |
getContentModel ( $flags=0) | |
Get the page's content model id, see the CONTENT_MODEL_XXX constants. | |
hasContentModel ( $id) | |
Convenience method for checking a title's content model name. | |
setContentModel ( $model) | |
Set a proposed content model for the page for permissions checking. | |
getNsText () | |
Get the namespace text. | |
getSubjectNsText () | |
Get the namespace text of the subject (rather than talk) page. | |
getTalkNsText () | |
Get the namespace text of the talk page. | |
canTalk () | |
Can this title have a corresponding talk page? | |
canHaveTalkPage () | |
Can this title have a corresponding talk page? | |
canExist () | |
Is this in a namespace that allows actual pages? | |
isWatchable () | |
Can this title be added to a user's watchlist? | |
isSpecialPage () | |
Returns true if this is a special page. | |
isSpecial ( $name) | |
Returns true if this title resolves to the named special page. | |
fixSpecialName () | |
If the Title refers to a special page alias which is not the local default, resolve the alias, and localise the name as necessary. | |
inNamespace ( $ns) | |
Returns true if the title is inside the specified namespace. | |
inNamespaces () | |
Returns true if the title is inside one of the specified namespaces. | |
hasSubjectNamespace ( $ns) | |
Returns true if the title has the same subject namespace as the namespace specified. | |
isContentPage () | |
Is this Title in a namespace which contains content? In other words, is this a content page, for the purposes of calculating statistics, etc? | |
isMovable () | |
Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable. | |
isMainPage () | |
Is this the mainpage? | |
isSubpage () | |
Is this a subpage? | |
isConversionTable () | |
Is this a conversion table for the LanguageConverter? | |
isWikitextPage () | |
Does that page contain wikitext, or it is JS, CSS or whatever? | |
isSiteConfigPage () | |
Could this MediaWiki namespace page contain custom CSS, JSON, or JavaScript for the global UI. | |
isCssOrJsPage () | |
isUserConfigPage () | |
Is this a "config" (.css, .json, or .js) sub-page of a user page? | |
isCssJsSubpage () | |
getSkinFromConfigSubpage () | |
Trim down a .css, .json, or .js subpage title to get the corresponding skin name. | |
getSkinFromCssJsSubpage () | |
isUserCssConfigPage () | |
Is this a CSS "config" sub-page of a user page? | |
isCssSubpage () | |
isUserJsonConfigPage () | |
Is this a JSON "config" sub-page of a user page? | |
isUserJsConfigPage () | |
Is this a JS "config" sub-page of a user page? | |
isJsSubpage () | |
isTalkPage () | |
Is this a talk page of some sort? | |
getTalkPage () | |
Get a Title object associated with the talk page of this article. | |
getTalkPageIfDefined () | |
Get a Title object associated with the talk page of this article, if such a talk page can exist. | |
getSubjectPage () | |
Get a title object associated with the subject page of this talk page. | |
getOtherPage () | |
Get the other title for this page, if this is a subject page get the talk page, if it is a subject page get the talk page. | |
getDefaultNamespace () | |
Get the default namespace index, for when there is no namespace. | |
getFragment () | |
Get the Title fragment (i.e. | |
hasFragment () | |
Check if a Title fragment is set. | |
getFragmentForURL () | |
Get the fragment in URL form, including the "#" character if there is one. | |
setFragment ( $fragment) | |
Set the fragment for this title. | |
createFragmentTarget ( $fragment) | |
Creates a new Title for a different fragment of the same page. | |
getPrefixedDBkey () | |
Get the prefixed database key form. | |
getPrefixedText () | |
Get the prefixed title with spaces. | |
__toString () | |
Return a string representation of this title. | |
getFullText () | |
Get the prefixed title with spaces, plus any fragment (part beginning with '#') | |
getRootText () | |
Get the root page name text without a namespace, i.e. | |
getRootTitle () | |
Get the root page name title, i.e. | |
getBaseText () | |
Get the base page name without a namespace, i.e. | |
getBaseTitle () | |
Get the base page name title, i.e. | |
getSubpageText () | |
Get the lowest-level subpage name, i.e. | |
getSubpage ( $text) | |
Get the title for a subpage of the current page. | |
getSubpageUrlForm () | |
Get a URL-encoded form of the subpage text. | |
getPrefixedURL () | |
Get a URL-encoded title (not an actual URL) including interwiki. | |
getFullURL ( $query='', $query2=false, $proto=PROTO_RELATIVE) | |
Get a real URL referring to this title, with interwiki link and fragment. | |
getFullUrlForRedirect ( $query='', $proto=PROTO_CURRENT) | |
Get a url appropriate for making redirects based on an untrusted url arg. | |
getLocalURL ( $query='', $query2=false) | |
Get a URL with no fragment or server name (relative URL) from a Title object. | |
getLinkURL ( $query='', $query2=false, $proto=false) | |
Get a URL that's the simplest URL that will be valid to link, locally, to the current Title. | |
getInternalURL ( $query='', $query2=false) | |
Get the URL form for an internal link. | |
getCanonicalURL ( $query='', $query2=false) | |
Get the URL for a canonical link, for use in things like IRC and e-mail notifications. | |
getEditURL () | |
Get the edit URL for this Title. | |
quickUserCan ( $action, $user=null) | |
Can $user perform $action on this page? This skips potentially expensive cascading permission checks as well as avoids expensive error formatting. | |
userCan ( $action, $user=null, $rigor='secure') | |
Can $user perform $action on this page? | |
getUserPermissionsErrors ( $action, $user, $rigor='secure', $ignoreErrors=[]) | |
Can $user perform $action on this page? | |
getRestrictionTypes () | |
Returns restriction types for the current Title. | |
getTitleProtection () | |
Is this title subject to title protection? Title protection is the one applied against creation of such title. | |
deleteTitleProtection () | |
Remove any title protection due to page existing. | |
isSemiProtected ( $action='edit') | |
Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels? | |
isProtected ( $action='') | |
Does the title correspond to a protected article? | |
isNamespaceProtected (User $user) | |
Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection. | |
isCascadeProtected () | |
Cascading protection: Return true if cascading restrictions apply to this page, false if not. | |
areCascadeProtectionSourcesLoaded ( $getPages=true) | |
Determines whether cascading protection sources have already been loaded from the database. | |
getCascadeProtectionSources ( $getPages=true) | |
Cascading protection: Get the source of any cascading restrictions on this page. | |
areRestrictionsLoaded () | |
Accessor for mRestrictionsLoaded. | |
getRestrictions ( $action) | |
Accessor/initialisation for mRestrictions. | |
getAllRestrictions () | |
Accessor/initialisation for mRestrictions. | |
getRestrictionExpiry ( $action) | |
Get the expiry time for the restriction against a given action. | |
areRestrictionsCascading () | |
Returns cascading restrictions for the current article. | |
loadRestrictionsFromRows ( $rows, $oldFashionedRestrictions=null) | |
Compiles list of active page restrictions from both page table (pre 1.10) and page_restrictions table for this existing page. | |
loadRestrictions ( $oldFashionedRestrictions=null) | |
Load restrictions from the page_restrictions table. | |
flushRestrictions () | |
Flush the protection cache in this object and force reload from the database. | |
hasSubpages () | |
Does this have subpages? (Warning, usually requires an extra DB query.) | |
getSubpages ( $limit=-1) | |
Get all subpages of this page. | |
isDeleted () | |
Is there a version of this page in the deletion archive? | |
isDeletedQuick () | |
Is there a version of this page in the deletion archive? | |
getArticleID ( $flags=0) | |
Get the article ID for this Title from the link cache, adding it if necessary. | |
isRedirect ( $flags=0) | |
Is this an article that is a redirect page? Uses link cache, adding it if necessary. | |
getLength ( $flags=0) | |
What is the length of this page? Uses link cache, adding it if necessary. | |
getLatestRevID ( $flags=0) | |
What is the page_latest field for this page? | |
resetArticleID ( $newid) | |
This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache. | |
getLinksTo ( $options=[], $table='pagelinks', $prefix='pl') | |
Get an array of Title objects linking to this Title Also stores the IDs in the link cache. | |
getTemplateLinksTo ( $options=[]) | |
Get an array of Title objects using this Title as a template Also stores the IDs in the link cache. | |
getLinksFrom ( $options=[], $table='pagelinks', $prefix='pl') | |
Get an array of Title objects linked from this Title Also stores the IDs in the link cache. | |
getTemplateLinksFrom ( $options=[]) | |
Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache. | |
getBrokenLinksFrom () | |
Get an array of Title objects referring to non-existent articles linked from this page. | |
getCdnUrls () | |
Get a list of URLs to purge from the CDN cache when this page changes. | |
getSquidURLs () | |
purgeSquid () | |
Purge all applicable CDN URLs. | |
isValidMoveOperation (&$nt, $auth=true, $reason='') | |
Check whether a given move operation would be valid. | |
moveTo (&$nt, $auth=true, $reason='', $createRedirect=true, array $changeTags=[]) | |
Move a title to a new location. | |
moveSubpages ( $nt, $auth=true, $reason='', $createRedirect=true, array $changeTags=[]) | |
Move this page's subpages to be subpages of $nt. | |
isSingleRevRedirect () | |
Checks if this page is just a one-rev redirect. | |
isValidMoveTarget ( $nt) | |
Checks if $this can be moved to a given Title. | |
getParentCategories () | |
Get categories to which this Title belongs and return an array of categories' names. | |
getParentCategoryTree ( $children=[]) | |
Get a tree of parent categories. | |
pageCond () | |
Get an associative array for selecting this title from the "page" table. | |
getPreviousRevisionID ( $revId, $flags=0) | |
Get the revision ID of the previous revision. | |
getNextRevisionID ( $revId, $flags=0) | |
Get the revision ID of the next revision. | |
getFirstRevision ( $flags=0) | |
Get the first revision of the page. | |
getEarliestRevTime ( $flags=0) | |
Get the oldest revision timestamp of this page. | |
isNewPage () | |
Check if this is a new page. | |
isBigDeletion () | |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. | |
estimateRevisionCount () | |
Get the approximate revision count of this page. | |
countRevisionsBetween ( $old, $new, $max=null) | |
Get the number of revisions between the given revision. | |
getAuthorsBetween ( $old, $new, $limit, $options=[]) | |
Get the authors between the given revisions or revision IDs. | |
countAuthorsBetween ( $old, $new, $limit, $options=[]) | |
Get the number of authors between the given revisions or revision IDs. | |
equals (Title $title) | |
Compare with another title. | |
isSubpageOf (Title $title) | |
Check if this title is a subpage of another title. | |
exists ( $flags=0) | |
Check if page exists. | |
isAlwaysKnown () | |
Should links to this title be shown as potentially viewable (i.e. | |
isKnown () | |
Does this title refer to a page that can (or might) be meaningfully viewed? In particular, this function may be used to determine if links to the title should be rendered as "bluelinks" (as opposed to "redlinks" to non-existent pages). | |
hasSourceText () | |
Does this page have source text? | |
getDefaultMessageText () | |
Get the default message text or false if the message doesn't exist. | |
invalidateCache ( $purgeTime=null) | |
Updates page_touched for this page; called from LinksUpdate.php. | |
touchLinks () | |
Update page_touched timestamps and send CDN purge messages for pages linking to this title. | |
getTouched ( $db=null) | |
Get the last touched timestamp. | |
getNotificationTimestamp ( $user=null) | |
Get the timestamp when this page was updated since the user last saw it. | |
getNamespaceKey ( $prepend='nstab-') | |
Generate strings used for xml 'id' names in monobook tabs. | |
getRedirectsHere ( $ns=null) | |
Get all extant redirects to this Title. | |
isValidRedirectTarget () | |
Check if this Title is a valid redirect target. | |
getBacklinkCache () | |
Get a backlink cache object. | |
canUseNoindex () | |
Whether the magic words INDEX and NOINDEX function for this page. | |
getCategorySortkey ( $prefix='') | |
Returns the raw sort key to be used for categories, with the specified prefix. | |
getPageLanguage () | |
Get the language in which the content of this page is written in wikitext. | |
getPageViewLanguage () | |
Get the language in which the content of this page is written when viewed by user. | |
getEditNotices ( $oldid=0) | |
Get a list of rendered edit notices for this page. | |
__sleep () | |
__wakeup () | |
Text form (spaces not underscores) of the main part. | |
static | newFromDBkey ( $key) |
Create a new Title from a prefixed DB key. | |
static | newFromTitleValue (TitleValue $titleValue) |
Create a new Title from a TitleValue. | |
static | newFromLinkTarget (LinkTarget $linkTarget) |
Create a new Title from a LinkTarget. | |
static | newFromText ( $text, $defaultNamespace=NS_MAIN) |
Create a new Title from text, such as what one would find in a link. | |
static | newFromTextThrow ( $text, $defaultNamespace=NS_MAIN) |
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null. | |
static | newFromURL ( $url) |
THIS IS NOT THE FUNCTION YOU WANT. | |
static | newFromID ( $id, $flags=0) |
Create a new Title from an article ID. | |
static | newFromIDs ( $ids) |
Make an array of titles from an array of IDs. | |
static | newFromRow ( $row) |
Make a Title object from a DB row. | |
static | makeTitle ( $ns, $title, $fragment='', $interwiki='') |
Create a new Title from a namespace index and a DB key. | |
static | makeTitleSafe ( $ns, $title, $fragment='', $interwiki='') |
Create a new Title from a namespace index and a DB key. | |
static | newMainPage () |
Create a new Title for the Main Page. | |
static | nameOf ( $id) |
Get the prefixed DB key associated with an ID. | |
static | legalChars () |
Get a regex character class describing the legal characters in a link. | |
static | convertByteClassToUnicodeClass ( $byteClass) |
Utility method for converting a character sequence from bytes to Unicode. | |
static | makeName ( $ns, $title, $fragment='', $interwiki='', $canonicalNamespace=false) |
Make a prefixed DB key from a DB key and a namespace index. | |
static | escapeFragmentForURL ( $fragment) |
Escape a text fragment, say from a link, for a URL. | |
static | compare (LinkTarget $a, LinkTarget $b) |
Callback for usort() to do title sorts by (namespace, title) | |
static | getFilteredRestrictionTypes ( $exists=true) |
Get a filtered list of all restriction types supported by this wiki. | |
static | purgeExpiredRestrictions () |
Purge expired restrictions from the page_restrictions table. | |
static | clearCaches () |
Text form (spaces not underscores) of the main part. | |
static | capitalize ( $text, $ns=NS_MAIN) |
Capitalize a text string for a title if it belongs to a namespace that capitalizes. | |
static | getSelectFields () |
Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries. | |
prefix ( $name) | |
Prefix some arbitrary text with the namespace or interwiki prefix of this object. | |
checkQuickPermissions ( $action, $user, $errors, $rigor, $short) | |
Permissions checks that fail most often, and which are easiest to test. | |
resultToError ( $errors, $result) | |
Add the resulting error code to the errors array. | |
checkPermissionHooks ( $action, $user, $errors, $rigor, $short) | |
Check various permission hooks. | |
checkSpecialsAndNSPermissions ( $action, $user, $errors, $rigor, $short) | |
Check permissions on special pages & namespaces. | |
checkUserConfigPermissions ( $action, $user, $errors, $rigor, $short) | |
Check CSS/JSON/JS sub-page permissions. | |
checkPageRestrictions ( $action, $user, $errors, $rigor, $short) | |
Check against page_restrictions table requirements on this page. | |
checkCascadingSourcesRestrictions ( $action, $user, $errors, $rigor, $short) | |
Check restrictions on cascading pages. | |
checkActionPermissions ( $action, $user, $errors, $rigor, $short) | |
Check action permissions not already checked in checkQuickPermissions. | |
checkUserBlock ( $action, $user, $errors, $rigor, $short) | |
Check that the user isn't blocked from editing. | |
checkReadPermissions ( $action, $user, $errors, $rigor, $short) | |
Check that the user is allowed to read this page. | |
missingPermissionError ( $action, $short) | |
Get a description array when the user doesn't have the right to perform $action (i.e. | |
secureAndSplit () | |
Secure and split - main initialisation function for this object. | |
getRelativeRevisionID ( $revId, $flags, $dir) | |
Get next/previous revision ID relative to another revision ID. | |
getDbPageLanguageCode () | |
Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false. | |
getUserPermissionsErrorsInternal ( $action, $user, $rigor='secure', $short=false) | |
Can $user perform $action on this page? This is an internal function, with multiple levels of checks depending on performance needs; see $rigor below. | |
getTitleProtectionInternal () | |
Fetch title protection settings. | |
validateFileMoveOperation ( $nt) | |
Check if the requested move target is a valid file move target. | |
Additional Inherited Members |
Represents a title within MediaWiki.
Optionally may contain an interwiki designation or namespace.
Title::__toString | ( | ) |
Return a string representation of this title.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1639 of file Title.php.
References getPrefixedText().
Title::__wakeup | ( | ) |
Text form (spaces not underscores) of the main part.
Definition at line 5129 of file Title.php.
References wfUrlencode().
Title::areCascadeProtectionSourcesLoaded | ( | $getPages = true | ) |
Determines whether cascading protection sources have already been loaded from the database.
bool | $getPages | True to check if the pages are loaded, or false to check if the status is loaded. |
Title::areRestrictionsCascading | ( | ) |
Returns cascading restrictions for the current article.
Definition at line 3133 of file Title.php.
References loadRestrictions().
Title::areRestrictionsLoaded | ( | ) |
Title::canExist | ( | ) |
Is this in a namespace that allows actual pages?
Definition at line 1095 of file Title.php.
References NS_MAIN.
Referenced by RequestContext\canUseWikiPage().
Title::canHaveTalkPage | ( | ) |
Can this title have a corresponding talk page?
Definition at line 1086 of file Title.php.
Referenced by canTalk(), getOtherPage(), and getTalkPageIfDefined().
Title::canTalk | ( | ) |
Can this title have a corresponding talk page?
Definition at line 1074 of file Title.php.
References canHaveTalkPage().
Title::canUseNoindex | ( | ) |
Whether the magic words INDEX and NOINDEX function for this page.
Definition at line 4896 of file Title.php.
References $wgExemptFromUserRobotsControl.
|
static |
Capitalize a text string for a title if it belongs to a namespace that capitalizes.
string | $text | Containing title to capitalize |
int | $ns | Namespace index, defaults to NS_MAIN |
Definition at line 3594 of file Title.php.
References $wgContLang.
|
private |
Check action permissions not already checked in checkQuickPermissions.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2469 of file Title.php.
References $wgDeleteRevisionsLimit, $wgLang, checkCascadingSourcesRestrictions(), checkPageRestrictions(), exists(), getNsText(), getTitleProtection(), getUserPermissionsErrorsInternal(), isBigDeletion(), isMovable(), userCan(), and User\whoIs().
|
private |
Check restrictions on cascading pages.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2422 of file Title.php.
References getCascadeProtectionSources(), isUserConfigPage(), and list.
Referenced by checkActionPermissions().
|
private |
Check against page_restrictions table requirements on this page.
The user must possess all required rights for this action.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2388 of file Title.php.
References getRestrictions().
Referenced by checkActionPermissions().
|
private |
Check various permission hooks.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2264 of file Title.php.
References resultToError().
|
private |
Permissions checks that fail most often, and which are easiest to test.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2163 of file Title.php.
References User\groupHasPermission(), isTalkPage(), missingPermissionError(), NS_CATEGORY, and NS_FILE.
|
private |
Check that the user is allowed to read this page.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2591 of file Title.php.
References $wgWhitelistRead, $wgWhitelistReadRegexp, getDBkey(), getNamespace(), getPrefixedDBkey(), getPrefixedText(), User\isEveryoneAllowed(), isSpecial(), isSpecialPage(), list, missingPermissionError(), NS_MAIN, and SpecialPageFactory\resolveAlias().
|
private |
Check permissions on special pages & namespaces.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2301 of file Title.php.
References getNsText(), isNamespaceProtected(), isSpecialPage(), NS_MAIN, and wfMessage().
|
private |
Check that the user isn't blocked from editing.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2546 of file Title.php.
References $wgBlockDisablesLogin, $wgEmailConfirmToEdit, and RequestContext\getMain().
|
private |
Check CSS/JSON/JS sub-page permissions.
string | $action | The action to check |
User | $user | User to check |
array | $errors | List of current errors |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
bool | $short | Short circuit on first error |
Definition at line 2330 of file Title.php.
References isUserCssConfigPage(), isUserJsConfigPage(), and isUserJsonConfigPage().
|
static |
Text form (spaces not underscores) of the main part.
Definition at line 3579 of file Title.php.
References HashBagOStuff\clear().
|
static |
|
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.
string | $byteClass |
Definition at line 637 of file Title.php.
References $out.
Title::countAuthorsBetween | ( | $old, | |
$new, | |||
$limit, | |||
$options = [] ) |
Get the number of authors between the given revisions or revision IDs.
Used for diffs and other things that really need it.
int | Revision | $old | Old revision or rev ID (first before range by default) |
int | Revision | $new | New revision or rev ID (first after range by default) |
int | $limit | Maximum 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. |
Definition at line 4516 of file Title.php.
References $options, and getAuthorsBetween().
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.
int | Revision | $old | Old revision or rev ID (first before range) |
int | Revision | $new | New revision or rev ID (first after range) |
int | null | $max | Limit of Revisions to count, will be incremented to detect truncations |
Definition at line 4398 of file Title.php.
References $dbr, DB_REPLICA, getArticleID(), and wfGetDB().
Title::createFragmentTarget | ( | $fragment | ) |
Creates a new Title for a different fragment of the same page.
string | $fragment |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1570 of file Title.php.
References getInterwiki(), getNamespace(), and getText().
Title::deleteTitleProtection | ( | ) |
Remove any title protection due to page existing.
Definition at line 2865 of file Title.php.
References DB_MASTER, getDBkey(), getNamespace(), and wfGetDB().
Title::equals | ( | Title | $title | ) |
Compare with another title.
Title | $title |
Definition at line 4527 of file Title.php.
References getDBkey(), getInterwiki(), and getNamespace().
Referenced by getLocalURL(), and isMainPage().
|
static |
Escape a text fragment, say from a link, for a URL.
string | $fragment | Containing a URL or link fragment (after the "#") |
Definition at line 769 of file Title.php.
References wfDeprecated().
Title::estimateRevisionCount | ( | ) |
Get the approximate revision count of this page.
Definition at line 4375 of file Title.php.
References $dbr, DB_REPLICA, exists(), getArticleID(), and wfGetDB().
Title::exists | ( | $flags = 0 | ) |
Check if page exists.
For historical reasons, this function simply checks for the existence of the title in the page table, and will thus return false for interwiki links, special pages and the like. If you want to know if a title can be meaningfully viewed, you should probably call the isKnown() method instead.
int | $flags | An optional bit field; may be Title::GAID_FOR_UPDATE to check from master/for update |
Definition at line 4557 of file Title.php.
References getArticleID().
Referenced by checkActionPermissions(), ApiUploadTestCase\deleteFileByTitle(), estimateRevisionCount(), getRestrictionTypes(), getTitleProtectionInternal(), SpecialUpload\getUploadForm(), hasSourceText(), isKnown(), and EditPage\showCustomIntro().
Title::fixSpecialName | ( | ) |
If the Title refers to a special page alias which is not the local default, resolve the alias, and localise the name as necessary.
Otherwise, return $this
Definition at line 1139 of file Title.php.
References SpecialPageFactory\getLocalNameFor(), isSpecialPage(), list, NS_SPECIAL, and SpecialPageFactory\resolveAlias().
|
staticprivate |
Helper to fix up the get{Canonical,Full,Link,Local,Internal}URL args get{Canonical,Full,Link,Local,Internal}URL methods accepted an optional second argument named variant.
This was deprecated in favor of passing an array of option with a "variant" key Once $query2 is removed for good, this helper can be dropped and the wfArrayToCgi moved to getLocalURL();
array | string | $query | |
string | string[] | bool | $query2 |
Definition at line 1804 of file Title.php.
References $query, wfArrayToCgi(), and wfDeprecated().
Title::flushRestrictions | ( | ) |
Title::getAllRestrictions | ( | ) |
Accessor/initialisation for mRestrictions.
Definition at line 3107 of file Title.php.
References loadRestrictions().
Title::getArticleID | ( | $flags = 0 | ) |
Get the article ID for this Title from the link cache, adding it if necessary.
int | $flags | A bit field; may be Title::GAID_FOR_UPDATE to select for update |
Definition at line 3436 of file Title.php.
References getNamespace().
Referenced by MergeHistoryPager\__construct(), countRevisionsBetween(), estimateRevisionCount(), exists(), getAuthorsBetween(), getBrokenLinksFrom(), getContentModel(), getFirstRevision(), getLatestRevID(), getLength(), getLinksFrom(), getParentCategories(), getRelativeRevisionID(), isBigDeletion(), isRedirect(), loadRestrictions(), loadRestrictionsFromRows(), NamespaceConflictChecker\mergePage(), and RecentChange\newForCategorization().
Title::getAuthorsBetween | ( | $old, | |
$new, | |||
$limit, | |||
$options = [] ) |
Get the authors between the given revisions or revision IDs.
Used for diffs and other things that really need it.
int | Revision | $old | Old revision or rev ID (first before range by default) |
int | Revision | $new | New revision or rev ID (first after range by default) |
int | $limit | Maximum 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. |
Definition at line 4441 of file Title.php.
References $dbr, $options, $revQuery, array(), DB_REPLICA, getArticleID(), and wfGetDB().
Referenced by countAuthorsBetween().
Title::getBacklinkCache | ( | ) |
Get a backlink cache object.
Definition at line 4887 of file Title.php.
References BacklinkCache\get().
Title::getBaseText | ( | ) |
Get the base page name without a namespace, i.e.
the part before the subpage name
Definition at line 1704 of file Title.php.
References getText().
Referenced by getBaseTitle().
Title::getBaseTitle | ( | ) |
Get the base page name title, i.e.
the part before the subpage name
Definition at line 1729 of file Title.php.
References getBaseText(), and getNamespace().
Title::getBrokenLinksFrom | ( | ) |
Get an array of Title objects referring to non-existent articles linked from this page.
Definition at line 3788 of file Title.php.
References $dbr, $res, DB_REPLICA, getArticleID(), and wfGetDB().
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
string | $query | |
string | bool | $query2 |
Definition at line 2058 of file Title.php.
References $query, getFragmentForURL(), getLocalURL(), PROTO_CANONICAL, and wfExpandUrl().
Title::getCascadeProtectionSources | ( | $getPages = true | ) |
Cascading protection: Get the source of any cascading restrictions on this page.
bool | $getPages | Whether or not to retrieve the actual pages that the restrictions have come from and the actual restrictions themselves. |
Definition at line 2992 of file Title.php.
References $dbr, $res, $tables, DB_REPLICA, getDBkey(), getNamespace(), NS_FILE, wfGetDB(), and wfTimestampNow().
Referenced by checkCascadingSourcesRestrictions(), and isCascadeProtected().
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.
string | $prefix | The prefix to be used, specified using {{defaultsort:}} or like [[Category:Foo|prefix]]. Empty for no prefix. |
Definition at line 4916 of file Title.php.
References getText().
Title::getCdnUrls | ( | ) |
Get a list of URLs to purge from the CDN cache when this page changes.
Definition at line 3824 of file Title.php.
References $urls, getInternalURL(), getPageLanguage(), isUserCssConfigPage(), isUserJsConfigPage(), and isUserJsonConfigPage().
Referenced by getSquidURLs(), and purgeSquid().
Title::getContentModel | ( | $flags = 0 | ) |
Get the page's content model id, see the CONTENT_MODEL_XXX constants.
int | $flags | A bit field; may be Title::GAID_FOR_UPDATE to select for update |
Definition at line 980 of file Title.php.
References article, and getArticleID().
Title::getDBkey | ( | ) |
Get the main part with underscores.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 947 of file Title.php.
Referenced by LinksUpdateTest\assertRecentChangeByCategorization(), checkReadPermissions(), deleteTitleProtection(), equals(), DoubleRedirectJob\fixRedirects(), getCascadeProtectionSources(), getEditNotices(), getLinksTo(), getLocalURL(), getRedirectsHere(), getSubjectPage(), getSubpages(), getTalkPage(), getTitleProtectionInternal(), getTitleValue(), isAlwaysKnown(), isDeleted(), isDeletedQuick(), isSingleRevRedirect(), isSpecial(), isSubpageOf(), isValid(), moveSubpages(), RefreshLinks\refreshCategory(), SpecialWhatLinksHere\showIndirectLinks(), and MessageCache\updateMessageOverride().
|
private |
Returns the page language code saved in the database, if $wgPageLanguageUseDB is set to true in LocalSettings.php, otherwise returns false.
If there is no language saved in the db, it will return NULL.
Definition at line 4942 of file Title.php.
References $wgPageLanguageUseDB.
Referenced by getPageLanguage(), and getPageViewLanguage().
Title::getDefaultMessageText | ( | ) |
Get the default message text or false if the message doesn't exist.
Definition at line 4667 of file Title.php.
References $lang, $wgContLang, getNamespace(), list, MessageCache\singleton(), and wfMessage().
Title::getDefaultNamespace | ( | ) |
Get the default namespace index, for when there is no namespace.
Definition at line 1506 of file Title.php.
Referenced by secureAndSplit().
Title::getEarliestRevTime | ( | $flags = 0 | ) |
Get the oldest revision timestamp of this page.
int | $flags | Title::GAID_FOR_UPDATE |
Definition at line 4326 of file Title.php.
References $rev, and getFirstRevision().
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.
int | $oldid | Revision ID that's being edited |
Definition at line 5046 of file Title.php.
References $html, getDBkey(), getNamespace(), and wfMessage().
Title::getEditURL | ( | ) |
Get the edit URL for this Title.
Definition at line 2072 of file Title.php.
References $s, getLocalURL(), and isExternal().
|
static |
Get a filtered list of all restriction types supported by this wiki.
bool | $exists | True 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 |
Definition at line 2750 of file Title.php.
References $wgRestrictionTypes.
Title::getFirstRevision | ( | $flags = 0 | ) |
Get the first revision of the page.
int | $flags | Title::GAID_FOR_UPDATE |
Definition at line 4299 of file Title.php.
References $revQuery, DB_MASTER, DB_REPLICA, getArticleID(), and wfGetDB().
Referenced by getEarliestRevTime().
Title::getFragment | ( | ) |
Get the Title fragment (i.e.
\ the bit after the #) in text form
Use Title::hasFragment to check for a fragment
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1517 of file Title.php.
Referenced by getFragmentForURL(), getFullText(), and getTitleValue().
Title::getFragmentForURL | ( | ) |
Get the fragment in URL form, including the "#" character if there is one.
Definition at line 1536 of file Title.php.
References getFragment(), hasFragment(), isExternal(), and isLocal().
Referenced by getCanonicalURL(), getFullURL(), and getLinkURL().
Title::getFullText | ( | ) |
Get the prefixed title with spaces, plus any fragment (part beginning with '#')
Definition at line 1649 of file Title.php.
References getFragment(), getPrefixedText(), and hasFragment().
Referenced by getParentCategories(), TitleBlacklistHooks\onMovePageCheckPermissions(), and WikitextContent\updateRedirect().
Title::getFullURL | ( | $query = '', | |
$query2 = false, | |||
$proto = PROTO_RELATIVE ) |
Get a real URL referring to this title, with interwiki link and fragment.
string | string[] | $query | |
string | string[] | bool | $query2 | |
string | int | null | $proto | Protocol type to use in URL |
Definition at line 1842 of file Title.php.
References $query, getFragmentForURL(), getLocalURL(), and wfExpandUrl().
Referenced by getLinkURL().
Title::getFullUrlForRedirect | ( | $query = '', | |
$proto = PROTO_CURRENT ) |
Get a url appropriate for making redirects based on an untrusted url arg.
This is basically the same as getFullUrl(), but in the case of external interwikis, we send the user to a landing page, to prevent possible phishing attacks and the like.
array | string | $query | |
string | $proto | Protocol type to use in URL |
Definition at line 1877 of file Title.php.
References $query, getPrefixedDBkey(), and isExternal().
Title::getInternalURL | ( | $query = '', | |
$query2 = false ) |
Get the URL form for an internal link.
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://
string | $query | |
string | bool | $query2 |
Definition at line 2034 of file Title.php.
References $query, $wgInternalServer, $wgServer, getLocalURL(), PROTO_HTTP, and wfExpandUrl().
Referenced by getCdnUrls().
Title::getInterwiki | ( | ) |
Get the interwiki prefix.
Use Title::isExternal to check if a interwiki is set
Implements MediaWiki\Linker\LinkTarget.
Definition at line 857 of file Title.php.
Referenced by createFragmentTarget(), equals(), getRedirectsHere(), getTitleValue(), and isSubpageOf().
|
staticprivate |
B/C kludge: provide an InterwikiLookup for use by Title.
Ideally, Title would have no methods that need this. Avoid usage of this singleton by using TitleValue and the associated services when possible.
Title::getLatestRevID | ( | $flags = 0 | ) |
What is the page_latest field for this page?
int | $flags | A bit field; may be Title::GAID_FOR_UPDATE to select for update |
Definition at line 3525 of file Title.php.
References article, and getArticleID().
Title::getLength | ( | $flags = 0 | ) |
What is the length of this page? Uses link cache, adding it if necessary.
int | $flags | A bit field; may be Title::GAID_FOR_UPDATE to select for update |
Definition at line 3497 of file Title.php.
References article, and getArticleID().
Title::getLinksFrom | ( | $options = [], | |
$table = 'pagelinks', | |||
$prefix = 'pl' ) |
Get an array of Title objects linked from this Title Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
array | $options | Query option to Database::select() |
string | $table | Table name |
string | $prefix | Fields prefix |
Definition at line 3722 of file Title.php.
References $options, $res, DB_REPLICA, getArticleID(), and wfGetDB().
Referenced by getTemplateLinksFrom().
Title::getLinksTo | ( | $options = [], | |
$table = 'pagelinks', | |||
$prefix = 'pl' ) |
Get an array of Title objects linking to this Title Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
array | $options | May be FOR UPDATE |
string | $table | Table name |
string | $prefix | Fields prefix |
Definition at line 3664 of file Title.php.
References $options, $res, DB_MASTER, DB_REPLICA, getDBkey(), getNamespace(), and wfGetDB().
Referenced by getTemplateLinksTo().
Title::getLinkURL | ( | $query = '', | |
$query2 = false, | |||
$proto = false ) |
Get a URL that's the simplest URL that will be valid to link, locally, to the current Title.
It includes the fragment, but does not include the server unless action=render is used (or the link is external). If there's a fragment but the prefixed text is empty, we just return a link to the fragment.
The result obviously should not be URL-escaped, but does need to be HTML-escaped if it's being output in HTML.
string | string[] | $query | |
bool | $query2 | |
string | int | bool | $proto | A PROTO_* constant on how the URL should be expanded, or false (default) for no expansion |
Definition at line 2009 of file Title.php.
References $query, $ret, getFragmentForURL(), getFullURL(), getLocalURL(), getPrefixedText(), hasFragment(), and isExternal().
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.
string | string[] | $query | An optional query string, not used for interwiki links. Can be specified as an associative array as well, e.g., array( 'action' => 'edit' ) (keys and values will be URL-escaped). Some query patterns will trigger various shorturl path replacements. |
string | string[] | bool | $query2 | An optional secondary query array. This one MUST be an array. If a string is passed it will be interpreted as a deprecated variant argument and urlencoded into a variant= argument. This second query argument will be added to the $query The second parameter is deprecated since 1.19. Pass it as a key,value pair in the first parameter array instead. |
Definition at line 1911 of file Title.php.
References $matches, $query, $wgActionPaths, $wgArticlePath, $wgContLang, $wgRequest, $wgScript, $wgServer, $wgVariantArticlePath, equals(), getDBkey(), getNsText(), getPageLanguage(), getPrefixedDBkey(), wfAppendQuery(), and wfUrlencode().
Referenced by getCanonicalURL(), getEditURL(), getFullURL(), getInternalURL(), and getLinkURL().
Title::getNamespace | ( | ) |
Get the namespace index, i.e.
one of the NS_xxxx constants.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 970 of file Title.php.
Referenced by SubpageImportTitleFactory\__construct(), checkReadPermissions(), createFragmentTarget(), deleteTitleProtection(), equals(), DoubleRedirectJob\fixRedirects(), getArticleID(), getBaseTitle(), getCascadeProtectionSources(), getDefaultMessageText(), getEditNotices(), getLinksTo(), getNamespaceKey(), getRedirectsHere(), getRestrictionTypes(), getRootTitle(), getSubjectPage(), getSubpage(), getSubpages(), getTalkPage(), getTitleProtectionInternal(), getTitleValue(), hasSubjectNamespace(), inNamespace(), isContentPage(), isConversionTable(), isDeleted(), isDeletedQuick(), isMovable(), isSingleRevRedirect(), isSpecialPage(), isSubpageOf(), isTalkPage(), isValid(), isWatchable(), moveSubpages(), ImageQueryPage\outputResults(), MovePageForm\showForm(), SpecialWhatLinksHere\showIndirectLinks(), and touchLinks().
Title::getNamespaceKey | ( | $prepend = 'nstab-' | ) |
Generate strings used for xml 'id' names in monobook tabs.
string | $prepend | Defaults to 'nstab-' |
Definition at line 4798 of file Title.php.
References $wgContLang, getNamespace(), and getSubjectNsText().
Title::getNextRevisionID | ( | $revId, | |
$flags = 0 ) |
Get the revision ID of the next revision.
int | $revId | Revision ID. Get the revision that was after this one. |
int | $flags | Title::GAID_FOR_UPDATE |
Definition at line 4289 of file Title.php.
References getRelativeRevisionID().
Title::getNotificationTimestamp | ( | $user = null | ) |
Title::getNsText | ( | ) |
Get the namespace text.
Definition at line 1028 of file Title.php.
References isExternal(), and wfDebug().
Referenced by checkActionPermissions(), checkSpecialsAndNSPermissions(), getLocalURL(), and prefix().
Title::getOtherPage | ( | ) |
Get the other title for this page, if this is a subject page get the talk page, if it is a subject page get the talk page.
MWException | If the page doesn't have an other page |
Definition at line 1487 of file Title.php.
References canHaveTalkPage(), getSubjectPage(), getTalkPage(), isSpecialPage(), and isTalkPage().
Title::getPageLanguage | ( | ) |
Get the language in which the content of this page is written in wikitext.
Defaults to $wgContLang, but in certain cases it can be e.g. $wgLang (such as special pages, which are in the user language).
Definition at line 4964 of file Title.php.
References $wgLang, $wgLanguageCode, getDbPageLanguageCode(), isSpecialPage(), and wfGetLangObj().
Referenced by getCdnUrls(), and getLocalURL().
Title::getPageViewLanguage | ( | ) |
Get the language in which the content of this page is written when viewed by user.
Defaults to $wgContLang, but in certain cases it can be e.g. $wgLang (such as special pages, which are in the user language).
Definition at line 5002 of file Title.php.
References $wgLang, getDbPageLanguageCode(), isSpecialPage(), and wfGetLangObj().
Title::getParentCategories | ( | ) |
Get categories to which this Title belongs and return an array of categories' names.
Definition at line 4144 of file Title.php.
References $dbr, $res, $wgContLang, DB_REPLICA, getArticleID(), getFullText(), NS_CATEGORY, and wfGetDB().
Referenced by getParentCategoryTree().
Title::getParentCategoryTree | ( | $children = [] | ) |
Get a tree of parent categories.
array | $children | Array with the children in the keys, to check for circular refs |
Definition at line 4179 of file Title.php.
References getParentCategories().
Title::getPartialURL | ( | ) |
Title::getPrefixedDBkey | ( | ) |
Get the prefixed database key form.
Definition at line 1613 of file Title.php.
Referenced by checkReadPermissions(), DoubleRedirectJob\fixRedirects(), getFullUrlForRedirect(), and getLocalURL().
Title::getPrefixedText | ( | ) |
Get the prefixed title with spaces.
This is the form usually used for display
Definition at line 1625 of file Title.php.
Referenced by __toString(), checkReadPermissions(), getFullText(), getLinkURL(), getRestrictionTypes(), getTitleValue(), CapsCleanup\movePage(), SpecialChangeContentModel\setParameter(), MovePageForm\showForm(), SpecialWhatLinksHere\whatlinkshereForm(), and SpecialWhatLinksHere\wlhLink().
Title::getPrefixedURL | ( | ) |
Get a URL-encoded title (not an actual URL) including interwiki.
Definition at line 1785 of file Title.php.
References $s, prefix(), and wfUrlencode().
Title::getPreviousRevisionID | ( | $revId, | |
$flags = 0 ) |
Get the revision ID of the previous revision.
int | $revId | Revision ID. Get the revision that was before this one. |
int | $flags | Title::GAID_FOR_UPDATE |
Definition at line 4278 of file Title.php.
References getRelativeRevisionID().
Title::getRedirectsHere | ( | $ns = null | ) |
Get all extant redirects to this Title.
int | null | $ns | Single namespace to consider; null to consider all namespaces |
Definition at line 4827 of file Title.php.
References $dbr, $res, DB_REPLICA, getDBkey(), getInterwiki(), getNamespace(), isExternal(), and wfGetDB().
|
private |
Get next/previous revision ID relative to another revision ID.
int | $revId | Revision ID. Get the revision that was before this one. |
int | $flags | Title::GAID_FOR_UPDATE |
string | $dir | 'next' or 'prev' |
Definition at line 4222 of file Title.php.
References $sort, DB_MASTER, DB_REPLICA, getArticleID(), and wfGetDB().
Referenced by getNextRevisionID(), and getPreviousRevisionID().
Title::getRestrictionExpiry | ( | $action | ) |
Get the expiry time for the restriction against a given action.
string | $action |
Definition at line 3121 of file Title.php.
References loadRestrictions().
Title::getRestrictions | ( | $action | ) |
Accessor/initialisation for mRestrictions.
string | $action | Action that permission needs to be checked for |
Definition at line 3091 of file Title.php.
References loadRestrictions().
Referenced by checkPageRestrictions(), isProtected(), and isSemiProtected().
Title::getRestrictionTypes | ( | ) |
Returns restriction types for the current Title.
Definition at line 2768 of file Title.php.
References exists(), getNamespace(), getPrefixedText(), isSpecialPage(), NS_FILE, and wfDebug().
Referenced by isProtected(), and loadRestrictionsFromRows().
Title::getRootText | ( | ) |
Get the root page name text without a namespace, i.e.
the leftmost part before any slashes
Definition at line 1669 of file Title.php.
References getText().
Referenced by getRootTitle().
Title::getRootTitle | ( | ) |
Get the root page name title, i.e.
the leftmost part before any slashes
Definition at line 1689 of file Title.php.
References getNamespace(), and getRootText().
|
staticprotected |
Returns a list of fields that are to be selected for initializing Title objects or LinkCache entries.
Uses $wgContentHandlerUseDB to determine whether to include page_content_model.
Definition at line 390 of file Title.php.
References $wgContentHandlerUseDB, and $wgPageLanguageUseDB.
Title::getSkinFromConfigSubpage | ( | ) |
Trim down a .css, .json, or .js subpage title to get the corresponding skin name.
Definition at line 1350 of file Title.php.
Referenced by getSkinFromCssJsSubpage().
Title::getSkinFromCssJsSubpage | ( | ) |
Definition at line 1364 of file Title.php.
References getSkinFromConfigSubpage(), and wfDeprecated().
Title::getSquidURLs | ( | ) |
Definition at line 3854 of file Title.php.
References getCdnUrls().
Title::getSubjectNsText | ( | ) |
Get the namespace text of the subject (rather than talk) page.
Definition at line 1052 of file Title.php.
References $wgContLang.
Referenced by getNamespaceKey().
Title::getSubjectPage | ( | ) |
Get a title object associated with the subject page of this talk page.
Definition at line 1470 of file Title.php.
References getDBkey(), and getNamespace().
Referenced by getOtherPage().
Title::getSubpage | ( | $text | ) |
Get the title for a subpage of the current page.
string | $text | The subpage name to add to the title |
Definition at line 1765 of file Title.php.
References getNamespace(), and getText().
Title::getSubpages | ( | $limit = -1 | ) |
Get all subpages of this page.
int | $limit | Maximum number of subpages to fetch; -1 for no limit |
Definition at line 3358 of file Title.php.
References $dbr, $options, DB_REPLICA, getDBkey(), getNamespace(), TitleArray\newFromResult(), and wfGetDB().
Referenced by hasSubpages(), and moveSubpages().
Title::getSubpageText | ( | ) |
Get the lowest-level subpage name, i.e.
the rightmost part after any slashes
Definition at line 1744 of file Title.php.
Referenced by getSubpageUrlForm().
Title::getSubpageUrlForm | ( | ) |
Get a URL-encoded form of the subpage text.
Definition at line 1774 of file Title.php.
References getSubpageText(), and wfUrlencode().
Title::getTalkNsText | ( | ) |
Get the namespace text of the talk page.
Definition at line 1062 of file Title.php.
References $wgContLang.
Title::getTalkPage | ( | ) |
Get a Title object associated with the talk page of this article.
Definition at line 1443 of file Title.php.
References getDBkey(), and getNamespace().
Referenced by getOtherPage(), and getTalkPageIfDefined().
Title::getTalkPageIfDefined | ( | ) |
Get a Title object associated with the talk page of this article, if such a talk page can exist.
Definition at line 1456 of file Title.php.
References canHaveTalkPage(), and getTalkPage().
Title::getTemplateLinksFrom | ( | $options = [] | ) |
Get an array of Title objects used on this Title as a template Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
array | $options | May be FOR UPDATE |
Definition at line 3776 of file Title.php.
References $options, and getLinksFrom().
Title::getTemplateLinksTo | ( | $options = [] | ) |
Get an array of Title objects using this Title as a template Also stores the IDs in the link cache.
WARNING: do not use this function on arbitrary user-supplied titles! On heavily-used templates it will max out the memory.
array | $options | Query option to Database::select() |
Definition at line 3706 of file Title.php.
References $options, and getLinksTo().
Title::getText | ( | ) |
Get the text form (spaces not underscores) of the main part.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 929 of file Title.php.
Referenced by createFragmentTarget(), getBaseText(), getCategorySortkey(), getRootText(), getSubpage(), isConversionTable(), isSubpage(), and MovePageForm\showForm().
|
staticprivate |
|
staticprivate |
B/C kludge: provide a TitleParser for use by Title.
Ideally, Title would have no methods that need this. Avoid usage of this singleton by using TitleValue and the associated services when possible.
Title::getTitleProtection | ( | ) |
Is this title subject to title protection? Title protection is the one applied against creation of such title.
Definition at line 2795 of file Title.php.
References getTitleProtectionInternal().
Referenced by checkActionPermissions().
|
protected |
Fetch title protection settings.
To work correctly, $this->loadRestrictions() needs to have access to the actual protections in the database without munging 'sysop' => 'editprotected' and 'autoconfirmed' => 'editsemiprotected'. Other callers probably want $this->getTitleProtection() instead.
Definition at line 2818 of file Title.php.
References $dbr, $res, DB_REPLICA, exists(), getDBkey(), getNamespace(), and wfGetDB().
Referenced by getTitleProtection(), and loadRestrictions().
Title::getTitleValue | ( | ) |
Get a TitleValue object representing this Title.
Definition at line 906 of file Title.php.
References getDBkey(), getFragment(), getInterwiki(), getNamespace(), getPrefixedText(), and wfDebug().
Title::getTouched | ( | $db = null | ) |
Get the last touched timestamp.
IDatabase | null | $db |
Definition at line 4746 of file Title.php.
References DB_REPLICA, pageCond(), and wfGetDB().
Title::getTransWikiID | ( | ) |
Returns the DB name of the distant wiki which owns the object.
Definition at line 889 of file Title.php.
References isExternal().
Title::getUserCaseDBKey | ( | ) |
Title::getUserPermissionsErrors | ( | $action, | |
$user, | |||
$rigor = 'secure', | |||
$ignoreErrors = [] ) |
Can $user perform $action on this page?
string | $action | Action that permission needs to be checked for |
User | $user | User to check |
string | $rigor | One of (quick,full,secure)
|
array | $ignoreErrors | Array of Strings Set this to a list of message keys whose corresponding errors may be ignored. |
Definition at line 2132 of file Title.php.
References getUserPermissionsErrorsInternal().
|
protected |
Can $user perform $action on this page? This is an internal function, with multiple levels of checks depending on performance needs; see $rigor below.
It does not check wfReadOnly().
string | $action | Action that permission needs to be checked for |
User | $user | User to check |
string | $rigor | One of (quick,full,secure)
|
bool | $short | Set this to true to stop after the first permission error. |
Definition at line 2689 of file Title.php.
Referenced by checkActionPermissions(), getUserPermissionsErrors(), and userCan().
Title::hasContentModel | ( | $id | ) |
Convenience method for checking a title's content model name.
string | $id | The content model ID (use the CONTENT_MODEL_XXX constants). |
Definition at line 1003 of file Title.php.
Referenced by isCssJsSubpage(), isCssOrJsPage(), isSiteConfigPage(), isUserConfigPage(), isUserCssConfigPage(), isUserJsConfigPage(), isUserJsonConfigPage(), and isWikitextPage().
Title::hasFragment | ( | ) |
Check if a Title fragment is set.
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1527 of file Title.php.
Referenced by CoreParserFunctions\displaytitle(), getFragmentForURL(), getFullText(), and getLinkURL().
Title::hasSourceText | ( | ) |
Does this page have source text?
Definition at line 4641 of file Title.php.
References $wgContLang, exists(), list, MessageCache\singleton(), and wfMessage().
Referenced by isAlwaysKnown().
Title::hasSubjectNamespace | ( | $ns | ) |
Returns true if the title has the same subject namespace as the namespace specified.
For example this method will take NS_USER and return true if namespace is either NS_USER or NS_USER_TALK since both of them have NS_USER as their subject namespace.
This is MUCH simpler than individually testing for equivalence against both NS_USER and NS_USER_TALK, and is also forward compatible.
int | $ns |
Definition at line 1201 of file Title.php.
References getNamespace().
Title::hasSubpages | ( | ) |
Does this have subpages? (Warning, usually requires an extra DB query.)
Definition at line 3330 of file Title.php.
References getSubpages().
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.
int | $ns | The namespace |
Implements MediaWiki\Linker\LinkTarget.
Definition at line 1162 of file Title.php.
References getNamespace().
Referenced by inNamespaces().
Title::inNamespaces | ( | ) |
Returns true if the title is inside one of the specified namespaces.
int | int[] | $namespaces,... | The namespaces to check for |
Definition at line 1173 of file Title.php.
References $namespaces, and inNamespace().
Title::invalidateCache | ( | $purgeTime = null | ) |
Updates page_touched for this page; called from LinksUpdate.php.
string | $purgeTime | [optional] TS_MW timestamp |
Definition at line 4692 of file Title.php.
References $fname, Wikimedia\Rdbms\IDatabase\addQuotes(), DB_MASTER, ResourceLoaderWikiModule\invalidateModuleCache(), pageCond(), Wikimedia\Rdbms\IDatabase\timestamp(), Wikimedia\Rdbms\IDatabase\update(), wfGetDB(), wfReadOnly(), and wfWikiID().
Title::isAlwaysKnown | ( | ) |
Should links to this title be shown as potentially viewable (i.e.
as "bluelinks"), even if there's no record by this title in the page table?
This function is semi-deprecated for public use, as well as somewhat misleadingly named. You probably just want to call isKnown(), which calls this function internally.
(ISSUE: Most of these checks are cheap, but the file existence check can potentially be quite expensive. Including it here fixes a lot of existing code, but we might want to add an optional parameter to skip it and any other expensive checks.)
Definition at line 4579 of file Title.php.
References SpecialPageFactory\exists(), getDBkey(), hasSourceText(), isExternal(), NS_FILE, NS_MAIN, NS_MEDIA, NS_MEDIAWIKI, NS_SPECIAL, and wfFindFile().
Referenced by isKnown().
Title::isBigDeletion | ( | ) |
Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit.
Definition at line 4346 of file Title.php.
References $dbr, $wgDeleteRevisionsLimit, DB_REPLICA, getArticleID(), and wfGetDB().
Referenced by checkActionPermissions().
Title::isCascadeProtected | ( | ) |
Cascading protection: Return true if cascading restrictions apply to this page, false if not.
Definition at line 2961 of file Title.php.
References getCascadeProtectionSources(), and list.
Title::isContentPage | ( | ) |
Is this Title in a namespace which contains content? In other words, is this a content page, for the purposes of calculating statistics, etc?
Definition at line 1212 of file Title.php.
References getNamespace().
Title::isConversionTable | ( | ) |
Is this a conversion table for the LanguageConverter?
Definition at line 1263 of file Title.php.
References getNamespace(), and getText().
Title::isCssJsSubpage | ( | ) |
Definition at line 1337 of file Title.php.
References CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, hasContentModel(), isSubpage(), and wfDeprecated().
Title::isCssOrJsPage | ( | ) |
Definition at line 1308 of file Title.php.
References CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, hasContentModel(), and wfDeprecated().
Title::isCssSubpage | ( | ) |
Definition at line 1387 of file Title.php.
References isUserCssConfigPage(), and wfDeprecated().
Title::isDeleted | ( | ) |
Is there a version of this page in the deletion archive?
Definition at line 3385 of file Title.php.
References $dbr, DB_REPLICA, getDBkey(), getNamespace(), NS_FILE, and wfGetDB().
Title::isDeletedQuick | ( | ) |
Is there a version of this page in the deletion archive?
Definition at line 3410 of file Title.php.
References $dbr, DB_REPLICA, getDBkey(), getNamespace(), NS_FILE, and wfGetDB().
Title::isExternal | ( | ) |
Is this Title interwiki?
Implements MediaWiki\Linker\LinkTarget.
Definition at line 846 of file Title.php.
Referenced by getEditURL(), getFragmentForURL(), getFullUrlForRedirect(), getLinkURL(), getNsText(), getRedirectsHere(), getTransWikiID(), isAlwaysKnown(), isLocal(), isMovable(), isTrans(), isWatchable(), prefix(), and secureAndSplit().
Title::isJsSubpage | ( | ) |
Definition at line 1424 of file Title.php.
References isUserJsConfigPage(), and wfDeprecated().
Title::isKnown | ( | ) |
Does this title refer to a page that can (or might) be meaningfully viewed? In particular, this function may be used to determine if links to the title should be rendered as "bluelinks" (as opposed to "redlinks" to non-existent pages).
Adding something else to this function will cause inconsistency since LinkHolderArray calls isAlwaysKnown() and does its own page existence check.
Definition at line 4632 of file Title.php.
References exists(), and isAlwaysKnown().
Title::isLocal | ( | ) |
Determine whether the object refers to a page within this project (either this wiki or a wiki with a local interwiki, see https://www.mediawiki.org/wiki/Manual:Interwiki_table#iw_local )
Definition at line 831 of file Title.php.
References isExternal().
Referenced by getFragmentForURL().
Title::isMainPage | ( | ) |
Is this the mainpage?
Definition at line 1243 of file Title.php.
References equals().
Title::isMovable | ( | ) |
Would anybody with sufficient privileges be able to move this page? Some pages just aren't movable.
Definition at line 1222 of file Title.php.
References $result, getNamespace(), and isExternal().
Referenced by checkActionPermissions().
Title::isNamespaceProtected | ( | User | $user | ) |
Determines if $user is unable to edit this page because it has been protected by $wgNamespaceProtection.
Definition at line 2943 of file Title.php.
References $wgNamespaceProtection.
Referenced by checkSpecialsAndNSPermissions().
Title::isNewPage | ( | ) |
Check if this is a new page.
Definition at line 4336 of file Title.php.
References $dbr, DB_REPLICA, pageCond(), and wfGetDB().
Title::isProtected | ( | $action = '' | ) |
Does the title correspond to a protected article?
string | $action | The action the page is protected from, by default checks all actions. |
Definition at line 2911 of file Title.php.
References $type, $wgRestrictionLevels, getRestrictions(), getRestrictionTypes(), and isSpecialPage().
Title::isRedirect | ( | $flags = 0 | ) |
Is this an article that is a redirect page? Uses link cache, adding it if necessary.
int | $flags | A bit field; may be Title::GAID_FOR_UPDATE to select for update |
Definition at line 3462 of file Title.php.
References article, and getArticleID().
Referenced by CategoryViewer\addSubcategoryObject().
Title::isSemiProtected | ( | $action = 'edit' | ) |
Is this page "semi-protected" - the only protection levels are listed in $wgSemiprotectedRestrictionLevels?
string | $action | Action to check (default: edit) |
Definition at line 2883 of file Title.php.
References $wgSemiprotectedRestrictionLevels, and getRestrictions().
Title::isSingleRevRedirect | ( | ) |
Checks if this page is just a one-rev redirect.
Adds lock, so don't use just for light purposes.
Definition at line 4045 of file Title.php.
References $wgContentHandlerUseDB, DB_MASTER, getDBkey(), getNamespace(), pageCond(), and wfGetDB().
Title::isSiteConfigPage | ( | ) |
Could this MediaWiki namespace page contain custom CSS, JSON, or JavaScript for the global UI.
This is generally true for pages in the MediaWiki namespace having CONTENT_MODEL_CSS, CONTENT_MODEL_JSON, or CONTENT_MODEL_JAVASCRIPT.
This method does not return true for per-user JS/JSON/CSS. Use isUserConfigPage() for that!
Note that this method should not return true for pages that contain and show "inactive" CSS, JSON, or JS.
Definition at line 1293 of file Title.php.
References CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, CONTENT_MODEL_JSON, and hasContentModel().
Title::isSpecial | ( | $name | ) |
Returns true if this title resolves to the named special page.
string | $name | The special page name |
Definition at line 1123 of file Title.php.
References getDBkey(), isSpecialPage(), list, and SpecialPageFactory\resolveAlias().
Referenced by checkReadPermissions(), and isValidRedirectTarget().
Title::isSpecialPage | ( | ) |
Returns true if this is a special page.
Definition at line 1113 of file Title.php.
References getNamespace(), and NS_SPECIAL.
Referenced by SkinTemplate\buildPersonalUrls(), checkReadPermissions(), checkSpecialsAndNSPermissions(), fixSpecialName(), getOtherPage(), getPageLanguage(), getPageViewLanguage(), getRestrictionTypes(), isProtected(), isSpecial(), isValidRedirectTarget(), and secureAndSplit().
Title::isSubpage | ( | ) |
Is this a subpage?
Definition at line 1252 of file Title.php.
References false, and getText().
Referenced by isCssJsSubpage(), isUserConfigPage(), isUserCssConfigPage(), isUserJsConfigPage(), and isUserJsonConfigPage().
Title::isSubpageOf | ( | Title | $title | ) |
Check if this title is a subpage of another title.
Title | $title |
Definition at line 4540 of file Title.php.
References getDBkey(), getInterwiki(), and getNamespace().
Title::isTalkPage | ( | ) |
Is this a talk page of some sort?
Definition at line 1434 of file Title.php.
References getNamespace().
Referenced by checkQuickPermissions(), and getOtherPage().
Title::isTrans | ( | ) |
Determine whether the object refers to a page within this project and is transcludable.
Definition at line 876 of file Title.php.
References isExternal().
Title::isUserConfigPage | ( | ) |
Is this a "config" (.css, .json, or .js) sub-page of a user page?
Definition at line 1321 of file Title.php.
References CONTENT_MODEL_CSS, CONTENT_MODEL_JAVASCRIPT, CONTENT_MODEL_JSON, hasContentModel(), and isSubpage().
Referenced by checkCascadingSourcesRestrictions().
Title::isUserCssConfigPage | ( | ) |
Is this a CSS "config" sub-page of a user page?
Definition at line 1375 of file Title.php.
References CONTENT_MODEL_CSS, hasContentModel(), and isSubpage().
Referenced by checkUserConfigPermissions(), getCdnUrls(), and isCssSubpage().
Title::isUserJsConfigPage | ( | ) |
Is this a JS "config" sub-page of a user page?
Definition at line 1412 of file Title.php.
References CONTENT_MODEL_JAVASCRIPT, hasContentModel(), and isSubpage().
Referenced by checkUserConfigPermissions(), getCdnUrls(), and isJsSubpage().
Title::isUserJsonConfigPage | ( | ) |
Is this a JSON "config" sub-page of a user page?
Definition at line 1398 of file Title.php.
References CONTENT_MODEL_JSON, hasContentModel(), and isSubpage().
Referenced by checkUserConfigPermissions(), and getCdnUrls().
Title::isValid | ( | ) |
Returns true if the title is valid, false if it is invalid.
Valid titles can be round-tripped via makeTitleSafe() and newFromText(). Invalid titles may get returned from makeTitle(), and it may be useful to allow them to exist, e.g. in order to process log entries about pages in namespaces that belong to extensions that are no longer installed.
Definition at line 808 of file Title.php.
References $parser, getDBkey(), and getNamespace().
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
Title | &$nt | The new title |
bool | $auth | Whether to check user permissions (uses $wgUser) |
string | $reason | Is the log summary of the move, used for spam checking |
Definition at line 3878 of file Title.php.
References $wgUser, and wfMergeErrorArrays().
Referenced by moveTo(), and MovePageForm\showForm().
Title::isValidMoveTarget | ( | $nt | ) |
Checks if $this can be moved to a given Title.
Selects for update, so don't call it unless you mean business
Title | $nt | The new title to check |
Definition at line 4096 of file Title.php.
References $rev, NS_FILE, wfDebug(), and wfLocalFile().
Title::isValidRedirectTarget | ( | ) |
Check if this Title is a valid redirect target.
Definition at line 4863 of file Title.php.
References $wgInvalidRedirectTargets, isSpecial(), and isSpecialPage().
Referenced by AbstractContent\getRedirectChain(), WikitextContent\getRedirectTargetAndText(), and XmlDumpWriter\openPage().
Title::isWatchable | ( | ) |
Can this title be added to a user's watchlist?
Definition at line 1104 of file Title.php.
References getNamespace(), and isExternal().
Referenced by SpecialEditWatchlist\extractTitles().
Title::isWikitextPage | ( | ) |
Does that page contain wikitext, or it is JS, CSS or whatever?
Definition at line 1275 of file Title.php.
References CONTENT_MODEL_WIKITEXT, and hasContentModel().
|
static |
Get a regex character class describing the legal characters in a link.
Definition at line 623 of file Title.php.
References $wgLegalTitleChars.
Title::loadFromRow | ( | $row | ) |
Title::loadRestrictions | ( | $oldFashionedRestrictions = null | ) |
Load restrictions from the page_restrictions table.
string | $oldFashionedRestrictions | Comma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. Edit and move sections are separated by a colon Example: "edit=autoconfirmed,sysop:move=sysop" |
Definition at line 3224 of file Title.php.
References $cache, $dbr, $rows, DB_REPLICA, function, getArticleID(), getTitleProtectionInternal(), loadRestrictionsFromRows(), wfGetDB(), and wfTimestampNow().
Referenced by areRestrictionsCascading(), getAllRestrictions(), getRestrictionExpiry(), and getRestrictions().
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.
array | $rows | Array of db result objects |
string | $oldFashionedRestrictions | Comma-separated set of permission keys indicating who can move or edit the page from the page table, (pre 1.10) rows. Edit and move sections are separated by a colon Example: "edit=autoconfirmed,sysop:move=sysop" |
Definition at line 3152 of file Title.php.
References $dbr, $rows, $type, DB_REPLICA, getArticleID(), getRestrictionTypes(), wfGetDB(), and wfTimestampNow().
Referenced by loadRestrictions().
|
static |
Make a prefixed DB key from a DB key and a namespace index.
int | $ns | Numerical representation of the namespace |
string | $title | The DB key form the title |
string | $fragment | The link fragment (after the "#") |
string | $interwiki | The interwiki prefix |
bool | $canonicalNamespace | If true, use the canonical name for $ns instead of the localized version. |
Definition at line 741 of file Title.php.
References $name, $title, and $wgContLang.
|
static |
Create a new Title from a namespace index and a DB key.
It's assumed that $ns and $title are safe, for instance when they came directly from the database or a special page name, not from user input.
No validation is applied. For convenience, spaces are normalized to underscores, so that e.g. user_text fields can be used directly.
int | $ns | The namespace of the article |
string | $title | The unprefixed database key form |
string | $fragment | The link fragment (after the "#") |
string | $interwiki | The interwiki prefix |
Definition at line 534 of file Title.php.
References $t, and wfUrlencode().
|
static |
Create a new Title from a namespace index and a DB key.
The parameters will be checked for validity, which is a bit slower than makeTitle() but safer for user-provided data.
Title objects returned by makeTitleSafe() are guaranteed to be valid, that is, they return true from the isValid() method. If no valid Title can be constructed from the input, this method returns null.
int | $ns | The namespace of the article |
string | $title | Database key form |
string | $fragment | The link fragment (after the "#") |
string | $interwiki | Interwiki prefix |
Definition at line 562 of file Title.php.
References $t.
|
private |
Get a description array when the user doesn't have the right to perform $action (i.e.
when User::isAllowed() returns false)
string | $action | The action to check |
bool | $short | Short circuit on first error |
Definition at line 2666 of file Title.php.
References User\newFatalPermissionDeniedStatus().
Referenced by checkQuickPermissions(), and checkReadPermissions().
Title::moveSubpages | ( | $nt, | |
$auth = true, | |||
$reason = '', | |||
$createRedirect = true, | |||
array | $changeTags = [] ) |
Move this page's subpages to be subpages of $nt.
Title | $nt | Move target |
bool | $auth | Whether $wgUser's permissions should be checked |
string | $reason | The reason for the move |
bool | $createRedirect | Whether to create redirects from the old subpages to the new ones Ignored if the user doesn't have the 'suppressredirect' right |
array | $changeTags | Applied to the entry in the move log and redirect page revision |
Definition at line 3972 of file Title.php.
References $retval, $success, $wgMaximumMovedPages, StringUtils\escapeRegexReplacement(), getDBkey(), getNamespace(), getSubpages(), and userCan().
Move a title to a new location.
Title | &$nt | The new title |
bool | $auth | Indicates whether $wgUser's permissions should be checked |
string | $reason | The reason for the move |
bool | $createRedirect | Whether to create a redirect from the old title to the new title. Ignored if the user doesn't have the suppressredirect right. |
array | $changeTags | Applied to the entry in the move log and redirect page revision |
Definition at line 3934 of file Title.php.
References $wgUser, and isValidMoveOperation().
|
static |
|
static |
|
static |
Create a new Title from an article ID.
int | $id | The page_id corresponding to the Title to create |
int | $flags | Use Title::GAID_FOR_UPDATE to use master |
Definition at line 416 of file Title.php.
References $title, DB_MASTER, DB_REPLICA, and wfGetDB().
|
static |
|
static |
Create a new Title from a LinkTarget.
LinkTarget | $linkTarget | Assumed to be safe. |
Definition at line 244 of file Title.php.
References MediaWiki\Linker\LinkTarget\getFragment(), MediaWiki\Linker\LinkTarget\getInterwiki(), MediaWiki\Linker\LinkTarget\getNamespace(), and MediaWiki\Linker\LinkTarget\getText().
|
static |
|
static |
Create a new Title from text, such as what one would find in a link.
De- codes any HTML entities in the text.
Title objects returned by this method are guaranteed to be valid, and thus return true from the isValid() method.
string | int | null | $text | The link text; spaces, prefixes, and an initial ':' indicating the main namespace are accepted. |
int | $defaultNamespace | The 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(). |
InvalidArgumentException |
|
static |
Like Title::newFromText(), but throws MalformedTitleException when the title is invalid, rather than returning null.
The exception subclasses encode detailed information about why the title is invalid.
Title objects returned by this method are guaranteed to be valid, and thus return true from the isValid() method.
string | $text | Title text to check |
int | $defaultNamespace |
MalformedTitleException | If the title is invalid |
Definition at line 306 of file Title.php.
References $t, BagOStuff\get(), NS_MAIN, and HashBagOStuff\set().
|
static |
Create a new Title from a TitleValue.
TitleValue | $titleValue | Assumed to be safe. |
|
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.
string | $url | The title, as might be taken from a URL |
Definition at line 353 of file Title.php.
References $t.
|
static |
Title::pageCond | ( | ) |
Get an associative array for selecting this title from the "page" table.
Definition at line 4206 of file Title.php.
Referenced by getTouched(), invalidateCache(), isNewPage(), and isSingleRevRedirect().
|
private |
Prefix some arbitrary text with the namespace or interwiki prefix of this object.
string | $name | The text |
Definition at line 1586 of file Title.php.
References $name, $wgContLang, getNsText(), isExternal(), and NS_SPECIAL.
Referenced by getPrefixedDBkey(), getPrefixedText(), and getPrefixedURL().
|
static |
Purge expired restrictions from the page_restrictions table.
This will purge no more than $wgUpdateRowsPerQuery page_restrictions rows
Definition at line 3289 of file Title.php.
References $fname, Wikimedia\Rdbms\IDatabase\addQuotes(), DB_MASTER, Wikimedia\Rdbms\IDatabase\delete(), Wikimedia\Rdbms\IDatabase\selectFieldValues(), Wikimedia\Rdbms\IDatabase\timestamp(), wfGetDB(), and wfReadOnly().
Title::purgeSquid | ( | ) |
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.
string | $action | Action that permission needs to be checked for |
User | $user | User to check (since 1.19); $wgUser will be used if not provided. |
Definition at line 2095 of file Title.php.
References userCan().
Referenced by MovePageForm\showForm().
Title::resetArticleID | ( | $newid | ) |
This clears some fields in this object, and clears any associated keys in the "bad links" section of the link cache.
int | $newid | The new Article ID |
|
private |
Add the resulting error code to the errors array.
array | $errors | List of current errors |
array | $result | Result of errors |
Definition at line 2233 of file Title.php.
References $result.
Referenced by checkPermissionHooks().
|
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.
MalformedTitleException | On invalid titles |
Definition at line 3616 of file Title.php.
References getDefaultNamespace(), isExternal(), isSpecialPage(), NS_MAIN, setFragment(), and wfUrlencode().
Title::setContentModel | ( | $model | ) |
Set a proposed content model for the page for permissions checking.
This does not actually change the content model of a title!
Additionally, you should make sure you've checked ContentHandler::canBeUsedOn() first.
string | $model | CONTENT_MODEL_XXX constant |
Definition at line 1018 of file Title.php.
Referenced by EditPage\internalAttemptSave(), and SpecialChangeContentModel\onSubmit().
Title::setFragment | ( | $fragment | ) |
Set the fragment for this title.
Removes the first character from the specified fragment before setting, so it assumes you're passing it with an initial "#".
Deprecated for public use, use Title::makeTitle() with fragment parameter, or Title::createFragmentTarget(). Still in active use privately.
string | $fragment | Text |
Definition at line 1559 of file Title.php.
Referenced by secureAndSplit().
Title::touchLinks | ( | ) |
Update page_touched timestamps and send CDN purge messages for pages linking to this title.
May be sent to the job queue depending on the number of links. Typically called on create and delete.
Definition at line 4731 of file Title.php.
References getNamespace(), and NS_CATEGORY.
Title::userCan | ( | $action, | |
$user = null, | |||
$rigor = 'secure' ) |
Can $user perform $action on this page?
string | $action | Action that permission needs to be checked for |
User | $user | User to check (since 1.19); $wgUser will be used if not provided. |
string | $rigor | Same format as Title::getUserPermissionsErrors() |
Definition at line 2108 of file Title.php.
References $wgUser, and getUserPermissionsErrorsInternal().
Referenced by checkActionPermissions(), moveSubpages(), and quickUserCan().
|
protected |
Check if the requested move target is a valid file move target.
Title | $nt | Target title |
Definition at line 3905 of file Title.php.
References $wgUser, wfFindFile(), and wfLocalFile().
Title::wasLocalInterwiki | ( | ) |
int Title::$mArticleID = -1 |
bool Title::$mCascadeRestriction |
array Title::$mCascadeSources |
Title::$mCascadingRestrictions |
|
private |
|
private |
int Title::$mDefaultNamespace = NS_MAIN |
|
private |
|
private |
string Title::$mFragment = '' |
|
protected |
|
private |
|
private |
|
protected |
|
protected |
|
private |
int Title::$mNamespace = NS_MAIN |
|
private |
|
protected |
|
private |
|
protected |
null Title::$mRedirect = null |
array Title::$mRestrictions = [] |
|
protected |
bool Title::$mRestrictionsLoaded = false |
string Title::$mTextform = '' |
mixed Title::$mTitleProtection |
|
private |
A corresponding TitleValue object.
string Title::$mUrlform = '' |
|
protected |
|
staticprivate |
const Title::CACHE_MAX = 1000 |
const Title::GAID_FOR_UPDATE = 1 |