Manual:Article.php

From MediaWiki.org

Jump to: navigation, search
MediaWiki File: Article.php
Location: /includes/
Source code: HEAD

1.15.11.14.11.6.12

Classes: Article


Contents

[edit] Description

The Article class represents a MediaWiki article and its history. It encapsulates access to the way articles are stored in the database, and allows access to properties such as article text (in Wikitext format), flags, etc.

This file contains e.g. one version of function "view" for viewing a page, called from Wiki.php (another version is in RawPage.php). This function fetches the wikitext $mContent of the page from the database using functions getContent, loadContent and fetchContent, and assigns this to $text. After that it calls function addPrimaryWikiText in OutputPage.php to process $text.

[edit] Includes or Requires

[edit] Class Members

[edit] Article

  • $mComment
  • $mContent
  • $mContentLoaded
  • $mCounter
  • $mFileCache (v 1.6.10)
  • $mForUpdate
  • $mGoodAdjustment
  • $mId (v 1.6.10)
  • $mLatest
  • $mMinorEdit
  • $mOldId
  • $mRedirectedFrom
  • $mRedirectUrl
  • $mRevIdFetched
  • $mRevision
  • $mTable (v 1.6.10)
  • $mTimestamp
  • $mTitle
  • $mTotalAdjustment
  • $mTouched
  • $mUser
  • $mUserText

[edit] Hooks

Hooks called from this file are listed in the Category:MediaWiki hooks included in Article.php category.

[edit] Example

To create an Article object and print the raw wiki text from that article, for example from within an extension, you could do something like this:

$id = Title::newFromText("Test_page")->getArticleId(); //Get the id for the article called Test_page
$myArticle = Article::newFromId($id); //Make an article object from that id
echo $myArticle->getRawText(); //Print the raw wiki text of the article

[edit] See also