Make MessageCache handle lock timeouts better
[lhc/web/wiklou.git] / includes / skins / Skin.php
index b80788b..04cf351 100644 (file)
@@ -81,15 +81,6 @@ abstract class Skin extends ContextSource {
                return $allowedSkins;
        }
 
-       /**
-        * @deprecated since 1.23, use getAllowedSkins
-        * @return string[]
-        */
-       public static function getUsableSkins() {
-               wfDeprecated( __METHOD__, '1.23' );
-               return self::getAllowedSkins();
-       }
-
        /**
         * Normalize a skin preference value to a form that can be loaded.
         *
@@ -140,23 +131,6 @@ abstract class Skin extends ContextSource {
                }
        }
 
-       /**
-        * Factory method for loading a skin of a given type
-        * @param string $key 'monobook', 'vector', etc.
-        * @return Skin
-        * @deprecated since 1.24; Use SkinFactory instead
-        */
-       static function &newFromKey( $key ) {
-               wfDeprecated( __METHOD__, '1.24' );
-
-               $key = Skin::normalizeKey( $key );
-               $factory = SkinFactory::getDefaultInstance();
-
-               // normalizeKey() guarantees that a skin with this key will exist.
-               $skin = $factory->makeSkin( $key );
-               return $skin;
-       }
-
        /**
         * @return string Skin name
         */
@@ -413,8 +387,9 @@ abstract class Skin extends ContextSource {
                }
 
                $name = Sanitizer::escapeClass( 'page-' . $title->getPrefixedText() );
+               $root = Sanitizer::escapeClass( 'rootpage-' . $title->getRootTitle()->getPrefixedText() );
 
