X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2FArticle.php;h=25b0d92ed94766253616989de068a9ea6c3e48e2;hb=4701a65c0817ed6250d9e94c9007f48f61891346;hp=f073b5a75c943b8e4feb77bc1edcd608df1050b2;hpb=2629c3649facd6f6bcdccf7f3e62cd43eed73493;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/Article.php b/includes/Article.php index f073b5a75c..25b0d92ed9 100644 --- a/includes/Article.php +++ b/includes/Article.php @@ -270,6 +270,7 @@ class Article extends Page { * @deprecated in 1.19; use fetchContent() */ function loadContent() { + wfDeprecated( __METHOD__, '1.19' ); $this->fetchContent(); } @@ -338,7 +339,7 @@ class Article extends Page { * @deprecated since 1.18 */ public function forUpdate() { - wfDeprecated( __METHOD__ ); + wfDeprecated( __METHOD__, '1.18' ); } /** @@ -355,6 +356,18 @@ class Article extends Page { return $this->mPage->exists() && $this->mRevision && $this->mRevision->isCurrent(); } + /** + * Get the fetched Revision object depending on request parameters or null + * on failure. + * + * @return Revision|null + */ + public function getRevisionFetched() { + $this->fetchContent(); + + return $this->mRevision; + } + /** * Use this to fetch the rev ID used on page views * @@ -445,7 +458,7 @@ class Article extends Page { wfDebug( __METHOD__ . ": done file cache\n" ); # tell wgOut that output is taken care of $wgOut->disable(); - $this->mPage->viewUpdates(); + $this->mPage->doViewUpdates( $wgUser ); wfProfileOut( __METHOD__ ); return; @@ -498,8 +511,11 @@ class Article extends Page { # the correct version information. $wgOut->setRevisionId( $this->mPage->getLatest() ); # Preload timestamp to avoid a DB hit - $wgOut->setRevisionTimestamp( $this->mParserOutput->getTimestamp() ); - $this->mPage->setTimestamp( $this->mParserOutput->getTimestamp() ); + $cachedTimestamp = $this->mParserOutput->getTimestamp(); + if ( $cachedTimestamp !== null ) { + $wgOut->setRevisionTimestamp( $cachedTimestamp ); + $this->mPage->setTimestamp( $cachedTimestamp ); + } $outputDone = true; } } @@ -614,7 +630,7 @@ class Article extends Page { $wgOut->setFollowPolicy( $policy['follow'] ); $this->showViewFooter(); - $this->mPage->viewUpdates(); + $this->mPage->doViewUpdates( $wgUser ); wfProfileOut( __METHOD__ ); } @@ -653,7 +669,7 @@ class Article extends Page { if ( $diff == 0 || $diff == $this->mPage->getLatest() ) { # Run view updates for current revision only - $this->mPage->viewUpdates(); + $this->mPage->doViewUpdates( $wgUser ); } } @@ -1143,21 +1159,8 @@ class Article extends Page { array( 'known', 'noclasses' ) ); - $cdel = ''; - - // User can delete revisions or view deleted revisions... - $canHide = $wgUser->isAllowed( 'deleterevision' ); - if ( $canHide || ( $revision->getVisibility() && $wgUser->isAllowed( 'deletedhistory' ) ) ) { - if ( !$revision->userCan( Revision::DELETED_RESTRICTED ) ) { - $cdel = Linker::revDeleteLinkDisabled( $canHide ); // rev was hidden from Sysops - } else { - $query = array( - 'type' => 'revision', - 'target' => $this->getTitle()->getPrefixedDbkey(), - 'ids' => $oldid - ); - $cdel = Linker::revDeleteLink( $query, $revision->isDeleted( File::DELETED_RESTRICTED ), $canHide ); - } + $cdel = Linker::getRevDeleteLink( $wgUser, $revision, $this->getTitle() ); + if ( $cdel !== '' ) { $cdel .= ' '; } @@ -1285,18 +1288,6 @@ class Article extends Page { return; } - # Hack for big sites - $bigHistory = $this->mPage->isBigDeletion(); - if ( $bigHistory && !$title->userCan( 'bigdelete' ) ) { - global $wgDeleteRevisionsLimit; - - $wgOut->setPageTitle( wfMessage( 'cannotdelete-title', $title->getPrefixedText() ) ); - $wgOut->wrapWikiMsg( "
\n$1\n
\n", - array( 'delete-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) ); - - return; - } - $deleteReasonList = $wgRequest->getText( 'wpDeleteReasonList', 'other' ); $deleteReason = $wgRequest->getText( 'wpReason' ); @@ -1334,7 +1325,7 @@ class Article extends Page { // If the page has a history, insert a warning if ( $hasHistory ) { - $revisions = $this->mPage->estimateRevisionCount(); + $revisions = $this->mTitle->estimateRevisionCount(); // @todo FIXME: i18n issue/patchwork message $wgOut->addHTML( '' . wfMsgExt( 'historywarning', array( 'parseinline' ), $wgLang->formatNum( $revisions ) ) . @@ -1345,7 +1336,7 @@ class Article extends Page { '' ); - if ( $bigHistory ) { + if ( $this->mTitle->isBigDeletion() ) { global $wgDeleteRevisionsLimit; $wgOut->wrapWikiMsg( "
\n$1\n
\n", array( 'delete-warning-toobig', $wgLang->formatNum( $wgDeleteRevisionsLimit ) ) ); @@ -1469,10 +1460,8 @@ class Article extends Page { public function doDelete( $reason, $suppress = false ) { global $wgOut; - $id = $this->getTitle()->getArticleID( Title::GAID_FOR_UPDATE ); - $error = ''; - if ( $this->mPage->doDeleteArticle( $reason, $suppress, $id, true, $error ) ) { + if ( $this->mPage->doDeleteArticle( $reason, $suppress, 0, true, $error ) ) { $deleted = $this->getTitle()->getPrefixedText(); $wgOut->setPageTitle( wfMessage( 'actioncomplete' ) ); @@ -1620,6 +1609,7 @@ class Article extends Page { * @deprecated since 1.19 */ public function info() { + wfDeprecated( __METHOD__, '1.19' ); Action::factory( 'info', $this )->show(); } @@ -1628,6 +1618,7 @@ class Article extends Page { * @deprecated since 1.18 */ public function markpatrolled() { + wfDeprecated( __METHOD__, '1.18' ); Action::factory( 'markpatrolled', $this )->show(); } @@ -1644,6 +1635,7 @@ class Article extends Page { * @deprecated since 1.19 */ public function revert() { + wfDeprecated( __METHOD__, '1.19' ); Action::factory( 'revert', $this )->show(); } @@ -1652,6 +1644,7 @@ class Article extends Page { * @deprecated since 1.19 */ public function rollback() { + wfDeprecated( __METHOD__, '1.19' ); Action::factory( 'rollback', $this )->show(); } @@ -1661,6 +1654,7 @@ class Article extends Page { * @deprecated since 1.18 */ public function watch() { + wfDeprecated( __METHOD__, '1.18' ); Action::factory( 'watch', $this )->show(); } @@ -1674,6 +1668,7 @@ class Article extends Page { */ public function doWatch() { global $wgUser; + wfDeprecated( __METHOD__, '1.18' ); return WatchAction::doWatch( $this->getTitle(), $wgUser ); } @@ -1683,6 +1678,7 @@ class Article extends Page { * @deprecated since 1.18 */ public function unwatch() { + wfDeprecated( __METHOD__, '1.18' ); Action::factory( 'unwatch', $this )->show(); } @@ -1693,6 +1689,7 @@ class Article extends Page { */ public function doUnwatch() { global $wgUser; + wfDeprecated( __METHOD__, '1.18' ); return WatchAction::doUnwatch( $this->getTitle(), $wgUser ); } @@ -1706,7 +1703,7 @@ class Article extends Page { * @param $extraQuery String: extra query params */ public function doRedirect( $noRedir = false, $sectionAnchor = '', $extraQuery = '' ) { - wfDeprecated( __METHOD__ ); + wfDeprecated( __METHOD__, '1.18' ); global $wgOut; if ( $noRedir ) { @@ -1770,6 +1767,18 @@ class Article extends Page { // ****** B/C functions to work-around PHP silliness with __call and references ****** // + /** + * @param $limit array + * @param $expiry array + * @param $cascade bool + * @param $reason string + * @param $user User + * @return Status + */ + public function doUpdateRestrictions( array $limit, array $expiry, &$cascade, $reason, User $user ) { + return $this->mPage->doUpdateRestrictions( $limit, $expiry, $cascade, $reason, $user ); + } + /** * @param $limit array * @param $reason string