*
* @file
*/
+use MediaWiki\MediaWikiServices;
/**
* Class for viewing MediaWiki article and history.
$useParserCache = $this->mPage->shouldCheckParserCache( $parserOptions, $oldid );
wfDebug( 'Article::view using parser cache: ' . ( $useParserCache ? 'yes' : 'no' ) . "\n" );
if ( $user->getStubThreshold() ) {
- $this->getContext()->getStats()->increment( 'pcache_miss_stub' );
+ MediaWikiServices::getInstance()->getStatsdDataFactory()->increment( 'pcache_miss_stub' );
}
$this->showRedirectedFromHeader();
$this->showViewFooter();
$this->mPage->doViewUpdates( $user, $oldid );
- $outputPage->addModules( 'mediawiki.action.view.postEdit' );
+ # Load the postEdit module if the user just saved this revision
+ # See also EditPage::setPostEditCookie
+ $request = $this->getContext()->getRequest();
+ $cookieKey = EditPage::POST_EDIT_COOKIE_KEY_PREFIX . $this->getRevIdFetched();
+ $postEdit = $request->getCookie( $cookieKey );
+ if ( $postEdit ) {
+ # Clear the cookie. This also prevents caching of the response.
+ $request->response()->clearCookie( $cookieKey );
+ $outputPage->addJsConfigVars( 'wgPostEdit', $postEdit );
+ $outputPage->addModules( 'mediawiki.action.view.postEdit' );
+ }
}
/**
}
// Check for cached results
- $key = wfMemcKey( 'unpatrollable-page', $title->getArticleID() );
- $cache = ObjectCache::getMainWANInstance();
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ $key = $cache->makeKey( 'unpatrollable-page', $title->getArticleID() );
if ( $cache->get( $key ) ) {
return false;
}
* @since 1.27
*/
public static function purgePatrolFooterCache( $articleID ) {
- $cache = ObjectCache::getMainWANInstance();
- $cache->delete( wfMemcKey( 'unpatrollable-page', $articleID ) );
+ $cache = MediaWikiServices::getInstance()->getMainWANObjectCache();
+ $cache->delete( $cache->makeKey( 'unpatrollable-page', $articleID ) );
}
/**
|| $title->getNamespace() == NS_USER_TALK
) {
$rootPart = explode( '/', $title->getText() )[0];
- $user = User::newFromName( $rootPart, false /* allow IP users*/ );
+ $user = User::newFromName( $rootPart, false /* allow IP users */ );
$ip = User::isIP( $rootPart );
$block = Block::newFromTarget( $user, $user );
# Show delete and move logs if there were any such events.
# The logging query can DOS the site when bots/crawlers cause 404 floods,
# so be careful showing this. 404 pages must be cheap as they are hard to cache.
- $cache = ObjectCache::getMainStashInstance();
- $key = wfMemcKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
+ $cache = MediaWikiServices::getInstance()->getMainObjectStash();
+ $key = $cache->makeKey( 'page-recent-delete', md5( $title->getPrefixedText() ) );
$loggedIn = $this->getContext()->getUser()->isLoggedIn();
if ( $loggedIn || $cache->get( $key ) ) {
$logTypes = [ 'delete', 'move' ];
/**
* Call to WikiPage function for backwards compatibility.
* @see WikiPage::doPurge
+ * @note In 1.28 (and only 1.28), this took a $flags parameter that
+ * controlled how much purging was done.
*/
- public function doPurge( $flags = WikiPage::PURGE_ALL ) {
- return $this->mPage->doPurge( $flags );
+ public function doPurge() {
+ return $this->mPage->doPurge();
}
/**
* Call to WikiPage function for backwards compatibility.
* @see WikiPage::getLastPurgeTimestamp
+ * @deprecated since 1.29
*/
public function getLastPurgeTimestamp() {
+ wfDeprecated( __METHOD__, '1.29' );
return $this->mPage->getLastPurgeTimestamp();
}