X-Git-Url: http://git.cyclocoop.org/%7B%7B%20url_for%28%27admin_vote_del%27%2C%20idvote=vote.voteid%29%20%7D%7D?a=blobdiff_plain;f=includes%2FEditPage.php;h=58936e0678995d27be9432f92aaaef652ba36d7a;hb=7d48609b6a5f1833dcf706d17d4408b5d1aa3811;hp=023c170e83ed4aebb0d68eb9250bf8ad45d03611;hpb=685c6fd8885b490cb3dac1589686e3b5442aa9d9;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/EditPage.php b/includes/EditPage.php index 023c170e83..58936e0678 100644 --- a/includes/EditPage.php +++ b/includes/EditPage.php @@ -201,6 +201,8 @@ class EditPage { /** @var Article */ public $mArticle; + /** @var WikiPage */ + private $page; /** @var Title */ public $mTitle; @@ -399,6 +401,7 @@ class EditPage { */ public function __construct( Article $article ) { $this->mArticle = $article; + $this->page = $article->getPage(); // model object $this->mTitle = $article->getTitle(); $this->contentModel = $this->mTitle->getContentModel(); @@ -1002,6 +1005,7 @@ class EditPage { * for saving, preview parsing and so on... * * @param WebRequest $request + * @return string|null */ protected function importContentFormData( &$request ) { return; // Don't do anything, EditPage already extracted wpTextbox1 @@ -1014,7 +1018,7 @@ class EditPage { */ function initialiseForm() { global $wgUser; - $this->edittime = $this->mArticle->getTimestamp(); + $this->edittime = $this->page->getTimestamp(); $content = $this->getContentObject( false ); # TODO: track content object?! if ( $content === false ) { @@ -1098,13 +1102,13 @@ class EditPage { !$undorev->isDeleted( Revision::DELETED_TEXT ) && !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { - $content = $this->mArticle->getUndoContent( $undorev, $oldrev ); + $content = $this->page->getUndoContent( $undorev, $oldrev ); if ( $content === false ) { # Warn the user that something went wrong $undoMsg = 'failure'; } else { - $oldContent = $this->mArticle->getPage()->getContent( Revision::RAW ); + $oldContent = $this->page->getContent( Revision::RAW ); $popts = ParserOptions::newFromUserAndLang( $wgUser, $wgContLang ); $newContent = $content->preSaveTransform( $this->mTitle, $wgUser, $popts ); @@ -1227,7 +1231,7 @@ class EditPage { * @return Content */ protected function getCurrentContent() { - $rev = $this->mArticle->getRevision(); + $rev = $this->page->getRevision(); $content = $rev ? $rev->getContent( Revision::RAW ) : null; if ( $content === false || $content === null ) { @@ -1357,7 +1361,7 @@ class EditPage { * @param int $statusValue The status value (to check for new article status) */ protected function setPostEditCookie( $statusValue ) { - $revisionId = $this->mArticle->getLatest(); + $revisionId = $this->page->getLatest(); $postEditKey = self::POST_EDIT_COOKIE_KEY_PREFIX . $revisionId; $val = 'saved'; @@ -1780,8 +1784,8 @@ 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->mArticle->loadPageData( 'fromdbmaster' ); - $new = !$this->mArticle->exists(); + $this->page->loadPageData( 'fromdbmaster' ); + $new = !$this->page->exists(); if ( $new ) { // Late check for create permission, just in case *PARANOIA* @@ -1833,16 +1837,16 @@ class EditPage { # Article exists. Check for edit conflict. - $this->mArticle->clear(); # Force reload of dates, etc. - $timestamp = $this->mArticle->getTimestamp(); + $this->page->clear(); # Force reload of dates, etc. + $timestamp = $this->page->getTimestamp(); wfDebug( "timestamp: {$timestamp}, edittime: {$this->edittime}\n" ); if ( $timestamp != $this->edittime ) { $this->isConflict = true; if ( $this->section == 'new' ) { - if ( $this->mArticle->getUserText() == $wgUser->getName() && - $this->mArticle->getComment() == $this->newSectionSummary() + if ( $this->page->getUserText() == $wgUser->getName() && + $this->page->getComment() == $this->newSectionSummary() ) { // Probably a duplicate submission of a new comment. // This can happen when squid resends a request after @@ -1880,7 +1884,7 @@ class EditPage { . ": conflict! getting section '{$this->section}' for time '{$this->edittime}'" . " (article time '{$timestamp}')\n" ); - $content = $this->mArticle->replaceSectionContent( + $content = $this->page->replaceSectionContent( $this->section, $textbox_content, $sectionTitle, @@ -1888,7 +1892,7 @@ class EditPage { ); } else { wfDebug( __METHOD__ . ": getting section '{$this->section}'\n" ); - $content = $this->mArticle->replaceSectionContent( + $content = $this->page->replaceSectionContent( $this->section, $textbox_content, $sectionTitle @@ -2003,7 +2007,7 @@ class EditPage { ( ( $this->minoredit && !$this->isNew ) ? EDIT_MINOR : 0 ) | ( $bot ? EDIT_FORCE_BOT : 0 ); - $doEditStatus = $this->mArticle->doEditContent( + $doEditStatus = $this->page->doEditContent( $content, $this->summary, $flags, @@ -2653,7 +2657,7 @@ class EditPage { Linker::formatTemplates( $this->getTemplates(), $this->preview, $this->section != '' ) ) ); $wgOut->addHTML( Html::rawElement( 'div', array( 'class' => 'hiddencats' ), - Linker::formatHiddenCategories( $this->mArticle->getHiddenCategories() ) ) ); + Linker::formatHiddenCategories( $this->page->getHiddenCategories() ) ) ); $wgOut->addHTML( Html::rawElement( 'div', array( 'class' => 'limitreport' ), self::getPreviewLimitReport( $this->mParserOutput ) ) ); @@ -2730,7 +2734,7 @@ class EditPage { if ( $this->isConflict ) { $wgOut->wrapWikiMsg( "