Index: trunk/phase3/includes/Article.php |
— | — | @@ -357,6 +357,18 @@ |
358 | 358 | } |
359 | 359 | |
360 | 360 | /** |
| 361 | + * Get the fetched Revision object depending on request parameters or null |
| 362 | + * on failure. |
| 363 | + * |
| 364 | + * @return Revision|null |
| 365 | + */ |
| 366 | + public function getRevisionFetched() { |
| 367 | + $this->fetchContent(); |
| 368 | + |
| 369 | + return $this->mRevision; |
| 370 | + } |
| 371 | + |
| 372 | + /** |
361 | 373 | * Use this to fetch the rev ID used on page views |
362 | 374 | * |
363 | 375 | * @return int revision ID of last article revision |
Index: trunk/phase3/includes/EditPage.php |
— | — | @@ -627,7 +627,6 @@ |
628 | 628 | $this->bot = $request->getBool( 'bot', true ); |
629 | 629 | $this->nosummary = $request->getBool( 'nosummary' ); |
630 | 630 | |
631 | | - // @todo FIXME: Unused variable? |
632 | 631 | $this->oldid = $request->getInt( 'oldid' ); |
633 | 632 | |
634 | 633 | $this->live = $request->getCheck( 'live' ); |
— | — | @@ -740,7 +739,7 @@ |
741 | 740 | # Otherwise, $text will be left as-is. |
742 | 741 | if ( !is_null( $undorev ) && !is_null( $oldrev ) && |
743 | 742 | $undorev->getPage() == $oldrev->getPage() && |
744 | | - $undorev->getPage() == $this->mArticle->getID() && |
| 743 | + $undorev->getPage() == $this->mTitle->getArticleId() && |
745 | 744 | !$undorev->isDeleted( Revision::DELETED_TEXT ) && |
746 | 745 | !$oldrev->isDeleted( Revision::DELETED_TEXT ) ) { |
747 | 746 | |
— | — | @@ -1166,10 +1165,11 @@ |
1167 | 1166 | # Article exists. Check for edit conflict. |
1168 | 1167 | |
1169 | 1168 | $this->mArticle->clear(); # Force reload of dates, etc. |
| 1169 | + $timestamp = $this->mArticle->getTimestamp(); |
1170 | 1170 | |
1171 | | - wfDebug( "timestamp: {$this->mArticle->getTimestamp()}, edittime: {$this->edittime}\n" ); |
| 1171 | + wfDebug( "timestamp: {$timestamp}, edittime: {$this->edittime}\n" ); |
1172 | 1172 | |
1173 | | - if ( $this->mArticle->getTimestamp() != $this->edittime ) { |
| 1173 | + if ( $timestamp != $this->edittime ) { |
1174 | 1174 | $this->isConflict = true; |
1175 | 1175 | if ( $this->section == 'new' ) { |
1176 | 1176 | if ( $this->mArticle->getUserText() == $wgUser->getName() && |
— | — | @@ -1199,8 +1199,7 @@ |
1200 | 1200 | } |
1201 | 1201 | |
1202 | 1202 | if ( $this->isConflict ) { |
1203 | | - wfDebug( __METHOD__ . ": conflict! getting section '$this->section' for time '$this->edittime' (article time '" . |
1204 | | - $this->mArticle->getTimestamp() . "')\n" ); |
| 1203 | + wfDebug( __METHOD__ . ": conflict! getting section '$this->section' for time '$this->edittime' (article time '{$timestamp}')\n" ); |
1205 | 1204 | $text = $this->mArticle->replaceSection( $this->section, $this->textbox1, $sectionTitle, $this->edittime ); |
1206 | 1205 | } else { |
1207 | 1206 | wfDebug( __METHOD__ . ": getting section '$this->section'\n" ); |
— | — | @@ -1383,7 +1382,7 @@ |
1384 | 1383 | $res = $dbw->select( 'revision', |
1385 | 1384 | 'rev_user', |
1386 | 1385 | array( |
1387 | | - 'rev_page' => $this->mArticle->getId(), |
| 1386 | + 'rev_page' => $this->mTitle->getArticleId(), |
1388 | 1387 | 'rev_timestamp > '.$dbw->addQuotes( $dbw->timestamp($edittime) ) |
1389 | 1388 | ), |
1390 | 1389 | __METHOD__, |
— | — | @@ -1706,7 +1705,7 @@ |
1707 | 1706 | $autosumm = $this->autoSumm ? $this->autoSumm : md5( $this->summary ); |
1708 | 1707 | $wgOut->addHTML( Html::hidden( 'wpAutoSummary', $autosumm ) ); |
1709 | 1708 | |
1710 | | - $wgOut->addHTML( Html::hidden( 'oldid', $this->mArticle->getOldID() ) ); |
| 1709 | + $wgOut->addHTML( Html::hidden( 'oldid', $this->oldid ) ); |
1711 | 1710 | |
1712 | 1711 | if ( $this->section == 'new' ) { |
1713 | 1712 | $this->showSummaryInput( true, $this->summary ); |
— | — | @@ -1823,18 +1822,21 @@ |
1824 | 1823 | $wgOut->addWikiMsg( 'nonunicodebrowser' ); |
1825 | 1824 | } |
1826 | 1825 | |
1827 | | - if ( $this->section != 'new' && isset( $this->mArticle ) && isset( $this->mArticle->mRevision ) ) { |
1828 | | - // Let sysop know that this will make private content public if saved |
| 1826 | + if ( $this->section != 'new' ) { |
| 1827 | + $revision = $this->mArticle->getRevisionFetched(); |
| 1828 | + if ( $revision ) { |
| 1829 | + // Let sysop know that this will make private content public if saved |
1829 | 1830 | |
1830 | | - if ( !$this->mArticle->mRevision->userCan( Revision::DELETED_TEXT ) ) { |
1831 | | - $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' ); |
1832 | | - } elseif ( $this->mArticle->mRevision->isDeleted( Revision::DELETED_TEXT ) ) { |
1833 | | - $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-view' ); |
1834 | | - } |
| 1831 | + if ( !$revision->userCan( Revision::DELETED_TEXT ) ) { |
| 1832 | + $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-permission' ); |
| 1833 | + } elseif ( $revision->isDeleted( Revision::DELETED_TEXT ) ) { |
| 1834 | + $wgOut->wrapWikiMsg( "<div class='mw-warning plainlinks'>\n$1\n</div>\n", 'rev-deleted-text-view' ); |
| 1835 | + } |
1835 | 1836 | |
1836 | | - if ( !$this->mArticle->mRevision->isCurrent() ) { |
1837 | | - $this->mArticle->setOldSubtitle( $this->mArticle->mRevision->getId() ); |
1838 | | - $wgOut->addWikiMsg( 'editingold' ); |
| 1837 | + if ( !$revision->isCurrent() ) { |
| 1838 | + $this->mArticle->setOldSubtitle( $revision->getId() ); |
| 1839 | + $wgOut->addWikiMsg( 'editingold' ); |
| 1840 | + } |
1839 | 1841 | } |
1840 | 1842 | } |
1841 | 1843 | } |
— | — | @@ -2288,8 +2290,8 @@ |
2289 | 2291 | */ |
2290 | 2292 | public function getCancelLink() { |
2291 | 2293 | $cancelParams = array(); |
2292 | | - if ( !$this->isConflict && $this->mArticle->getOldID() > 0 ) { |
2293 | | - $cancelParams['oldid'] = $this->mArticle->getOldID(); |
| 2294 | + if ( !$this->isConflict && $this->oldid > 0 ) { |
| 2295 | + $cancelParams['oldid'] = $this->oldid; |
2294 | 2296 | } |
2295 | 2297 | |
2296 | 2298 | return Linker::linkKnown( |