', true, /* interface */true );
}
if ( $content === false ) {
@@ -975,16 +955,14 @@ class EditPage {
if ( $this->section == 'new' ) {
return $this->getCurrentContent();
}
- $revision = $this->getArticle()->getRevisionFetched();
+ $revision = $this->mArticle->getRevisionFetched();
if ( $revision === null ) {
if ( !$this->contentModel ) $this->contentModel = $this->getTitle()->getContentModel();
$handler = ContentHandler::getForModelID( $this->contentModel );
return $handler->makeEmptyContent();
}
-
$content = $revision->getContent();
-
return $content;
}
@@ -997,7 +975,7 @@ class EditPage {
* @return Content
*/
protected function getCurrentContent() {
- $rev = $this->getArticle()->getRevision();
+ $rev = $this->mArticle->getRevision();
$content = $rev ? $rev->getContent( Revision::RAW ) : null;
if ( $content === false || $content === null ) {
@@ -1070,6 +1048,8 @@ class EditPage {
* @since 1.21
*/
protected function getPreloadedContent( $preload ) {
+ global $wgUser;
+
if ( !empty( $this->mPreloadContent ) ) {
return $this->mPreloadContent;
}
@@ -1081,9 +1061,9 @@ class EditPage {
}
$title = Title::newFromText( $preload );
- $user = $this->getArticle()->getContext()->getUser();
# Check for existence to avoid getting MediaWiki:Noarticletext
- if ( $title === null || !$title->exists() || !$title->userCan( 'read', $user ) ) {
+ if ( $title === null || !$title->exists() || !$title->userCan( 'read', $wgUser ) ) {
+ //TODO: somehow show a warning to the user!
return $handler->makeEmptyContent();
}
@@ -1091,19 +1071,36 @@ class EditPage {
if ( $page->isRedirect() ) {
$title = $page->getRedirectTarget();
# Same as before
- if ( $title === null || !$title->exists() || !$title->userCan( 'read', $user ) ) {
+ if ( $title === null || !$title->exists() || !$title->userCan( 'read', $wgUser ) ) {
+ //TODO: somehow show a warning to the user!
return $handler->makeEmptyContent();
}
$page = WikiPage::factory( $title );
}
- $parserOptions = ParserOptions::newFromUser( $user );
+ $parserOptions = ParserOptions::newFromUser( $wgUser );
$content = $page->getContent( Revision::RAW );
if ( !$content ) {
+ //TODO: somehow show a warning to the user!
return $handler->makeEmptyContent();
}
+ if ( $content->getModel() !== $handler->getModelID() ) {
+ $converted = $content->convert( $handler->getModelID() );
+
+ if ( !$converted ) {
+ //TODO: somehow show a warning to the user!
+ wfDebug( "Attempt to preload incompatible content: "
+ . "can't convert " . $content->getModel()
+ . " to " . $handler->getModelID() );
+
+ return $handler->makeEmptyContent();
+ }
+
+ $content = $converted;
+ }
+
return $content->preloadTransform( $title, $parserOptions );
}
@@ -1115,10 +1112,10 @@ class EditPage {
* @private
*/
function tokenOk( &$request ) {
- $user = $this->getArticle()->getContext()->getUser();
+ global $wgUser;
$token = $request->getVal( 'wpEditToken' );
- $this->mTokenOk = $user->matchEditToken( $token );
- $this->mTokenOkExceptSuffix = $user->matchEditTokenNoSuffix( $token );
+ $this->mTokenOk = $wgUser->matchEditToken( $token );
+ $this->mTokenOkExceptSuffix = $wgUser->matchEditTokenNoSuffix( $token );
return $this->mTokenOk;
}
@@ -1128,13 +1125,11 @@ class EditPage {
* @return bool false if output is done, true if the rest of the form should be displayed
*/
function attemptSave() {
- $context = $this->getArticle()->getContext();
- $out = $context->getOutput();
- $user = $context->getUser();
+ global $wgUser, $wgOut;
$resultDetails = false;
# Allow bots to exempt some edits from bot flagging
- $bot = $user->isAllowed( 'bot' ) && $this->bot;
+ $bot = $wgUser->isAllowed( 'bot' ) && $this->bot;
$status = $this->internalAttemptSave( $resultDetails, $bot );
// FIXME: once the interface for internalAttemptSave() is made nicer, this should use the message in $status
if ( $status->value == self::AS_SUCCESS_UPDATE || $status->value == self::AS_SUCCESS_NEW_ARTICLE ) {
@@ -1156,13 +1151,13 @@ class EditPage {
return false;
case self::AS_PARSE_ERROR:
- $out->addWikiText( '
' . $status->getWikiText() . '
');
+ $wgOut->addWikiText( '
' . $status->getWikiText() . '
');
return true;
case self::AS_SUCCESS_NEW_ARTICLE:
$query = $resultDetails['redirect'] ? 'redirect=no' : '';
$anchor = isset ( $resultDetails['sectionanchor'] ) ? $resultDetails['sectionanchor'] : '';
- $out->redirect( $this->getTitle()->getFullURL( $query ) . $anchor );
+ $wgOut->redirect( $this->mTitle->getFullURL( $query ) . $anchor );
return false;
case self::AS_SUCCESS_UPDATE:
@@ -1170,7 +1165,7 @@ class EditPage {
$sectionanchor = $resultDetails['sectionanchor'];
// Give extensions a chance to modify URL query on update
- wfRunHooks( 'ArticleUpdateBeforeRedirect', array( $this->getArticle(), &$sectionanchor, &$extraQuery ) );
+ wfRunHooks( 'ArticleUpdateBeforeRedirect', array( $this->mArticle, &$sectionanchor, &$extraQuery ) );
if ( $resultDetails['redirect'] ) {
if ( $extraQuery == '' ) {
@@ -1179,11 +1174,11 @@ class EditPage {
$extraQuery = 'redirect=no&' . $extraQuery;
}
}
- $out->redirect( $this->getTitle()->getFullURL( $extraQuery ) . $sectionanchor );
+ $wgOut->redirect( $this->mTitle->getFullURL( $extraQuery ) . $sectionanchor );
return false;
case self::AS_BLANK_ARTICLE:
- $out->redirect( $this->getContextTitle()->getFullURL() );
+ $wgOut->redirect( $this->getContextTitle()->getFullURL() );
return false;
case self::AS_SPAM_ERROR:
@@ -1191,7 +1186,7 @@ class EditPage {
return false;
case self::AS_BLOCKED_PAGE_FOR_USER:
- throw new UserBlockedError( $user->getBlock() );
+ throw new UserBlockedError( $wgUser->getBlock() );
case self::AS_IMAGE_REDIRECT_ANON:
case self::AS_IMAGE_REDIRECT_LOGGED:
@@ -1208,7 +1203,7 @@ class EditPage {
throw new ThrottledError();
case self::AS_NO_CREATE_PERMISSION:
- $permission = $this->getTitle()->isTalkPage() ? 'createtalk' : 'createpage';
+ $permission = $this->mTitle->isTalkPage() ? 'createtalk' : 'createpage';
throw new PermissionsError( $permission );
default:
@@ -1235,7 +1230,7 @@ class EditPage {
* AS_CONTENT_TOO_BIG and AS_BLOCKED_PAGE_FOR_USER. All that stuff needs to be cleaned up some time.
*/
function internalAttemptSave( &$result, $bot = false ) {
- global $wgParser, $wgMaxArticleSize;
+ global $wgUser, $wgRequest, $wgParser, $wgMaxArticleSize;
$status = Status::newGood();
@@ -1261,14 +1256,11 @@ class EditPage {
return $status;
}
- $context = $this->getArticle()->getContext();
- $user = $context->getUser();
-
# Check image redirect
- if ( $this->getTitle()->getNamespace() == NS_FILE &&
+ if ( $this->mTitle->getNamespace() == NS_FILE &&
$textbox_content->isRedirect() &&
- !$user->isAllowed( 'upload' ) ) {
- $code = $user->isAnon() ? self::AS_IMAGE_REDIRECT_ANON : self::AS_IMAGE_REDIRECT_LOGGED;
+ !$wgUser->isAllowed( 'upload' ) ) {
+ $code = $wgUser->isAnon() ? self::AS_IMAGE_REDIRECT_ANON : self::AS_IMAGE_REDIRECT_LOGGED;
$status->setResult( false, $code );
wfProfileOut( __METHOD__ . '-checks' );
@@ -1284,8 +1276,8 @@ class EditPage {
}
if ( $match !== false ) {
$result['spam'] = $match;
- $ip = $context->getRequest()->getIP();
- $pdbk = $this->getTitle()->getPrefixedDBkey();
+ $ip = $wgRequest->getIP();
+ $pdbk = $this->mTitle->getPrefixedDBkey();
$match = str_replace( "\n", '', $match );
wfDebugLog( 'SpamRegex', "$ip spam regex hit [[$pdbk]]: \"$match\"" );
$status->fatal( 'spamprotectionmatch', $match );
@@ -1310,9 +1302,9 @@ class EditPage {
return $status;
}
- if ( $user->isBlockedFrom( $this->getTitle(), false ) ) {
+ if ( $wgUser->isBlockedFrom( $this->mTitle, false ) ) {
// Auto-block user's IP if the account was "hard" blocked
- $user->spreadAnyEditBlock();
+ $wgUser->spreadAnyEditBlock();
# Check block state against master, thus 'false'.
$status->setResult( false, self::AS_BLOCKED_PAGE_FOR_USER );
wfProfileOut( __METHOD__ . '-checks' );
@@ -1330,8 +1322,8 @@ class EditPage {
return $status;
}
- if ( !$user->isAllowed( 'edit' ) ) {
- if ( $user->isAnon() ) {
+ if ( !$wgUser->isAllowed( 'edit' ) ) {
+ if ( $wgUser->isAnon() ) {
$status->setResult( false, self::AS_READ_ONLY_PAGE_ANON );
wfProfileOut( __METHOD__ . '-checks' );
wfProfileOut( __METHOD__ );
@@ -1352,7 +1344,7 @@ class EditPage {
wfProfileOut( __METHOD__ );
return $status;
}
- if ( $user->pingLimiter() ) {
+ if ( $wgUser->pingLimiter() ) {
$status->fatal( 'actionthrottledtext' );
$status->value = self::AS_RATE_LIMITED;
wfProfileOut( __METHOD__ . '-checks' );
@@ -1373,12 +1365,12 @@ class EditPage {
# Load the page data from the master. If anything changes in the meantime,
# we detect it by using page_latest like a token in a 1 try compare-and-swap.
- $this->getArticle()->loadPageData( 'fromdbmaster' );
- $new = !$this->getArticle()->exists();
+ $this->mArticle->loadPageData( 'fromdbmaster' );
+ $new = !$this->mArticle->exists();
if ( $new ) {
// Late check for create permission, just in case *PARANOIA*
- if ( !$this->getTitle()->userCan( 'create', $user ) ) {
+ if ( !$this->mTitle->userCan( 'create', $wgUser ) ) {
$status->fatal( 'nocreatetext' );
$status->value = self::AS_NO_CREATE_PERMISSION;
wfDebug( __METHOD__ . ": no create permission\n" );
@@ -1424,7 +1416,7 @@ class EditPage {
// passed.
if ( $this->summary === '' ) {
$cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle );
- $this->summary = $context->msg( 'newsectionsummary' )
+ $this->summary = wfMessage( 'newsectionsummary' )
->rawParams( $cleanSectionTitle )->inContentLanguage()->text();
}
} elseif ( $this->summary !== '' ) {
@@ -1436,25 +1428,27 @@ class EditPage {
// Create a link to the new section from the edit summary.
$cleanSummary = $wgParser->stripSectionName( $this->summary );
- $this->summary = $context->msg( 'newsectionsummary' )
+ $this->summary = wfMessage( 'newsectionsummary' )
->rawParams( $cleanSummary )->inContentLanguage()->text();
}
}
$status->value = self::AS_SUCCESS_NEW_ARTICLE;
+
} else { # not $new
+
# Article exists. Check for edit conflict.
- $this->getArticle()->clear(); # Force reload of dates, etc.
- $timestamp = $this->getArticle()->getTimestamp();
+ $this->mArticle->clear(); # Force reload of dates, etc.
+ $timestamp = $this->mArticle->getTimestamp();
wfDebug( "timestamp: {$timestamp}, edittime: {$this->edittime}\n" );
if ( $timestamp != $this->edittime ) {
$this->isConflict = true;
if ( $this->section == 'new' ) {
- if ( $this->getArticle()->getUserText() == $user->getName() &&
- $this->getArticle()->getComment() == $this->summary ) {
+ if ( $this->mArticle->getUserText() == $wgUser->getName() &&
+ $this->mArticle->getComment() == $this->summary ) {
// Probably a duplicate submission of a new comment.
// This can happen when squid resends a request after
// a timeout but the first one actually went through.
@@ -1464,19 +1458,11 @@ class EditPage {
$this->isConflict = false;
wfDebug( __METHOD__ . ": conflict suppressed; new section\n" );
}
- } elseif ( $this->section == '' ) {
- $userWasLastToEdit = Revision::userWasLastToEdit(
- DB_MASTER,
- $this->getTitle()->getArticleID(),
- $user->getId(),
- $this->edittime
- );
-
- if ( $userWasLastToEdit ) {
- # Suppress edit conflict with self, except for section edits where merging is required.
- wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" );
- $this->isConflict = false;
- }
+ } elseif ( $this->section == '' && Revision::userWasLastToEdit( DB_MASTER, $this->mTitle->getArticleID(),
+ $wgUser->getId(), $this->edittime ) ) {
+ # Suppress edit conflict with self, except for section edits where merging is required.
+ wfDebug( __METHOD__ . ": Suppressing edit conflict, same user.\n" );
+ $this->isConflict = false;
}
}
@@ -1494,10 +1480,10 @@ class EditPage {
wfDebug( __METHOD__ . ": conflict! getting section '{$this->section}' for time '{$this->edittime}'"
. " (article time '{$timestamp}')\n" );
- $content = $this->getArticle()->replaceSectionContent( $this->section, $textbox_content, $sectionTitle, $this->edittime );
+ $content = $this->mArticle->replaceSectionContent( $this->section, $textbox_content, $sectionTitle, $this->edittime );
} else {
wfDebug( __METHOD__ . ": getting section '{$this->section}'\n" );
- $content = $this->getArticle()->replaceSectionContent( $this->section, $textbox_content, $sectionTitle );
+ $content = $this->mArticle->replaceSectionContent( $this->section, $textbox_content, $sectionTitle );
}
if ( is_null( $content ) ) {
@@ -1505,16 +1491,14 @@ class EditPage {
$this->isConflict = true;
$content = $textbox_content; // do not try to merge here!
} elseif ( $this->isConflict ) {
- $contentObj = $content;
# Attempt merge
- if ( $this->mergeChangesInto( $content ) ) {
+ if ( $this->mergeChangesIntoContent( $content ) ) {
// Successful merge! Maybe we should tell the user the good news?
$this->isConflict = false;
- $content = $this->toEditContent( $content );
wfDebug( __METHOD__ . ": Suppressing edit conflict, successful merge.\n" );
} else {
$this->section = '';
- $this->textbox1 = ContentHandler::getContentText( $contentObj );
+ $this->textbox1 = ContentHandler::getContentText( $content );
wfDebug( __METHOD__ . ": Keeping edit conflict, failed merge.\n" );
}
}
@@ -1587,7 +1571,7 @@ class EditPage {
// passed.
if ( $this->summary === '' ) {
$cleanSectionTitle = $wgParser->stripSectionName( $this->sectiontitle );
- $this->summary = $context->msg( 'newsectionsummary' )
+ $this->summary = wfMessage( 'newsectionsummary' )
->rawParams( $cleanSectionTitle )->inContentLanguage()->text();
}
} elseif ( $this->summary !== '' ) {
@@ -1595,7 +1579,7 @@ class EditPage {
# This is a new section, so create a link to the new section
# in the revision summary.
$cleanSummary = $wgParser->stripSectionName( $this->summary );
- $this->summary = $context->msg( 'newsectionsummary' )
+ $this->summary = wfMessage( 'newsectionsummary' )
->rawParams( $cleanSummary )->inContentLanguage()->text();
}
} elseif ( $this->section != '' ) {
@@ -1636,8 +1620,8 @@ class EditPage {
( ( $this->minoredit && !$this->isNew ) ? EDIT_MINOR : 0 ) |
( $bot ? EDIT_FORCE_BOT : 0 );
- $doEditStatus = $this->getArticle()->doEditContent( $content, $this->summary, $flags,
- false, null, $this->contentFormat );
+ $doEditStatus = $this->mArticle->doEditContent( $content, $this->summary, $flags,
+ false, null, $this->contentFormat );
if ( $doEditStatus->isOK() ) {
$result['redirect'] = $content->isRedirect();
@@ -1665,21 +1649,21 @@ class EditPage {
* Register the change of watch status
*/
protected function updateWatchlist() {
- $title = $this->getTitle();
- $user = $this->getArticle()->getContext()->getUser();
+ global $wgUser;
- if ( $user->isLoggedIn() && $this->watchthis != $user->isWatched( $title ) ) {
+ if ( $wgUser->isLoggedIn() && $this->watchthis != $wgUser->isWatched( $this->mTitle ) ) {
$fname = __METHOD__;
+ $title = $this->mTitle;
$watch = $this->watchthis;
// Do this in its own transaction to reduce contention...
$dbw = wfGetDB( DB_MASTER );
- $dbw->onTransactionIdle( function() use ( $dbw, $title, $watch, $user, $fname ) {
+ $dbw->onTransactionIdle( function() use ( $dbw, $title, $watch, $wgUser, $fname ) {
$dbw->begin( $fname );
if ( $watch ) {
- WatchAction::doWatch( $title, $user );
+ WatchAction::doWatch( $title, $wgUser );
} else {
- WatchAction::doUnwatch( $title, $user );
+ WatchAction::doUnwatch( $title, $wgUser );
}
$dbw->commit( $fname );
} );
@@ -1698,36 +1682,14 @@ class EditPage {
function mergeChangesInto( &$editText ){
ContentHandler::deprecated( __METHOD__, "1.21" );
- wfProfileIn( __METHOD__ );
-
- $db = wfGetDB( DB_MASTER );
-
- // This is the revision the editor started from
- $baseRevision = $this->getBaseRevision();
- if ( is_null( $baseRevision ) ) {
- wfProfileOut( __METHOD__ );
- return false;
- }
- $baseText = $baseRevision->getText();
-
- // The current state, we want to merge updates into it
- $currentRevision = Revision::loadFromTitle( $db, $this->mTitle );
- if ( is_null( $currentRevision ) ) {
- wfProfileOut( __METHOD__ );
- return false;
- }
- $currentText = $currentRevision->getText();
+ $editContent = $this->toEditContent( $editText );
- $result = '';
- $editText = $this->toEditText( $editText );
+ $ok = $this->mergeChangesIntoContent( $editContent );
- if ( wfMerge( $baseText, $editText, $currentText, $result ) ) {
- $editText = $result;
- wfProfileOut( __METHOD__ );
+ if ( $ok ) {
+ $editText = $this->toEditText( $editContent );
return true;
}
-
- wfProfileOut( __METHOD__ );
return false;
}
@@ -1754,7 +1716,7 @@ class EditPage {
}
// The current state, we want to merge updates into it
- $currentRevision = Revision::loadFromTitle( $db, $this->getTitle() );
+ $currentRevision = Revision::loadFromTitle( $db, $this->mTitle );
$currentContent = $currentRevision ? $currentRevision->getContent() : null;
if ( is_null( $currentContent ) ) {
@@ -1770,10 +1732,10 @@ class EditPage {
$editContent = $result;
wfProfileOut( __METHOD__ );
return true;
+ } else {
+ wfProfileOut( __METHOD__ );
+ return false;
}
-
- wfProfileOut( __METHOD__ );
- return false;
}
/**
@@ -1783,7 +1745,7 @@ class EditPage {
if ( !$this->mBaseRevision ) {
$db = wfGetDB( DB_MASTER );
$baseRevision = Revision::loadFromTimestamp(
- $db, $this->getTitle(), $this->edittime );
+ $db, $this->mTitle, $this->edittime );
return $this->mBaseRevision = $baseRevision;
} else {
return $this->mBaseRevision;
@@ -1829,26 +1791,24 @@ class EditPage {
return $matches[0];
}
}
-
return false;
}
function setHeaders() {
- $context = $this->getArticle()->getContext();
- $out = $context->getOutput();
+ global $wgOut, $wgUser;
- $out->addModules( 'mediawiki.action.edit' );
+ $wgOut->addModules( 'mediawiki.action.edit' );
- if ( $context->getUser()->getOption( 'uselivepreview', false ) ) {
- $out->addModules( 'mediawiki.action.edit.preview' );
+ if ( $wgUser->getOption( 'uselivepreview', false ) ) {
+ $wgOut->addModules( 'mediawiki.action.edit.preview' );
}
// Bug #19334: textarea jumps when editing articles in IE8
- $out->addStyle( 'common/IE80Fixes.css', 'screen', 'IE 8' );
+ $wgOut->addStyle( 'common/IE80Fixes.css', 'screen', 'IE 8' );
- $out->setRobotPolicy( 'noindex,nofollow' );
+ $wgOut->setRobotPolicy( 'noindex,nofollow' );
# Enabled article-related sidebar, toplinks, etc.
- $out->setArticleRelated( true );
+ $wgOut->setArticleRelated( true );
$contextTitle = $this->getContextTitle();
if ( $this->isConflict ) {
@@ -1864,37 +1824,36 @@ class EditPage {
if ( $displayTitle === false ) {
$displayTitle = $contextTitle->getPrefixedText();
}
- $out->setPageTitle( $context->msg( $msg, $displayTitle ) );
+ $wgOut->setPageTitle( wfMessage( $msg, $displayTitle ) );
}
/**
* Show all applicable editing introductions
*/
protected function showIntro() {
+ global $wgOut, $wgUser;
if ( $this->suppressIntro ) {
return;
}
- $namespace = $this->getTitle()->getNamespace();
- $context = $this->getArticle()->getContext();
- $out = $context->getOutput();
+ $namespace = $this->mTitle->getNamespace();
if ( $namespace == NS_MEDIAWIKI ) {
# Show a warning if editing an interface message
- $out->wrapWikiMsg( "
\n$1\n
", 'editinginterface' );
+ $wgOut->wrapWikiMsg( "
\n$1\n
", 'editinginterface' );
} else if( $namespace == NS_FILE ) {
# Show a hint to shared repo
- $file = wfFindFile( $this->getTitle() );
+ $file = wfFindFile( $this->mTitle );
if( $file && !$file->isLocal() ) {
$descUrl = $file->getDescriptionUrl();
# there must be a description url to show a hint to shared repo
if( $descUrl ) {
- if( !$this->getTitle()->exists() ) {
- $out->wrapWikiMsg( "
", array(
'sharedupload-desc-edit', $file->getRepo()->getDisplayName(), $descUrl
) );
}
@@ -1905,16 +1864,16 @@ class EditPage {
# Show a warning message when someone creates/edits a user (talk) page but the user does not exist
# Show log extract when the user is currently blocked
if ( $namespace == NS_USER || $namespace == NS_USER_TALK ) {
- $parts = explode( '/', $this->getTitle()->getText(), 2 );
+ $parts = explode( '/', $this->mTitle->getText(), 2 );
$username = $parts[0];
$user = User::newFromName( $username, false /* allow IP users*/ );
$ip = User::isIP( $username );
if ( !( $user && $user->isLoggedIn() ) && !$ip ) { # User does not exist
- $out->wrapWikiMsg( "
\n$1\n
",
+ $wgOut->wrapWikiMsg( "
\n$1\n
",
array( 'userpage-userdoesnotexist', wfEscapeWikiText( $username ) ) );
} elseif ( $user->isBlocked() ) { # Show log extract if the user is currently blocked
LogEventsList::showLogExtract(
- $out,
+ $wgOut,
'block',
$user->getUserPage(),
'',
@@ -1929,19 +1888,17 @@ class EditPage {
);
}
}
-
# Try to add a custom edit intro, or use the standard one if this is not possible.
- if ( !$this->showCustomIntro() && !$this->getTitle()->exists() ) {
- if ( $context->getUser()->isLoggedIn() ) {
- $out->wrapWikiMsg( "
\n$1\n
", 'newarticletext' );
+ if ( !$this->showCustomIntro() && !$this->mTitle->exists() ) {
+ if ( $wgUser->isLoggedIn() ) {
+ $wgOut->wrapWikiMsg( "
", 'newarticletextanon' );
}
}
-
# Give a notice if the user is editing a deleted/moved page...
- if ( !$this->getTitle()->exists() ) {
- LogEventsList::showLogExtract( $out, array( 'delete', 'move' ), $this->getTitle(),
+ if ( !$this->mTitle->exists() ) {
+ LogEventsList::showLogExtract( $wgOut, array( 'delete', 'move' ), $this->mTitle,
'',
array(
'lim' => 10,
@@ -1961,16 +1918,13 @@ class EditPage {
protected function showCustomIntro() {
if ( $this->editintro ) {
$title = Title::newFromText( $this->editintro );
-
if ( $title instanceof Title && $title->exists() && $title->userCan( 'read' ) ) {
+ global $wgOut;
// Added using template syntax, to take 's into account.
- $this->getArticle()->getContext()->getOutput()
- ->addWikiTextTitleTidy( '{{:' . $title->getFullText() . '}}', $this->mTitle );
-
+ $wgOut->addWikiTextTitleTidy( '{{:' . $title->getFullText() . '}}', $this->mTitle );
return true;
}
}
-
return false;
}
@@ -2043,6 +1997,8 @@ class EditPage {
* during form output near the top, for captchas and the like.
*/
function showEditForm( $formCallback = null ) {
+ global $wgOut, $wgUser;
+
wfProfileIn( __METHOD__ );
# need to parse the preview early so that we know which templates are used,
@@ -2054,9 +2010,7 @@ class EditPage {
$previewOutput = $this->getPreviewText();
}
- $context = $this->getArticle()->getContext();
- $out = $context->getOutput();
- wfRunHooks( 'EditPage::showEditForm:initial', array( &$this, &$out ) );
+ wfRunHooks( 'EditPage::showEditForm:initial', array( &$this, &$wgOut ) );
$this->setHeaders();
@@ -2065,13 +2019,13 @@ class EditPage {
return;
}
- $out->addHTML( $this->editFormPageTop );
+ $wgOut->addHTML( $this->editFormPageTop );
- if ( $context->getUser()->getOption( 'previewontop' ) ) {
+ if ( $wgUser->getOption( 'previewontop' ) ) {
$this->displayPreviewArea( $previewOutput, true );
}
- $out->addHTML( $this->editFormTextTop );
+ $wgOut->addHTML( $this->editFormTextTop );
$showToolbar = true;
if ( $this->wasDeletedSinceLastEdit() ) {
@@ -2080,22 +2034,22 @@ class EditPage {
// Add an confirmation checkbox and explanation.
$showToolbar = false;
} else {
- $out->wrapWikiMsg( "
\n$1\n
",
+ $wgOut->wrapWikiMsg( "
\n$1\n
",
'deletedwhileediting' );
}
}
- // @todo Add EditForm plugin interface and use it here!
+ //@todo: add EditForm plugin interface and use it here!
// search for textarea1 and textares2, and allow EditForm to override all uses.
- $out->addHTML( Html::openElement( 'form', array( 'id' => self::EDITFORM_ID, 'name' => self::EDITFORM_ID,
+ $wgOut->addHTML( Html::openElement( 'form', array( 'id' => self::EDITFORM_ID, 'name' => self::EDITFORM_ID,
'method' => 'post', 'action' => $this->getActionURL( $this->getContextTitle() ),
'enctype' => 'multipart/form-data' ) ) );
if ( is_callable( $formCallback ) ) {
- call_user_func_array( $formCallback, array( &$out ) );
+ call_user_func_array( $formCallback, array( &$wgOut ) );
}
- wfRunHooks( 'EditPage::showEditForm:fields', array( &$this, &$out ) );
+ wfRunHooks( 'EditPage::showEditForm:fields', array( &$this, &$wgOut ) );
// Put these up at the top to ensure they aren't lost on early form submission
$this->showFormBeforeText();
@@ -2105,14 +2059,14 @@ class EditPage {
$comment = $this->lastDelete->log_comment;
// It is better to not parse the comment at all than to have templates expanded in the middle
- // @todo Can the checkLabel be moved outside of the div so that wrapWikiMsg could be used?
+ // TODO: can the checkLabel be moved outside of the div so that wrapWikiMsg could be used?
$key = $comment === ''
? 'confirmrecreate-noreason'
: 'confirmrecreate';
- $out->addHTML(
+ $wgOut->addHTML(
'
", 'explainconflict' );
+ $this->edittime = $this->mArticle->getTimestamp();
} else {
if ( $this->section != '' && !$this->isSectionEditSupported() ) {
// We use $this->section to much before this and getVal('wgSection') directly in other places
// at this point we can't reset $this->section to '' to fallback to non-section editing.
// Someone is welcome to try refactoring though
- $out->showErrorPage( 'sectioneditnotsupported-title', 'sectioneditnotsupported-text' );
+ $wgOut->showErrorPage( 'sectioneditnotsupported-title', 'sectioneditnotsupported-text' );
return false;
}
@@ -2290,93 +2241,89 @@ class EditPage {
}
if ( $this->missingComment ) {
- $out->wrapWikiMsg( "
\n" );
}
/**
@@ -2877,24 +2790,23 @@ HTML
* If you want to use another entry point to this function, be careful.
*/
protected function showConflict() {
- $context = $this->getArticle()->getContext();
- $out = $context->getOutput();
+ global $wgOut;
- if ( wfRunHooks( 'EditPageBeforeConflictDiff', array( &$this, &$out ) ) ) {
- $out->wrapWikiMsg( '