MediaWiki  1.23.2
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. More...
 
 followRedirect ()
 
 getActionOverrides ()
 Returns overrides for action handlers. More...
 
 getDuplicates ()
 
 getFile ()
 
 getForeignCategories ()
 Get the categories this file is a member of on the wiki where it was uploaded. More...
 
 getRedirectTarget ()
 
 isLocal ()
 
 isRedirect ()
 
 setFile ( $file)
 
- Public Member Functions inherited from WikiPage
 __construct (Title $title)
 Constructor and clear the article. More...
 
 checkFlags ( $flags)
 Check flags and add EDIT_NEW or EDIT_UPDATE to them as needed. More...
 
 checkTouched ()
 Loads page_touched and returns a value indicating if it should be used. More...
 
 clear ()
 Clear the object. More...
 
 clearPreparedEdit ()
 Clear the mPreparedEdit cache field, as may be needed by mutable content types. More...
 
 commitRollback ( $fromP, $summary, $bot, &$resultDetails, User $guser)
 Backend implementation of doRollback(), please refer there for parameter and return value documentation. More...
 
 doCascadeProtectionUpdates (ParserOutput $parserOutput)
 Updates cascading protections. More...
 
 doDeleteArticle ( $reason, $suppress=false, $id=0, $commit=true, &$error='', User $user=null)
 Same as doDeleteArticleReal(), but returns a simple boolean. More...
 
 doDeleteArticleReal ( $reason, $suppress=false, $id=0, $commit=true, &$error='', User $user=null)
 Back-end article deletion Deletes the article with database consistency, writes logs, purges caches. More...
 
 doDeleteUpdates ( $id, Content $content=null)
 Do some database updates after deletion. More...
 
 doEdit ( $text, $summary, $flags=0, $baseRevId=false, $user=null)
 Change an existing article or create a new article. More...
 
 doEditContent (Content $content, $summary, $flags=0, $baseRevId=false, User $user=null, $serialisation_format=null)
 Change an existing article or create a new article. More...
 
 doEditUpdates (Revision $revision, User $user, array $options=array())
 Do standard deferred updates after page edit. More...
 
 doQuickEdit ( $text, User $user, $comment='', $minor=0)
 Edit an article without doing all that other stuff The article must already exist; link tables etc are not updated, caches are not flushed. More...
 
 doQuickEditContent (Content $content, User $user, $comment='', $minor=false, $serialisation_format=null)
 Edit an article without doing all that other stuff The article must already exist; link tables etc are not updated, caches are not flushed. More...
 
 doRollback ( $fromP, $summary, $token, $bot, &$resultDetails, User $user)
 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. More...
 
 doUpdateRestrictions (array $limit, array $expiry, &$cascade, $reason, User $user)
 Update the article's restriction field, and leave a log entry. More...
 
 doViewUpdates (User $user, $oldid=0)
 Do standard deferred updates after page view (existing or missing page) More...
 
 estimateRevisionCount ()
 Get the approximate revision count of this page. More...
 
 exists ()
 
 getAutoDeleteReason (&$hasHistory)
 Auto-generates a deletion reason. More...
 
 getCategories ()
 #- More...
 
 getComment ( $audience=Revision::FOR_PUBLIC, User $user=null)
 
 getContent ( $audience=Revision::FOR_PUBLIC, User $user=null)
 Get the content of the current revision. More...
 
 getContentHandler ()
 Returns the ContentHandler instance to be used to deal with the content of this WikiPage. More...
 
 getContentModel ()
 Returns the page's content model id (see the CONTENT_MODEL_XXX constants). More...
 
 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. More...
 
 getCount ()
 
 getCreator ( $audience=Revision::FOR_PUBLIC, User $user=null)
 Get the User object of the user who created the page. More...
 
 getDeletionUpdates (Content $content=null)
 Returns a list of updates to be performed when this page is deleted. More...
 
 getHiddenCategories ()
 Returns a list of hidden categories this page is a member of. More...
 
 getId ()
 
 getLastNAuthors ( $num, $revLatest=0)
 Get the last N authors. More...
 
 getLatest ()
 Get the page_latest field. More...
 
 getLinksTimestamp ()
 Get the page_links_updated field. More...
 
 getMinorEdit ()
 Returns true if last revision was marked as "minor edit". More...
 
 getOldestRevision ()
 Get the Revision object of the oldest revision. More...
 
 getParserOutput (ParserOptions $parserOptions, $oldid=null)
 Get a ParserOutput for the given ParserOptions and revision ID. More...
 
 getRawText ()
 Get the text of the current revision. More...
 
 getRedirectURL ( $rt)
 Get the Title object or URL to use for a redirect. More...
 
 getRevision ()
 Get the latest revision. More...
 
 getText ( $audience=Revision::FOR_PUBLIC, User $user=null)
 Get the text of the current revision. More...
 
 getTimestamp ()
 
 getTitle ()
 Get the title object of the article. More...
 
 getTouched ()
 Get the page_touched field. More...
 
 getUndoContent (Revision $undo, Revision $undoafter=null)
 Get the content that needs to be saved in order to undo all revisions between $undo and $undoafter. More...
 
 getUndoText (Revision $undo, Revision $undoafter=null)
 Get the text that needs to be saved in order to undo all revisions between $undo and $undoafter. More...
 
 getUsedTemplates ()
 Return a list of templates used by this article. More...
 
 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. More...
 
 insertOn ( $dbw)
 Insert a new empty page record for this article. More...
 
 insertProtectNullRevision ( $revCommentMsg, array $limit, array $expiry, $cascade, $reason)
 Insert a new null revision for this page. More...
 
 insertRedirect ()
 Insert an entry for this page into the redirect table. More...
 
 insertRedirectEntry ( $rt)
 Insert or update the redirect table entry for this page to indicate it redirects to $rt . More...
 
 isBigDeletion ()
 Check whether the number of revisions of this page surpasses $wgDeleteRevisionsLimit. More...
 
 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. More...
 
 isParserCacheUsed (ParserOptions $parserOptions, $oldid)
 Should the parser cache be used? More...
 
 loadFromRow ( $data, $from)
 Load the object from a database row. More...
 
 loadPageData ( $from='fromdb')
 Set the general counter, title etc data loaded from some source. More...
 
 makeParserOptions ( $context)
 Get parser options suitable for rendering the primary article wikitext. More...
 
 pageDataFromId ( $dbr, $id, $options=array())
 Fetch a page record matching the requested ID. More...
 
 pageDataFromTitle ( $dbr, $title, $options=array())
 Fetch a page record matching the Title object's namespace and title using a sanitized title string. More...
 
 prepareContentForEdit (Content $content, $revid=null, User $user=null, $serialization_format=null)
 Prepare content which is about to be saved. More...
 
 prepareTextForEdit ( $text, $revid=null, User $user=null)
 Prepare text which is about to be saved. More...
 
 preSaveTransform ( $text, User $user=null, ParserOptions $popts=null)
 This function is called right before saving the wikitext, so we can do things like signatures and links-in-context. More...
 
 protectDescription (array $limit, array $expiry)
 Builds the description to serve as comment for the edit. More...
 
 protectDescriptionLog (array $limit, array $expiry)
 Builds the description to serve as comment for the log entry. More...
 
 replaceSection ( $section, $text, $sectionTitle='', $edittime=null)
 
 replaceSectionContent ( $section, Content $sectionContent, $sectionTitle='', $edittime=null)
 
 setCachedLastEditTime ( $timestamp)
 Set the cached timestamp for the last time the page changed. More...
 
 setTimestamp ( $ts)
 Set the page timestamp (use only to avoid DB queries) More...
 
 supportsSections ()
 Returns true if this page's content model supports sections. More...
 
 updateCategoryCounts (array $added, array $deleted)
 Update all the appropriate counts in the category table, given that we've added the categories $added and deleted the categories $deleted. More...
 
 updateIfNewerOn ( $dbw, $revision)
 If the given revision is newer than the currently set page_latest, update the page record. More...
 
 updateRedirectOn ( $dbw, $redirectTitle, $lastRevIsRedirect=null)
 Add row to the redirect table if this is a redirect, remove otherwise. More...
 
 updateRestrictions ( $limit=array(), $reason='', &$cascade=0, $expiry=array(), User $user=null)
 Update the article's restriction field, and leave a log entry. More...
 
 updateRevisionOn ( $dbw, $revision, $lastRevision=null, $lastRevIsRedirect=null)
 Update the page record to point to a newly saved revision. More...
 

