From: jenkins-bot Date: Wed, 9 Aug 2017 23:24:12 +0000 (+0000) Subject: Merge "Added a separate error message for mkdir failures" X-Git-Tag: 1.31.0-rc.0~2430 X-Git-Url: https://git.heureux-cyclage.org/?p=lhc%2Fweb%2Fwiklou.git;a=commitdiff_plain;h=64b83bdb3afd0ee4f8fc1893a865409c198e601e;hp=87d585d97d0e6255a1160d38f506109699b2042f Merge "Added a separate error message for mkdir failures" --- diff --git a/includes/media/SVG.php b/includes/media/SVG.php index 0cea6d899f..1bc722c5dc 100644 --- a/includes/media/SVG.php +++ b/includes/media/SVG.php @@ -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();