-               return "$numeric $type $name";
+               return "$numeric $type $name $root";
        }
 
        /**
@@ -451,7 +426,7 @@ abstract class Skin extends ContextSource {
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getCategoryLinks() {
                global $wgUseCategoryBrowser;
@@ -542,25 +517,27 @@ abstract class Skin extends ContextSource {
        }
 
        /**
-        * @return string
+        * @return string HTML
         */
        function getCategories() {
                $out = $this->getOutput();
-
                $catlinks = $this->getCategoryLinks();
 
-               $classes = 'catlinks';
-
                // Check what we're showing
                $allCats = $out->getCategoryLinks();
                $showHidden = $this->getUser()->getBoolOption( 'showhiddencats' ) ||
                                                $this->getTitle()->getNamespace() == NS_CATEGORY;
 
+               $classes = [ 'catlinks' ];
                if ( empty( $allCats['normal'] ) && !( !empty( $allCats['hidden'] ) && $showHidden ) ) {
-                       $classes .= ' catlinks-allhidden';
+                       $classes[] = 'catlinks-allhidden';
                }
 
-               return "<div id='catlinks' class='$classes' data-mw='interface'>{$catlinks}</div>";
+               return Html::rawElement(
+                       'div',
+                       [ 'id' => 'catlinks', 'class' => $classes, 'data-mw' => 'interface' ],
+                       $catlinks
+               );
        }
 
        /**
@@ -799,12 +776,12 @@ abstract class Skin extends ContextSource {
         * @return null|string
         */
        function getCopyrightIcon() {
-               global $wgRightsUrl, $wgRightsText, $wgRightsIcon, $wgCopyrightIcon;
+               global $wgRightsUrl, $wgRightsText, $wgRightsIcon, $wgFooterIcons;
 
                $out = '';
 
-               if ( $wgCopyrightIcon ) {
-                       $out = $wgCopyrightIcon;
+               if ( $wgFooterIcons['copyright']['copyright'] ) {
+                       $out = $wgFooterIcons['copyright']['copyright'];
                } elseif ( $wgRightsIcon ) {
                        $icon = htmlspecialchars( $wgRightsIcon );
 
@@ -1022,21 +999,6 @@ abstract class Skin extends ContextSource {
                        $targetUser->canReceiveEmail();
        }
 
-       /**
-        * This function previously returned a fully resolved style path URL to images or styles stored in
-        * the legacy skins/common/ directory.
-        *
-        * That directory has been removed in 1.24 and the function always returns an empty string.
-        *
-        * @deprecated since 1.24
-        * @param string $name The name or path of a skin resource file
-        * @return string Empty string
-        */
-       function getCommonStylePath( $name ) {
-               wfDeprecated( __METHOD__, '1.24' );
-               return '';
-       }
-
        /**
         * Return a fully resolved style path url to images or styles stored in the current skins's folder.
         * This method returns a url resolved using the configured skin style path
@@ -1238,7 +1200,9 @@ abstract class Skin extends ContextSource {
                        $cache = ObjectCache::getMainWANInstance();
                        $sidebar = $cache->getWithSetCallback(
                                $cache->makeKey( 'sidebar', $this->getLanguage()->getCode() ),
-                               $wgSidebarCacheExpiry,
+                               MessageCache::singleton()->isDisabled()
+                                       ? $cache::TTL_UNCACHEABLE // bug T133069
+                                       : $wgSidebarCacheExpiry,
                                $callback,
                                [ 'lockTSE' => 30 ]
                        );
@@ -1357,22 +1321,6 @@ abstract class Skin extends ContextSource {
                return $bar;
        }
 
-       /**
-        * This function previously controlled whether the 'mediawiki.legacy.wikiprintable' module
-        * should be loaded by OutputPage. That module no longer exists and the return value of this
-        * method is ignored.
-        *
-        * If your skin doesn't provide its own print styles, the 'mediawiki.legacy.commonPrint' module
-        * can be used instead (SkinTemplate-based skins do it automatically).
-        *
-        * @deprecated since 1.22
-        * @return bool
-        */
-       public function commonPrintStylesheet() {
-               wfDeprecated( __METHOD__, '1.22' );
-               return false;
-       }
-
        /**
         * Gets new talk page messages for the current user and returns an
         * appropriate alert message (or an empty string if there are no messages)
@@ -1615,24 +1563,280 @@ abstract class Skin extends ContextSource {
                return $result;
        }
 
-       /**
-        * Use PHP's magic __call handler to intercept legacy calls to the linker
-        * for backwards compatibility.
-        *
-        * @param string $fname Name of called method
-        * @param array $args Arguments to the method
-        * @throws MWException
-        * @return mixed
-        */
-       function __call( $fname, $args ) {
-               $realFunction = [ 'Linker', $fname ];
-               if ( is_callable( $realFunction ) ) {
-                       wfDeprecated( get_class( $this ) . '::' . $fname, '1.21' );
-                       return call_user_func_array( $realFunction, $args );
-               } else {
-                       $className = get_class( $this );
-                       throw new MWException( "Call to undefined method $className::$fname" );
-               }
+       /** @deprecated in 1.21 */
+       public function accesskey() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'accesskey' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function blockLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'blockLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function buildRollbackLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'buildRollbackLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function commentBlock() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'commentBlock' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function emailLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'emailLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function formatComment() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'formatComment' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function formatHiddenCategories() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'formatHiddenCategories' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function formatLinksInComment() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'formatLinksInComment' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function formatRevisionSize() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'formatRevisionSize' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function formatSize() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'formatSize' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function formatTemplates() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'formatTemplates' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function generateRollback() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'generateRollback' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function generateTOC() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'generateTOC' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function getInternalLinkAttributes() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'getInternalLinkAttributes' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function getInternalLinkAttributesObj() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'getInternalLinkAttributesObj' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function getInterwikiLinkAttributes() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'getInterwikiLinkAttributes' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function getInvalidTitleDescription() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'getInvalidTitleDescription' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function getLinkColour() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'getLinkColour' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function getRevDeleteLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'getRevDeleteLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function getRollbackEditCount() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'getRollbackEditCount' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function link() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'link' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function linkKnown() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'linkKnown' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeBrokenImageLinkObj() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeBrokenImageLinkObj' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeCommentLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeCommentLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeExternalImage() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeExternalImage' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeExternalLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeExternalLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeHeadline() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeHeadline' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeImageLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeImageLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeMediaLinkFile() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeMediaLinkFile' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeMediaLinkObj() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeMediaLinkObj' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeSelfLinkObj() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeSelfLinkObj' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeThumbLink2() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeThumbLink2' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function makeThumbLinkObj() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'makeThumbLinkObj' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function normaliseSpecialPage() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'normaliseSpecialPage' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function normalizeSubpageLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'normalizeSubpageLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function processResponsiveImages() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'processResponsiveImages' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function revComment() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'revComment' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function revDeleteLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'revDeleteLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function revDeleteLinkDisabled() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'revDeleteLinkDisabled' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function revUserLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'revUserLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function revUserTools() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'revUserTools' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function specialLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'specialLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function splitTrail() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'splitTrail' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function titleAttrib() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'titleAttrib' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function tocIndent() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'tocIndent' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function tocLine() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'tocLine' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function tocLineEnd() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'tocLineEnd' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function tocList() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'tocList' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function tocUnindent() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'tocUnindent' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function tooltip() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'tooltip' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function tooltipAndAccesskeyAttribs() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'tooltipAndAccesskeyAttribs' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function userLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'userLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function userTalkLink() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'userTalkLink' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function userToolLinks() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'userToolLinks' ], func_get_args() );
+       }
+       /** @deprecated in 1.21 */
+       public function userToolLinksRedContribs() {
+               wfDeprecated( __METHOD__, '1.21' );
+               return call_user_func_array( [ 'Linker', 'userToolLinksRedContribs' ], func_get_args() );
        }
 
 }