MediaWiki master
WikiFilePage Class Reference

Special handling for representing file pages. More...

Inherits WikiPage.

Collaboration diagram for WikiFilePage:

Public Member Functions

 __construct ( $title)
 
 doPurge ()
 Override handling of action=purge.
 
 followRedirect ()
 
 getActionOverrides ()
 
Todo
Move this UI stuff somewhere else
See also
ContentHandler::getActionOverrides
Returns
array

 
 getDuplicates ()
 
 getFile ()
 
 getForeignCategories ()
 Get the categories this file is a member of on the wiki where it was uploaded.
 
 getSourceURL ()
 
 getWikiDisplayName ()
 
 isLocal ()
 
 isRedirect ()
 
 setFile (File $file)
 
- Public Member Functions inherited from WikiPage
 __clone ()
 Makes sure that the mTitle object is cloned to the newly cloned WikiPage.
 
 __construct (PageIdentity $pageIdentity)
 
 __toString ()
 Returns an informative human readable unique representation of the page identity, for use as a cache key and for logging and debugging.
Returns
string

 
 __wakeup ()
 Ensure consistency when unserializing.
 
 canExist ()
 
 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.
 
 doDeleteArticleReal ( $reason, UserIdentity $deleter, $suppress=false, $u1=null, &$error='', $u2=null, $tags=[], $logsubtype='delete', $immediate=false)
 Back-end article deletion Deletes the article with database consistency, writes logs, purges caches.
 
 doEditUpdates (RevisionRecord $revisionRecord, UserIdentity $user, array $options=[])
 Do standard deferred updates after page edit.
 
 doSecondaryDataUpdates (array $options=[])
 Do secondary data updates (such as updating link tables).
 
 doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, UserIdentity $user, $tags=[])
 Update the article's restriction field, and leave a log entry.
 
 doUserEditContent (Content $content, Authority $performer, $summary, $flags=0, $originalRevId=false, $tags=[], $undidRevId=0)
 Change an existing article or create a new article.
 
 doViewUpdates (Authority $performer, $oldid=0, ?RevisionRecord $oldRev=null)
 Do standard deferred updates after page view (existing or missing page)
 
 exists ()
 
 getAutoDeleteReason (&$hasHistory=false)
 Auto-generates a deletion reason.
 
 getCategories ()
 Returns a list of categories this page is a member of.
 
 getComment ( $audience=RevisionRecord::FOR_PUBLIC, ?Authority $performer=null)
 
 getContent ( $audience=RevisionRecord::FOR_PUBLIC, ?Authority $performer=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=RevisionRecord::FOR_PUBLIC, ?Authority $performer=null)
 Get the User object of the user who created the page.
 
 getCurrentUpdate ()
 Get the state of an ongoing update, shortly before or just after it is saved to the database.
 
 getDBkey ()
 Get the page title in DB key form.This should always return a valid DB key.
Returns
string

 
 getHiddenCategories ()
 Returns a list of hidden categories this page is a member of.
 
 getId ( $wikiId=self::LOCAL)
 
 getLanguage ()
 
 getLatest ( $wikiId=self::LOCAL)
 Get the page_latest field.
 
 getLinksTimestamp ()
 Get the page_links_updated field.
 
 getMinorEdit ()
 Returns true if last revision was marked as "minor edit".
 
 getNamespace ()
 Returns the page's namespace number.The value returned by this method should represent a valid namespace, but this cannot be guaranteed in all cases.