Protected Member Functions

 loadFile ()
 
- Protected Member Functions inherited from WikiPage
 clearCacheFields ()
 Clear the object cache fields. More...
 
 formatExpiry ( $expiry)
 
 getCachedLastEditTime ()
 Get the cached timestamp for the last time the page changed. More...
 
 loadLastEdit ()
 Loads everything except the text This isn't necessary for all uses, so it's only done if needed. More...
 
 pageData ( $dbr, $conditions, $options=array())
 Fetch a page record with the given conditions. More...
 
 setLastEdit (Revision $revision)
 Set the latest revision. More...
 

Protected Attributes

 $mDupes = null
 
File $mFile = false
 
 $mFileLoaded = false
 
 $mRepo = null
 
- Protected Attributes inherited from WikiPage
int null $mCounter = null
 
int $mId = null
 
Revision $mLastRevision = null
 
string $mLinksUpdated = '19700101000000'
 
Title $mRedirectTarget = null
 
string $mTouched = '19700101000000'
 
 int
 one of the READ_* constants More...
 
 string
 timestamp of the current revision or empty string if not loaded More...
 

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. More...
 
static getAutosummary ( $oldtext, $newtext, $flags)
 Return an applicable autosummary if one exists for the given edit. More...
 
static newFromID ( $id, $from='fromdb')
 Constructor from a page id. More...
 
