MediaWiki REL1_33
WikiFilePage Class Reference

Special handling for file pages. More...

Inheritance diagram for WikiFilePage:
Collaboration diagram for WikiFilePage:

Public Member Functions

 __construct ( $title)
 
 doPurge ()
 Override handling of action=purge.
 
 followRedirect ()
 
 getDuplicates ()
 
 getFile ()
 
 getForeignCategories ()
 Get the categories this file is a member of on the wiki where it was uploaded.
 
 getRedirectTarget ()
 
 getSourceURL ()
 
 getWikiDisplayName ()
 
 isLocal ()
 
 isRedirect ()
 
 setFile ( $file)
 
- Public Member Functions inherited from WikiPage
 __clone ()
 Makes sure that the mTitle object is cloned to the newly cloned WikiPage.
 
 __construct (Title $title)
 Constructor and clear the article.
 
 checkFlags ( $flags)
 Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed.
 
 checkTouched ()
 Loads page_touched and returns a value indicating if it should be used.
 
 clear ()
 Clear the object.
 
 clearPreparedEdit ()
 Clear the mPreparedEdit cache field, as may be needed by mutable content types.
 
 commitRollback ( $fromP, $summary, $bot, &$resultDetails, User $guser, $tags=null)
 Backend implementation of doRollback(), please refer there for parameter and return value documentation.
 
 doDeleteArticle ( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $user=null, $immediate=false)
 Same as doDeleteArticleReal(), but returns a simple boolean.
 
 doDeleteArticleBatched ( $reason, $suppress, User $deleter, $tags, $logsubtype, $immediate=false, $webRequestId=null)
 Back-end article deletion.
 
 doDeleteArticleReal ( $reason, $suppress=false, $u1=null, $u2=null, &$error='', User $deleter=null, $tags=[], $logsubtype='delete', $immediate=false)
 Back-end article deletion Deletes the article with database consistency, writes logs, purges caches.
 
 doDeleteUpdates ( $id, Content $content=null, Revision $revision=null, User $user=null)
 Do some database updates after deletion.
 
 doEditContent (Content $content, $summary, $flags=0, $originalRevId=false, User $user=null, $serialFormat=null, $tags=[], $undidRevId=0)
 Change an existing article or create a new article.
 
 doEditUpdates (Revision $revision, User $user, array $options=[])
 Do standard deferred updates after page edit.
 
 doRollback ( $fromP, $summary, $token, $bot, &$resultDetails, User $user, $tags=null)
 Roll back the most recent consecutive set of edits to a page from the same user; fails if there are no eligible edits to roll back to, e.g.
 
 doSecondaryDataUpdates (array $options=[])
 Do secondary data updates (such as updating link tables).
 
 doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, User $user, $tags=null)
 Update the article's restriction field, and leave a log entry.
 
 doViewUpdates (User $user, $oldid=0)
 Do standard deferred updates after page view (existing or missing page)
 
 exists ()
 
 getActionOverrides ()
 
 getAutoDeleteReason (&$hasHistory)
 Auto-generates a deletion reason.
 
 getCategories ()
 Returns a list of categories this page is a member of.
 
 getComment ( $audience=Revision::FOR_PUBLIC, User $user=null)
 
 getContent ( $audience=Revision::FOR_PUBLIC, User $user=null)
 Get the content of the current revision.
 
 getContentHandler ()
 Returns the ContentHandler instance to be used to deal with the content of this WikiPage.
 
 getContentModel ()
 Returns the page's content model id (see the CONTENT_MODEL_XXX constants).
 
 getContributors ()
 Get a list of users who have edited this article, not including the user who made the most recent revision, which you can get from $article->getUser() if you want it.
 
 getCreator ( $audience=Revision::FOR_PUBLIC, User $user=null)
 Get the User object of the user who created the page.
 
 getDeletionUpdates ( $rev=null)
 Returns a list of updates to be performed when this page is deleted.
 
 getHiddenCategories ()
 Returns a list of hidden categories this page is a member of.
 
 getId ()
 
 getLatest ()
 Get the page_latest field.
 
 getLinksTimestamp ()
 Get the page_links_updated field.
 
 getMinorEdit ()
 Returns true if last revision was marked as "minor edit".
 
 getMutableCacheKeys (WANObjectCache $cache)
 
 getOldestRevision ()
 Get the Revision object of the oldest revision.
 
 getParserOutput (ParserOptions $parserOptions, $oldid=null, $forceParse=false)
 Get a ParserOutput for the given ParserOptions and revision ID.
 
 getRedirectURL ( $rt)
 Get the Title object or URL to use for a redirect.
 
 getRevision ()
 Get the latest revision.
 
 getRevisionRecord ()
 Get the latest revision.
 
 getTimestamp ()
 
 getTitle ()
 Get the title object of the article.
 
 getTouched ()
 Get the page_touched field.
 
 getUndoContent (Revision $undo, Revision $undoafter)
 Get the content that needs to be saved in order to undo all revisions between $undo and $undoafter.
 
 getUser ( $audience=Revision::FOR_PUBLIC, User $user=null)
 
 getUserText ( $audience=Revision::FOR_PUBLIC, User $user=null)
 
 hasViewableContent ()
 Check if this page is something we're going to be showing some sort of sensible content for.
 
 insertOn ( $dbw, $pageId=null)
 Insert a new empty page record for this article.
 
 insertProtectNullRevision ( $revCommentMsg, array $limit, array $expiry, $cascade, $reason, $user=null)
 Insert a new null revision for this page.
 
 insertRedirect ()
 Insert an entry for this page into the redirect table if the content is a redirect.
 
 insertRedirectEntry (Title $rt, $oldLatest=null)
 Insert or update the redirect table entry for this page to indicate it redirects to $rt.
 
 isBatchedDelete ( $safetyMargin=0)
 Determines if deletion of this page would be batched (executed over time by the job queue) or not (completed in the same request as the delete call).
 
 isCountable ( $editInfo=false)
 Determine whether a page would be suitable for being counted as an article in the site_stats table based on the title & its content.
 
 loadFromRow ( $data, $from)
 Load the object from a database row.
 
 loadPageData ( $from='fromdb')
 Load the object from a given source by title.
 
 lockAndGetLatest ()
 Lock the page row for this title+id and return page_latest (or 0)
 
 makeParserOptions ( $context)
 Get parser options suitable for rendering the primary article wikitext.
 
 newPageUpdater (User $user, RevisionSlotsUpdate $forUpdate=null)
 Returns a PageUpdater for creating new revisions on this page (or creating the page).
 
 pageDataFromId ( $dbr, $id, $options=[])
 Fetch a page record matching the requested ID.
 
 pageDataFromTitle ( $dbr, $title, $options=[])
 Fetch a page record matching the Title object's namespace and title using a sanitized title string.
 
 prepareContentForEdit (Content $content, $revision=null, User $user=null, $serialFormat=null, $useCache=true)
 Prepare content which is about to be saved.
 
 protectDescription (array $limit, array $expiry)
 Builds the description to serve as comment for the edit.
 
 protectDescriptionLog (array $limit, array $expiry)
 Builds the description to serve as comment for the log entry.
 
 replaceSectionAtRev ( $sectionId, Content $sectionContent, $sectionTitle='', $baseRevId=null)
 
 replaceSectionContent ( $sectionId, Content $sectionContent, $sectionTitle='', $edittime=null)
 
 setTimestamp ( $ts)
 Set the page timestamp (use only to avoid DB queries)
 
 shouldCheckParserCache (ParserOptions $parserOptions, $oldId)
 Should the parser cache be used?
 
 supportsSections ()
 Returns true if this page's content model supports sections.
 
 triggerOpportunisticLinksUpdate (ParserOutput $parserOutput)
 Opportunistically enqueue link update jobs given fresh parser output if useful.
 
 updateCategoryCounts (array $added, array $deleted, $id=0)
 Update all the appropriate counts in the category table, given that we've added the categories $added and deleted the categories $deleted.
 
 updateIfNewerOn ( $dbw, $revision)
 If the given revision is newer than the currently set page_latest, update the page record.
 
 updateParserCache (array $options=[])
 Update the parser cache.
 
 updateRedirectOn ( $dbw, $redirectTitle, $lastRevIsRedirect=null)
 Add row to the redirect table if this is a redirect, remove otherwise.
 
 updateRevisionOn ( $dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
 Update the page record to point to a newly saved revision.
 
 wasLoadedFrom ( $from)
 Checks whether the page data was loaded using the given database access mode (or better).
 

Protected Member Functions

 loadFile ()
 
- Protected Member Functions inherited from WikiPage
 archiveRevisions ( $dbw, $id, $suppress)
 Archives revisions as part of page deletion.
 
 clearCacheFields ()
 Clear the object cache fields.
 
 formatExpiry ( $expiry)
 
 loadLastEdit ()
 Loads everything except the text This isn't necessary for all uses, so it's only done if needed.
 
 pageData ( $dbr, $conditions, $options=[])
 Fetch a page record with the given conditions.
 
 setLastEdit (Revision $revision)
 Set the latest revision.
 

Protected Attributes

array $mDupes = null
 
File $mFile = false
 
bool $mFileLoaded = false
 
LocalRepo $mRepo = null
 
- Protected Attributes inherited from WikiPage
int $mDataLoadedFrom = self::READ_NONE
 One of the READ_* constants.
 
int $mId = null
 
Revision $mLastRevision = null
 
string $mLinksUpdated = '19700101000000'
 
Title $mRedirectTarget = null
 
string $mTimestamp = ''
 Timestamp of the current revision or empty string if not loaded.
 
string $mTouched = '19700101000000'
 

Additional Inherited Members

- Static Public Member Functions inherited from WikiPage
static factory (Title $title)
 Create a WikiPage object of the appropriate class for the given title.
 
static getQueryInfo ()
 Return the tables, fields, and join conditions to be selected to create a new page object.
 
static hasDifferencesOutsideMainSlot (Revision $a, Revision $b)
 Helper method for checking whether two revisions have differences that go beyond the main slot.
 
static newFromID ( $id, $from='fromdb')
 Constructor from a page id.
 
static newFromRow ( $row, $from='fromdb')
 Constructor from a database row.
 
static onArticleCreate (Title $title)
 The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of the specified actions are done.
 
static onArticleDelete (Title $title)
 Clears caches when article is deleted.
 
static onArticleEdit (Title $title, Revision $revision=null, $slotsChanged=null)
 Purge caches on page update etc.
 
static selectFields ()
 Return the list of revision fields that should be selected to create a new page.
 
- Public Attributes inherited from WikiPage
bool $mDataLoaded = false
 
bool $mIsRedirect = false
 
int false $mLatest = false
 False means "not loaded".
 
PreparedEdit $mPreparedEdit = false
 Map of cache fields (text, parser output, ect) for a proposed/new edit.
 
Title $mTitle = null
 
- Public Attributes inherited from IDBAccessObject
const READ_LOCKING = self::READ_LATEST | 2
 Constants for object loading bitfield flags (higher => higher QoS)
 
const READ_NONE = -1
 
- Static Protected Member Functions inherited from WikiPage
static convertSelectType ( $type)
 Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
 
static flattenRestrictions ( $limit)
 Take an array of page restrictions and flatten it to a string suitable for insertion into the page_restrictions field.
 

Detailed Description

Special handling for file pages.

Definition at line 30 of file WikiFilePage.php.

Constructor & Destructor Documentation

◆ __construct()

WikiFilePage::__construct ( $title)

Definition at line 40 of file WikiFilePage.php.

Member Function Documentation

◆ doPurge()

WikiFilePage::doPurge ( )

Override handling of action=purge.

Returns
bool

Reimplemented from WikiPage.

Definition at line 171 of file WikiFilePage.php.

References loadFile(), and wfDebug().

◆ followRedirect()

WikiFilePage::followRedirect ( )
Returns
bool|mixed|Title

Reimplemented from WikiPage.

Definition at line 92 of file WikiFilePage.php.

References loadFile(), and NS_FILE.

◆ getDuplicates()

WikiFilePage::getDuplicates ( )
Returns
array|null

Definition at line 136 of file WikiFilePage.php.

References $file, $mDupes, $self, and(), loadFile(), and RepoGroup\singleton().

◆ getFile()

WikiFilePage::getFile ( )
Returns
bool|File

Definition at line 128 of file WikiFilePage.php.

References $mFile, and loadFile().

Referenced by getSourceURL(), and getWikiDisplayName().

◆ getForeignCategories()

WikiFilePage::getForeignCategories ( )

Get the categories this file is a member of on the wiki where it was uploaded.

For local files, this is the same as getCategories(). For foreign API files (InstantCommons), this is not supported currently. Results will include hidden categories.

Returns
TitleArray|Title[]
Since
1.23

Definition at line 212 of file WikiFilePage.php.

References $dbr, $mFile, WikiPage\$mTitle, $res, loadFile(), TitleArray\newFromResult(), NS_CATEGORY, and wfDebug().

◆ getRedirectTarget()

WikiFilePage::getRedirectTarget ( )
Returns
mixed|null|Title

Reimplemented from WikiPage.

Definition at line 74 of file WikiFilePage.php.

References WikiPage\$mRedirectTarget, loadFile(), and NS_FILE.

◆ getSourceURL()

WikiFilePage::getSourceURL ( )
Since
1.28
Returns
string

Reimplemented from WikiPage.

Definition at line 256 of file WikiFilePage.php.

References getFile().

◆ getWikiDisplayName()

WikiFilePage::getWikiDisplayName ( )
Since
1.28
Returns
string

Reimplemented from WikiPage.

Definition at line 248 of file WikiFilePage.php.

References getFile().

◆ isLocal()

WikiFilePage::isLocal ( )
Returns
bool

Reimplemented from WikiPage.

Definition at line 120 of file WikiFilePage.php.

References loadFile().

◆ isRedirect()

WikiFilePage::isRedirect ( )
Returns
bool

Reimplemented from WikiPage.

Definition at line 108 of file WikiFilePage.php.

References loadFile().

◆ loadFile()

WikiFilePage::loadFile ( )
protected

◆ setFile()

WikiFilePage::setFile ( $file)
Parameters
File$file

Definition at line 49 of file WikiFilePage.php.

References $file.

Member Data Documentation

◆ $mDupes

array WikiFilePage::$mDupes = null
protected

Definition at line 38 of file WikiFilePage.php.

Referenced by getDuplicates().

◆ $mFile

File WikiFilePage::$mFile = false
protected

Definition at line 32 of file WikiFilePage.php.

Referenced by getFile(), and getForeignCategories().

◆ $mFileLoaded

bool WikiFilePage::$mFileLoaded = false
protected

Definition at line 36 of file WikiFilePage.php.

◆ $mRepo

LocalRepo WikiFilePage::$mRepo = null
protected

Definition at line 34 of file WikiFilePage.php.


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