Remove empty lines at begin of function, if, foreach, switch
[lhc/web/wiklou.git] / includes / skins / Skin.php
index 7f00767..6834ca5 100644 (file)
@@ -158,8 +158,17 @@ abstract class Skin extends ContextSource {
                global $wgUseAjax, $wgEnableAPI, $wgEnableWriteAPI;
 
                $out = $this->getOutput();
+               $config = $this->getConfig();
                $user = $out->getUser();
                $modules = [
+                       // modules not specific to any specific skin or page
+                       'core' => [
+                               // Enforce various default modules for all pages and all skins
+                               // Keep this list as small as possible
+                               'site',
+                               'mediawiki.page.startup',
+                               'mediawiki.user',
+                       ],
                        // modules that enhance the page content in some way
                        'content' => [
                                'mediawiki.page.ready',
@@ -172,6 +181,11 @@ abstract class Skin extends ContextSource {
                        'user' => [],
                ];
 
+               // Support for high-density display images if enabled
+               if ( $config->get( 'ResponsiveImages' ) ) {
+                       $modules['core'][] = 'mediawiki.hidpi';
+               }
+
                // Preload jquery.tablesorter for mediawiki.page.ready
                if ( strpos( $out->getHTML(), 'sortable' ) !== false ) {
                        $modules['content'][] = 'jquery.tablesorter';
@@ -182,6 +196,10 @@ abstract class Skin extends ContextSource {
                        $modules['content'][] = 'jquery.makeCollapsible';
                }
 
+               if ( $out->isTOCEnabled() ) {
+                       $modules['content'][] = 'mediawiki.toc';
+               }
+
                // Add various resources if required
                if ( $wgUseAjax && $wgEnableAPI ) {
                        if ( $wgEnableWriteAPI && $user->isLoggedIn()
@@ -1373,7 +1391,6 @@ abstract class Skin extends ContextSource {
         * @return string
         */
        function getNewtalks() {
-
                $newMessagesAlert = '';
                $user = $this->getUser();
                $newtalks = $user->getNewMessageLinks();
@@ -1467,7 +1484,7 @@ abstract class Skin extends ContextSource {
         *   should fall back to the next notice in its sequence
         */
        private function getCachedNotice( $name ) {
-               global $wgRenderHashAppend, $parserMemc, $wgContLang;
+               global $wgRenderHashAppend, $wgContLang;
 
                $needParse = false;
 
@@ -1488,9 +1505,10 @@ abstract class Skin extends ContextSource {
                        $notice = $msg->plain();
                }
 
+               $cache = wfGetCache( CACHE_ANYTHING );
                // Use the extra hash appender to let eg SSL variants separately cache.
-               $key = wfMemcKey( $name . $wgRenderHashAppend );
-               $cachedNotice = $parserMemc->get( $key );
+               $key = $cache->makeKey( $name . $wgRenderHashAppend );
+               $cachedNotice = $cache->get( $key );
                if ( is_array( $cachedNotice ) ) {
                        if ( md5( $notice ) == $cachedNotice['hash'] ) {
                                $notice = $cachedNotice['html'];
@@ -1503,7 +1521,7 @@ abstract class Skin extends ContextSource {
 
                if ( $needParse ) {
                        $parsed = $this->getOutput()->parse( $notice );
-                       $parserMemc->set( $key, [ 'html' => $parsed, 'hash' => md5( $notice ) ], 600 );
+                       $cache->set( $key, [ 'html' => $parsed, 'hash' => md5( $notice ) ], 600 );
                        $notice = $parsed;
                }