static newFromRow ( $row, $from='fromdb')
 Constructor from a database row. More...
 
static onArticleCreate ( $title)
 The onArticle*() functions are supposed to be a kind of hooks which should be called whenever any of the specified actions are done. More...
 
static onArticleDelete ( $title)
 Clears caches when article is deleted. More...
 
static onArticleEdit ( $title)
 Purge caches on page update etc. More...
 
static selectFields ()
 Return the list of revision fields that should be selected to create a new page. More...
 
- Public Attributes inherited from WikiPage
 $mDataLoadedFrom = self::READ_NONE
 
 $mPreparedEdit = false
 
 $mTimestamp = ''
 
Title $mTitle = null
 
 $mDataLoaded = false
 
 $mIsRedirect = false
 
 $mLatest = false
 
- Public Attributes inherited from IDBAccessObject
const READ_LATEST = 1
 
const READ_LOCKING = 3
 
const READ_NONE = -1
 
const READ_NORMAL = 0
 
- Static Protected Member Functions inherited from WikiPage
static flattenRestrictions ( $limit)
 Take an array of page restrictions and flatten it to a string suitable for insertion into the page_restrictions field. More...
 

Detailed Description

Special handling for file pages.

Definition at line 28 of file WikiFilePage.php.

Constructor & Destructor Documentation

◆ __construct()

WikiFilePage::__construct (   $title)

Definition at line 36 of file WikiFilePage.php.

References $title.

Member Function Documentation

◆ doPurge()

WikiFilePage::doPurge ( )

Override handling of action=purge.

Returns
bool

Reimplemented from WikiPage.

Definition at line 173 of file WikiFilePage.php.

References array(), loadFile(), and wfDebug().

◆ followRedirect()

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

Reimplemented from WikiPage.

Definition at line 94 of file WikiFilePage.php.

References $from, loadFile(), Title\makeTitle(), and NS_FILE.

◆ getActionOverrides()

WikiFilePage::getActionOverrides ( )

Returns overrides for action handlers.

Classes listed here will be used instead of the default one when (and only when) $wgActions[$action] === true. This allows subclasses to override the default behavior.

Todo:
Move this UI stuff somewhere else
Returns
Array

Reimplemented from WikiPage.

Definition at line 42 of file WikiFilePage.php.

◆ getDuplicates()

WikiFilePage::getDuplicates ( )
Returns
array|null

Definition at line 138 of file WikiFilePage.php.

References $file, $hash, $mDupes, $self, $size, array(), as, loadFile(), and RepoGroup\singleton().

◆ getFile()

WikiFilePage::getFile ( )
Returns
bool|File

Definition at line 130 of file WikiFilePage.php.

References $mFile, and 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
TitleArray|Title[]
Since
1.23

Definition at line 203 of file WikiFilePage.php.

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

◆ getRedirectTarget()

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

Reimplemented from WikiPage.

Definition at line 76 of file WikiFilePage.php.

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

◆ isLocal()

WikiFilePage::isLocal ( )
Returns
bool

Definition at line 122 of file WikiFilePage.php.

References loadFile().

◆ isRedirect()

WikiFilePage::isRedirect ( )
Returns
bool

Reimplemented from WikiPage.

Definition at line 110 of file WikiFilePage.php.

References loadFile().

◆ loadFile()

WikiFilePage::loadFile ( )
protected

◆ setFile()

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

Definition at line 51 of file WikiFilePage.php.

References $file.

Member Data Documentation

◆ $mDupes

WikiFilePage::$mDupes = null
protected

Definition at line 34 of file WikiFilePage.php.

Referenced by getDuplicates().

◆ $mFile

File WikiFilePage::$mFile = false
protected

Definition at line 31 of file WikiFilePage.php.

Referenced by getFile(), and getForeignCategories().

◆ $mFileLoaded

WikiFilePage::$mFileLoaded = false
protected

Definition at line 33 of file WikiFilePage.php.

◆ $mRepo

WikiFilePage::$mRepo = null
protected

Definition at line 32 of file WikiFilePage.php.


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