Merge "Add page id to the API representation of pages in search results"
authorjenkins-bot <jenkins-bot@gerrit.wikimedia.org>
Thu, 10 Aug 2017 17:10:44 +0000 (17:10 +0000)
committerGerrit Code Review <gerrit@wikimedia.org>
Thu, 10 Aug 2017 17:10:45 +0000 (17:10 +0000)
includes/PHPVersionCheck.php
includes/Sanitizer.php
includes/media/SVG.php

index 5a440c4..c8872d2 100644 (file)
@@ -36,6 +36,7 @@ class PHPVersionCheck {
                'ctype_digit' => 'ctype',
                'json_decode' => 'json',
                'iconv'       => 'iconv',
+               'mime_content_type' => 'fileinfo',
        );
 
        /**
index 1562288..b6b7922 100644 (file)
@@ -1914,7 +1914,7 @@ class Sanitizer {
                        # Not usually allowed, but may be used for extension-style hooks
                        # such as <math> when it is rasterized, or if $wgAllowImageTag is
                        # true
-                       'img'        => array_merge( $common, [ 'alt', 'src', 'width', 'height' ] ),
+                       'img'        => array_merge( $common, [ 'alt', 'src', 'width', 'height', 'srcset' ] ),
 
                        'video'      => array_merge( $common, [ 'poster', 'controls', 'preload', 'width', 'height' ] ),
                        'source'     => array_merge( $common, [ 'type', 'src' ] ),
@@ -1951,6 +1951,10 @@ class Sanitizer {
                        # https://www.w3.org/TR/REC-MathML/
                        'math'       => [ 'class', 'style', 'id', 'title' ],
 
+                       // HTML 5 section 4.5
+                       'figure'     => $common,
+                       'figcaption' => $common,
+
                        # HTML 5 section 4.6
                        'bdi' => $common,
 
@@ -1966,7 +1970,7 @@ class Sanitizer {
                        // (ie: validateTag rejects tags missing the attributes needed for Microdata)
                        // So we don't bother including $common attributes that have no purpose.
                        'meta' => [ 'itemprop', 'content' ],
-                       'link' => [ 'itemprop', 'href' ],
+                       'link' => [ 'itemprop', 'href', 'title' ],
                ];
 
                return $whitelist;
index 0cea6d8..1bc722c 100644 (file)
@@ -205,7 +205,17 @@ class SvgHandler extends ImageHandler {
                // https://git.gnome.org/browse/librsvg/commit/?id=f01aded72c38f0e18bc7ff67dee800e380251c8e
                $tmpDir = wfTempDir() . '/svg_' . wfRandomString( 24 );
                $lnPath = "$tmpDir/" . basename( $srcPath );
-               $ok = mkdir( $tmpDir, 0771 ) && symlink( $srcPath, $lnPath );
+               $ok = mkdir( $tmpDir, 0771 );
+               if ( !$ok ) {
+                       wfDebugLog( 'thumbnail',
+                               sprintf( 'Thumbnail failed on %s: could not create temporary directory %s',
+                                       wfHostname(), $tmpDir ) );
+                       return new MediaTransformError( 'thumbnail_error',
+                               $params['width'], $params['height'],
+                               wfMessage( 'thumbnail-temp-create' )->text()
+                       );
+               }
+               $ok = symlink( $srcPath, $lnPath );
                /** @noinspection PhpUnusedLocalVariableInspection */
                $cleaner = new ScopedCallback( function () use ( $tmpDir, $lnPath ) {
                        MediaWiki\suppressWarnings();