$this->clear();
}
- /* private */ function clear()
- {
+ /* private */ function clear() {
$this->mContentLoaded = false;
$this->mCurID = $this->mUser = $this->mCounter = -1; # Not loaded
$this->mRedirectedFrom = $this->mUserText =
# not told otherwise, and so may cause a change to mTitle.
# Return the text of this revision
- function getContent( $noredir )
- {
+ function getContent( $noredir ) {
global $wgRequest;
# Get variables from query string :P
#
# If a section contains subsections, these are also returned.
#
- function getSection($text,$section) {
+ function getSection($text,$section) {
# strip NOWIKI etc. to avoid confusion (true-parameter causes HTML
# comments to be stripped as well)
}
# Load the revision (including cur_text) into this object
- function loadContent( $noredir = false )
- {
+ function loadContent( $noredir = false ) {
global $wgOut, $wgMwRedir, $wgRequest;
$dbr =& wfGetDB( DB_SLAVE );
}
}
- function getCount()
- {
+ function getCount() {
if ( -1 == $this->mCounter ) {
$id = $this->getID();
$dbr =& wfGetDB( DB_SLAVE );
# Would the given text make this article a "good" article (i.e.,
# suitable for including in the article count)?
-
- function isCountable( $text )
- {
+ function isCountable( $text ) {
global $wgUseCommaCount, $wgMwRedir;
if ( 0 != $this->mTitle->getNamespace() ) { return 0; }
# Loads everything from cur except cur_text
# This isn't necessary for all uses, so it's only done if needed.
-
- /* private */ function loadLastEdit()
- {
+ /* private */ function loadLastEdit() {
global $wgOut;
if ( -1 != $this->mUser ) return;
}
}
- function getTimestamp()
- {
+ function getTimestamp() {
$this->loadLastEdit();
return $this->mTimestamp;
}
- function getUser()
- {
+ function getUser() {
$this->loadLastEdit();
return $this->mUser;
}
- function getUserText()
- {
+ function getUserText() {
$this->loadLastEdit();
return $this->mUserText;
}
- function getComment()
- {
+ function getComment() {
$this->loadLastEdit();
return $this->mComment;
}
- function getMinorEdit()
- {
+ function getMinorEdit() {
$this->loadLastEdit();
return $this->mMinorEdit;
}
- function getContributors($limit = 0, $offset = 0)
- {
- $fname = 'Article::getContributors';
+ function getContributors($limit = 0, $offset = 0) {
+ $fname = 'Article::getContributors';
- # XXX: this is expensive; cache this info somewhere.
+ # XXX: this is expensive; cache this info somewhere.
- $title = $this->mTitle;
- $contribs = array();
+ $title = $this->mTitle;
+ $contribs = array();
$dbr =& wfGetDB( DB_SLAVE );
$oldTable = $dbr->tableName( 'old' );
$userTable = $dbr->tableName( 'user' );
GROUP BY old_user
ORDER BY timestamp DESC";
- if ($limit > 0) {
- $sql .= ' LIMIT '.$limit;
- }
+ if ($limit > 0) { $sql .= ' LIMIT '.$limit; }
$res = $dbr->query($sql, $fname);
while ( $line = $dbr->fetchObject( $res ) ) {
- $contribs[] = array($line->old_user, $line->old_user_text, $line->user_real_name);
- }
+ $contribs[] = array($line->old_user, $line->old_user_text, $line->user_real_name);
+ }
$dbr->freeResult($res);
-
- return $contribs;
+ return $contribs;
}
# This is the default action of the script: just view the page of
# the given title.
- function view()
- {
+ function view() {
global $wgUser, $wgOut, $wgLang, $wgRequest, $wgMwRedir, $wgOnlySysopsCanPatrol;
global $wgLinkCache, $IP, $wgEnableParserCache, $wgStylePath, $wgUseRCPatrol;
$sk = $wgUser->getSkin();
# of faith, and we want to be able to report database
# errors at some point.
- /* private */ function insertNewArticle( $text, $summary, $isminor, $watchthis )
- {
+ /* private */ function insertNewArticle( $text, $summary, $isminor, $watchthis ) {
global $wgOut, $wgUser, $wgMwRedir;
global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer;
/* Side effects: loads last edit */
- function getTextOfLastEditWithSectionReplacedOrAdded($section, $text, $summary = ''){
+ function getTextOfLastEditWithSectionReplacedOrAdded($section, $text, $summary = '') {
$this->loadLastEdit();
$oldtext = $this->getContent( true );
if ($section != '') {
return $text;
}
- function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' )
- {
+ function updateArticle( $text, $summary, $minor, $watchthis, $forceBot = false, $sectionanchor = '' ) {
global $wgOut, $wgUser;
global $wgDBtransactions, $wgMwRedir;
global $wgUseSquid, $wgInternalServer;
# After we've either updated or inserted the article, update
# the link tables and redirect to the new page.
- function showArticle( $text, $subtitle , $sectionanchor = '' )
- {
+ function showArticle( $text, $subtitle , $sectionanchor = '' ) {
global $wgOut, $wgUser, $wgLinkCache;
global $wgMwRedir;
# Validate article
- function validate ()
- {
+ function validate () {
global $wgOut ;
$wgOut->setPagetitle( wfMsg( 'validate' ) . ": " . $this->mTitle->getPrefixedText() );
$wgOut->setRobotpolicy( 'noindex,follow' );
}
# Mark this particular edit as patrolled
- function markpatrolled()
- {
+ function markpatrolled() {
global $wgOut, $wgRequest, $wgOnlySysopsCanPatrol, $wgUseRCPatrol;
$wgOut->setRobotpolicy( 'noindex,follow' );
# Add this page to my watchlist
- function watch( $add = true )
- {
+
+ function watch( $add = true ) {
global $wgUser, $wgOut, $wgLang;
global $wgDeferredUpdateList;
$wgOut->returnToMain( true, $this->mTitle->getPrefixedText() );
}
- function unwatch()
- {
+ function unwatch() {
$this->watch( false );
}
- function protect( $limit = 'sysop' )
- {
+ # protect a page
+
+ function protect( $limit = 'sysop' ) {
global $wgUser, $wgOut, $wgRequest;
if ( ! $wgUser->isSysop() ) {
}
}
- # Output protection confirmation dialog
- function confirmProtect( $par, $reason, $limit = 'sysop' )
- {
+ # Output protection confirmation dialog
+
+ function confirmProtect( $par, $reason, $limit = 'sysop' ) {
global $wgOut;
wfDebug( "Article::confirmProtect\n" );
$wgOut->returnToMain( false );
}
- function unprotect()
- {
+ function unprotect() {
return $this->protect( '' );
}
# UI entry point for page deletion
- function delete()
- {
+
+ function delete() {
global $wgUser, $wgOut, $wgMessageCache, $wgRequest;
$fname = 'Article::delete';
$confirm = $wgRequest->getBool( 'wpConfirm' ) && $wgRequest->wasPosted();
}
# Output deletion confirmation dialog
- function confirmDelete( $par, $reason )
- {
+
+ function confirmDelete( $par, $reason ) {
global $wgOut;
wfDebug( "Article::confirmDelete\n" );
$wgOut->returnToMain( false );
}
+
# Perform a deletion and output success or failure messages
- function doDelete( $reason )
- {
+
+ function doDelete( $reason ) {
global $wgOut, $wgUser, $wgLang;
$fname = 'Article::doDelete';
wfDebug( "$fname\n" );
# Back-end article deletion
# Deletes the article with database consistency, writes logs, purges caches
# Returns success
- function doDeleteArticle( $reason )
- {
+ function doDeleteArticle( $reason ) {
global $wgUser, $wgLang;
global $wgUseSquid, $wgDeferredUpdateList, $wgInternalServer;
return true;
}
- function rollback()
- {
+ function rollback() {
global $wgUser, $wgLang, $wgOut, $wgRequest;
$fname = "Article::rollback";
# Do standard deferred updates after page view
- /* private */ function viewUpdates()
- {
+ /* private */ function viewUpdates() {
global $wgDeferredUpdateList;
if ( 0 != $this->getID() ) {
global $wgDisableCounters;
# Do standard deferred updates after page edit.
# Every 1000th edit, prune the recent changes table.
- /* private */ function editUpdates( $text )
- {
+ /* private */ function editUpdates( $text ) {
global $wgDeferredUpdateList, $wgDBname, $wgMemc;
global $wgMessageCache;
}
}
- /* private */ function setOldSubtitle()
- {
+ /* private */ function setOldSubtitle() {
global $wgLang, $wgOut;
$td = $wgLang->timeanddate( $this->mTimestamp, true );
# This function is called right before saving the wikitext,
# so we can do things like signatures and links-in-context.
- function preSaveTransform( $text )
- {
+ function preSaveTransform( $text ) {
global $wgParser, $wgUser;
return $wgParser->preSaveTransform( $text, $this->mTitle, $wgUser, ParserOptions::newFromUser( $wgUser ) );
}
wfProfileOut( $fname );
}
- /* static */ function incViewCount( $id )
- {
+ /* static */ function incViewCount( $id ) {
$id = intval( $id );
global $wgHitcounterUpdateFreq;
# This is a good place to put code to clear caches, for instance.
# This is called on page move and undelete, as well as edit
- /* static */ function onArticleCreate($title_obj){
+ /* static */ function onArticleCreate($title_obj) {
global $wgUseSquid, $wgDeferredUpdateList;
$titles = $title_obj->getBrokenLinksTo();
LinkCache::linksccClearBrokenLinksTo( $title_obj->getPrefixedDBkey() );
}
- /* static */ function onArticleDelete($title_obj){
+ /* static */ function onArticleDelete($title_obj) {
LinkCache::linksccClearLinksTo( $title_obj->getArticleID() );
}
- /* static */ function onArticleEdit($title_obj){
+ /* static */ function onArticleEdit($title_obj) {
LinkCache::linksccClearPage( $title_obj->getArticleID() );
}
+
# Info about this page
- function info()
- {
+ function info() {
global $wgUser, $wgTitle, $wgOut, $wgLang, $wgAllowPageInfo;
$fname = 'Article::info';