Merge "Check for error before outputting srcset urls"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 28 Aug 2014 07:35:17 +0000 (07:35 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 28 Aug 2014 07:35:17 +0000 (07:35 +0000)
1  2 
includes/Linker.php

diff --combined includes/Linker.php
@@@ -25,7 -25,7 +25,7 @@@
   * for primarily page content: links, embedded images, table of contents. Links
   * are also used in the skin.
   *
 - * @todo: turn this into a legacy interface for HtmlPageLinkRenderer and similar services.
 + * @todo turn this into a legacy interface for HtmlPageLinkRenderer and similar services.
   *
   * @ingroup Skins
   */
@@@ -259,7 -259,6 +259,7 @@@ class Linker 
  
        /**
         * Identical to link(), except $options defaults to 'known'.
 +       * @see Linker::link
         * @return string
         */
        public static function linkKnown(
         * Returns the Url used to link to a Title
         *
         * @param Title $target
 -       * @param array $query query parameters
 +       * @param array $query Query parameters
         * @param array $options
         * @return string
         */
         * frame parameters supplied by the Parser.
         * @param array $frameParams The frame parameters
         * @param string $query An optional query string to add to description page links
 +       * @param Parser|null $parser
         * @return array
         */
        private static function getImageLinkMTOParams( $frameParams, $query = '', $parser = null ) {
        public static function makeThumbLink2( Title $title, $file, $frameParams = array(),
                $handlerParams = array(), $time = false, $query = ""
        ) {
 -              global $wgStylePath, $wgContLang;
                $exists = $file && $file->exists();
  
                # Shortcuts
                                                'href' => $url,
                                                'class' => 'internal',
                                                'title' => wfMessage( 'thumbnail-more' )->text() ),
 -                                              Html::element( 'img', array(
 -                                                      'src' => $wgStylePath . '/common/images/magnify-clip'
 -                                                              . ( $wgContLang->isRTL() ? '-rtl' : '' ) . '.png',
 -                                                      'width' => 15,
 -                                                      'height' => 11,
 -                                                      'alt' => "" ) ) ) );
 +                                              "" ) );
                        }
                }
                $s .= '  <div class="thumbcaption">' . $zoomIcon . $fp['caption'] . "</div></div></div>";
  
                        $thumb15 = $file->transform( $hp15 );
                        $thumb20 = $file->transform( $hp20 );
-                       if ( $thumb15 && $thumb15->getUrl() !== $thumb->getUrl() ) {
+                       if ( $thumb15 && !$thumb15->isError() && $thumb15->getUrl() !== $thumb->getUrl() ) {
                                $thumb->responsiveUrls['1.5'] = $thumb15->getUrl();
                        }
-                       if ( $thumb20 && $thumb20->getUrl() !== $thumb->getUrl() ) {
+                       if ( $thumb20 && !$thumb20->isError() && $thumb20->getUrl() !== $thumb->getUrl() ) {
                                $thumb->responsiveUrls['2'] = $thumb20->getUrl();
                        }
                }
                $query = '', $unused1 = '', $unused2 = '', $time = false
        ) {
                global $wgEnableUploads, $wgUploadMissingFileUrl, $wgUploadNavigationUrl;
 -              if ( ! $title instanceof Title ) {
 +              if ( !$title instanceof Title ) {
                        return "<!-- ERROR -->" . htmlspecialchars( $label );
                }
                wfProfileIn( __METHOD__ );
                                                . '<span dir="auto">' . $auto . $post . '</span>';
                                }
                                return $comment;
 -              },
 +                      },
                        $comment
                );
        }
  
                                # fix up urlencoded title texts (copied from Parser::replaceInternalLinks)
                                if ( strpos( $match[1], '%' ) !== false ) {
 -                                      $match[1] = str_replace( array( '<', '>' ), array( '&lt;', '&gt;' ), rawurldecode( $match[1] ) );
 +                                      $match[1] = str_replace(
 +                                              array( '<', '>' ),
 +                                              array( '&lt;', '&gt;' ),
 +                                              rawurldecode( $match[1] )
 +                                      );
                                }
  
                                # Handle link renaming [[foo|text]] will show link as "text"
         *
         * @param User $user
         * @param Revision $rev
 -       * @param Revision $title
 +       * @param Title $title
         * @return string HTML fragment
         */
        public static function getRevDeleteLink( User $user, Revision $rev, Title $title ) {