Returns
int

 
 getParserOutput (?ParserOptions $parserOptions=null, $oldid=null, $noCache=false)
 Get a ParserOutput for the given ParserOptions and revision ID.
 
 getRedirectTarget ()
 If this page is a redirect, get its target.
 
 getRedirectURL ( $rt)
 Get the Title object or URL to use for a redirect.
 
 getRevisionRecord ()
 Get the latest revision.
 
 getTimestamp ()
 
 getTitle ()
 Get the title object of the article.
 
 getTouched ()
 Get the page_touched field.
 
 getUser ( $audience=RevisionRecord::FOR_PUBLIC, ?Authority $performer=null)
 
 getUserText ( $audience=RevisionRecord::FOR_PUBLIC, ?Authority $performer=null)
 
 getWikiId ()
 
 hasViewableContent ()
 Check if this page is something we're going to be showing some sort of sensible content for.
 
 insertNullProtectionRevision (string $revCommentMsg, array $limit, array $expiry, bool $cascade, string $reason, UserIdentity $user)
 Insert a new null revision for this page.
 
 insertOn ( $dbw, $pageId=null)
 Insert a new empty page record for this article.
 
 insertRedirectEntry (LinkTarget $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.
 
 isNew ()
 Tests if the page is new (only has one revision).
 
 isSamePageAs (PageReference $other)
 Checks whether the given PageReference refers to the same page as this PageReference.Two PageReference instances are considered to refer to the same page if they belong to the same wiki, and have the same namespace and DB key.
Parameters
PageReference$other
Returns
bool

 
 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 ( $performer, ?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, $recency=IDBAccessObject::READ_NORMAL)
 Fetch a page record matching the Title object's namespace and title using a sanitized title string.
 
 prepareContentForEdit (Content $content, ?RevisionRecord $revision, UserIdentity $user, $serialFormat=null, $useStash=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.
 
 toPageRecord ()
 Returns the page represented by this WikiPage as a PageStoreRecord.
 
 triggerOpportunisticLinksUpdate (ParserOutput $parserOutput)
 Opportunistically enqueue link update jobs after a fresh parser output was generated.
 
 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.
 
 updateParserCache (array $options=[])
 Update the parser cache.
 
 updateRevisionOn ( $dbw, RevisionRecord $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).
 
- Public Member Functions inherited from MediaWiki\DAO\WikiAwareEntity
 assertWiki ( $wikiId)
 Throws if $wikiId is different from the return value of getWikiId().
 

Protected Member Functions

 loadFile ()
 
- Protected Member Functions inherited from WikiPage
 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.
 

Protected Attributes

array null $mDupes = null
 
File false $mFile = false
 
bool $mFileLoaded = false
 
LocalRepo null $mRepo = null
 
- Protected Attributes inherited from WikiPage
bool $mDataLoaded = false
 
int $mDataLoadedFrom = IDBAccessObject::READ_NONE
 One of the READ_* constants.
 
int null $mId = null
 
string null $mLanguage = null
 
int false $mLatest = false
 False means "not loaded".
 
string $mLinksUpdated = '19700101000000'
 
PreparedEdit false $mPreparedEdit = false
 Map of cache fields (text, parser output, ect) for a proposed/new edit.
 
string $mTimestamp = ''
 Timestamp of the current revision or empty string if not loaded.
 
Title $mTitle
 
string $mTouched = '19700101000000'
 

Additional Inherited Members

- Static Public Member Functions inherited from WikiPage
static convertSelectType ( $type)
 Convert 'fromdb', 'fromdbmaster' and 'forupdate' to READ_* constants.
 
static getQueryInfo ()
 Return the tables, fields, and join conditions to be selected to create a new page object.
 
static hasDifferencesOutsideMainSlot (RevisionRecord $a, RevisionRecord $b)
 Helper method for checking whether two revisions have differences that go beyond the main slot.
 
static makeParserOptionsFromTitleAndModel (PageReference $pageRef, string $contentModel, $context)
 Create canonical parser options for a given title and content model.
 
static onArticleCreate (Title $title, $maybeIsRedirect=true)
 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, ?RevisionRecord $revRecord=null, $slotsChanged=null, $maybeRedirectChanged=true)
 Purge caches on page update etc.
 

Detailed Description

Special handling for representing file pages.

Definition at line 32 of file WikiFilePage.php.

Constructor & Destructor Documentation

◆ __construct()

WikiFilePage::__construct ( $title)
Parameters
Title$title

Definition at line 45 of file WikiFilePage.php.

Member Function Documentation

◆ doPurge()

WikiFilePage::doPurge ( )

Override handling of action=purge.

Returns
bool

Reimplemented from WikiPage.

Definition at line 162 of file WikiFilePage.php.

References $job, and wfDebug().

◆ followRedirect()

WikiFilePage::followRedirect ( )
Returns
bool|Title|string False, Title of in-wiki target, or string with URL

Reimplemented from WikiPage.

Definition at line 86 of file WikiFilePage.php.

References loadFile(), and NS_FILE.

◆ getActionOverrides()

WikiFilePage::getActionOverrides ( )

Todo
Move this UI stuff somewhere else
See also
ContentHandler::getActionOverrides
Returns
array

Reimplemented from WikiPage.

Definition at line 250 of file WikiFilePage.php.

References getFile().

◆ getDuplicates()

WikiFilePage::getDuplicates ( )
Returns
File[]|null

Definition at line 130 of file WikiFilePage.php.

References $self.

◆ getFile()

WikiFilePage::getFile ( )
Returns
File

Definition at line 122 of file WikiFilePage.php.

References loadFile().

◆ 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
TitleArrayFromResult
Since
1.23

Definition at line 206 of file WikiFilePage.php.

References $mTitle, NS_CATEGORY, and wfDebug().

◆ getSourceURL()

WikiFilePage::getSourceURL ( )
Since
1.28
Returns
string

Reimplemented from WikiPage.

Definition at line 243 of file WikiFilePage.php.

References getFile().

◆ getWikiDisplayName()

WikiFilePage::getWikiDisplayName ( )
Since
1.28
Returns
string

Reimplemented from WikiPage.

Definition at line 235 of file WikiFilePage.php.

References getFile().

◆ isLocal()

WikiFilePage::isLocal ( )
Returns
bool

Reimplemented from WikiPage.

Definition at line 114 of file WikiFilePage.php.

References loadFile().

◆ isRedirect()

WikiFilePage::isRedirect ( )
Returns
bool

Reimplemented from WikiPage.

Definition at line 102 of file WikiFilePage.php.

References loadFile().

◆ loadFile()

WikiFilePage::loadFile ( )
protected
Returns
bool

Definition at line 62 of file WikiFilePage.php.

Referenced by followRedirect(), getFile(), isLocal(), and isRedirect().

◆ setFile()

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

Definition at line 54 of file WikiFilePage.php.

Member Data Documentation

◆ $mDupes

array null WikiFilePage::$mDupes = null
protected

Definition at line 40 of file WikiFilePage.php.

◆ $mFile

File false WikiFilePage::$mFile = false
protected

Definition at line 34 of file WikiFilePage.php.

◆ $mFileLoaded

bool WikiFilePage::$mFileLoaded = false
protected

Definition at line 38 of file WikiFilePage.php.

◆ $mRepo

LocalRepo null WikiFilePage::$mRepo = null
protected

Definition at line 36 of file WikiFilePage.php.


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