$title = $this->getRelevantTitle();
// User/talk link
- if ( $user->isLoggedIn() || $this->showIPinHeader() ) {
+ if ( $user->isLoggedIn() ) {
$titles[] = $user->getUserPage();
$titles[] = $user->getTalkPage();
}
}
/**
- * Returns true if the IP should be shown in the header
- * @return bool
+ * @deprecated since 1.27, feature removed
+ * @return bool Always false
*/
function showIPinHeader() {
- global $wgShowIPinHeader;
- return $wgShowIPinHeader && session_id() != '';
+ wfDeprecated( __METHOD__, '1.27' );
+ return false;
}
/**
function buildSidebar() {
global $wgEnableSidebarCache, $wgSidebarCacheExpiry;
- $cache = ObjectCache::getMainWANInstance();
- $key = wfMemcKey( 'sidebar', $this->getLanguage()->getCode() );
-
- if ( $wgEnableSidebarCache ) {
- $cachedsidebar = $cache->get( $key );
- if ( $cachedsidebar ) {
- Hooks::run( 'SidebarBeforeOutput', array( $this, &$cachedsidebar ) );
-
- return $cachedsidebar;
- }
- }
+ $that = $this;
+ $callback = function () use ( $that ) {
+ $bar = array();
+ $that->addToSidebar( $bar, 'sidebar' );
+ Hooks::run( 'SkinBuildSidebar', array( $that, &$bar ) );
- $bar = array();
- $this->addToSidebar( $bar, 'sidebar' );
+ return $bar;
+ };
- Hooks::run( 'SkinBuildSidebar', array( $this, &$bar ) );
if ( $wgEnableSidebarCache ) {
- $cache->set( $key, $bar, $wgSidebarCacheExpiry );
+ $cache = ObjectCache::getMainWANInstance();
+ $sidebar = $cache->getWithSetCallback(
+ $cache->makeKey( 'sidebar', $this->getLanguage()->getCode() ),
+ $wgSidebarCacheExpiry,
+ $callback,
+ array( 'lockTSE' => 30 )
+ );
+ } else {
+ $sidebar = $callback();
}
- Hooks::run( 'SidebarBeforeOutput', array( $this, &$bar ) );
+ // Apply post-processing to the cached value
+ Hooks::run( 'SidebarBeforeOutput', array( $this, &$sidebar ) );
- return $bar;
+ return $sidebar;
}
/**
* @param array $bar
* @param string $message
*/
- function addToSidebar( &$bar, $message ) {
+ public function addToSidebar( &$bar, $message ) {
$this->addToSidebarPlain( $bar, wfMessage( $message )->inContentLanguage()->plain() );
}
)->numParams( $plural );
}
$newMessagesAlert = $newMessagesAlert->text();
- # Disable Squid cache
- $out->setSquidMaxage( 0 );
+ # Disable CDN cache
+ $out->setCdnMaxage( 0 );
} elseif ( count( $newtalks ) ) {
$sep = $this->msg( 'newtalkseparator' )->escaped();
$msgs = array();
}
$parts = implode( $sep, $msgs );
$newMessagesAlert = $this->msg( 'youhavenewmessagesmulti' )->rawParams( $parts )->escaped();
- $out->setSquidMaxage( 0 );
+ $out->setCdnMaxage( 0 );
}
return $newMessagesAlert;
return $notice;
}
- /**
- * Get a notice based on page's namespace
- *
- * @return string HTML fragment
- */
- function getNamespaceNotice() {
-
- $key = 'namespacenotice-' . $this->getTitle()->getNsText();
- $namespaceNotice = $this->getCachedNotice( $key );
- if ( $namespaceNotice && substr( $namespaceNotice, 0, 7 ) != '<p><' ) {
- $namespaceNotice = '<div id="namespacebanner">' . $namespaceNotice . '</div>';
- } else {
- $namespaceNotice = '';
- }
-
- return $namespaceNotice;
- }
-
/**
* Get the site notice
*