Merge "Always log a message when disableLocalTransform is hit"

This commit is contained in:
jenkins-bot 2024-02-09 11:27:31 +00:00 committed by Gerrit Code Review
commit b235bbab53
3 changed files with 13 additions and 6 deletions

View file

@ -482,9 +482,10 @@ config-schema:
- thumbProxySecret Optional value of the X-Swift-Secret header to use in requests to
thumbProxyUrl
- disableLocalTransform
If present and true, local image scaling will be disabled -- it will
throw an exception if attempted. thumbProxyUrl must be set for this
to work, as well as either transformVia404 (preferred) or thumbScriptUrl.
If present and true, local image scaling will be disabled. If attempted,
it will show an error to the user and log an error message. To avoid an
error, thumbProxyUrl must be set, as well as either transformVia404
(preferred) or thumbScriptUrl.
- initialCapital Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE],
determines whether filenames implicitly start with a capital letter.
The current implementation may give incorrect description page links

View file

@ -978,9 +978,10 @@ class MainConfigSchema {
* - thumbProxySecret Optional value of the X-Swift-Secret header to use in requests to
* thumbProxyUrl
* - disableLocalTransform
* If present and true, local image scaling will be disabled -- it will
* throw an exception if attempted. thumbProxyUrl must be set for this
* to work, as well as either transformVia404 (preferred) or thumbScriptUrl.
* If present and true, local image scaling will be disabled. If attempted,
* it will show an error to the user and log an error message. To avoid an
* error, thumbProxyUrl must be set, as well as either transformVia404
* (preferred) or thumbScriptUrl.
* - initialCapital Equivalent to $wgCapitalLinks (or $wgCapitalLinkOverrides[NS_FILE],
* determines whether filenames implicitly start with a capital letter.
* The current implementation may give incorrect description page links

View file

@ -10,6 +10,7 @@ use MediaWiki\Config\ConfigException;
use MediaWiki\Context\IContextSource;
use MediaWiki\HookContainer\ProtectedHookAccessorTrait;
use MediaWiki\Linker\LinkTarget;
use MediaWiki\Logger\LoggerFactory;
use MediaWiki\MainConfigNames;
use MediaWiki\MediaWikiServices;
use MediaWiki\Page\PageIdentity;
@ -1245,6 +1246,8 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
// Check to see if local transformation is disabled.
if ( !$this->repo->canTransformLocally() ) {
LoggerFactory::getInstance( 'thumbnail' )
->error( 'Local transform denied by configuration' );
$thumb = new MediaTransformError(
wfMessage(
'thumbnail_error',
@ -1281,6 +1284,8 @@ abstract class File implements IDBAccessObject, MediaHandlerState {
->get( MainConfigNames::IgnoreImageErrors );
if ( !$this->repo->canTransformLocally() ) {
LoggerFactory::getInstance( 'thumbnail' )
->error( 'Local transform denied by configuration' );
return new MediaTransformError(
wfMessage(
'thumbnail_error',