X-Git-Url: https://git.cyclocoop.org/%7B%24www_url%7Dadmin/compta/banques/?a=blobdiff_plain;f=includes%2Fskins%2FSkin.php;h=dbb7c7ff02d4632b199d4754634e85ed0da9611f;hb=d762bf4b06634a5f61cab07b893ee879701cbbbd;hp=4e6201cd73e3332c3ab6620f77de73168398762d;hpb=c6bcef30ae0e56d379d34cf9d96e6593238a0341;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/skins/Skin.php b/includes/skins/Skin.php index 4e6201cd73..dbb7c7ff02 100644 --- a/includes/skins/Skin.php +++ b/includes/skins/Skin.php @@ -180,7 +180,7 @@ abstract class Skin extends ContextSource { * @return array Array of modules with helper keys for easy overriding */ public function getDefaultModules() { - global $wgUseAjax, $wgAjaxWatch, $wgEnableAPI, $wgEnableWriteAPI; + global $wgUseAjax, $wgEnableAPI, $wgEnableWriteAPI; $out = $this->getOutput(); $user = $out->getUser(); @@ -201,7 +201,7 @@ abstract class Skin extends ContextSource { // Add various resources if required if ( $wgUseAjax && $wgEnableAPI ) { - if ( $wgEnableWriteAPI && $wgAjaxWatch && $user->isLoggedIn() + if ( $wgEnableWriteAPI && $user->isLoggedIn() && $user->isAllowedAll( 'writeapi', 'viewmywatchlist', 'editmywatchlist' ) && $this->getRelevantTitle()->canExist() ) { @@ -232,7 +232,7 @@ abstract class Skin extends ContextSource { $title = $this->getRelevantTitle(); // User/talk link - if ( $user->isLoggedIn() || $this->showIPinHeader() ) { + if ( $user->isLoggedIn() ) { $titles[] = $user->getUserPage(); $titles[] = $user->getTalkPage(); } @@ -725,12 +725,12 @@ abstract class Skin extends ContextSource { } /** - * 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; } /** @@ -1225,29 +1225,31 @@ abstract class Skin extends ContextSource { 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; } /** @@ -1259,7 +1261,7 @@ abstract class Skin extends ContextSource { * @param array $bar * @param string $message */ - function addToSidebar( &$bar, $message ) { + public function addToSidebar( &$bar, $message ) { $this->addToSidebarPlain( $bar, wfMessage( $message )->inContentLanguage()->plain() ); } @@ -1443,8 +1445,8 @@ abstract class Skin extends ContextSource { )->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(); @@ -1457,7 +1459,7 @@ abstract class Skin extends ContextSource { } $parts = implode( $sep, $msgs ); $newMessagesAlert = $this->msg( 'youhavenewmessagesmulti' )->rawParams( $parts )->escaped(); - $out->setSquidMaxage( 0 ); + $out->setCdnMaxage( 0 ); } return $newMessagesAlert; @@ -1516,24 +1518,6 @@ abstract class Skin extends ContextSource { 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 ) != '

<' ) { - $namespaceNotice = '

' . $namespaceNotice . '
'; - } else { - $namespaceNotice = ''; - } - - return $namespaceNotice; - } - /** * Get the site notice *