Skip to content

Commit

Permalink
Add "transcoded" zone to $wgAWSRepoZones
Browse files Browse the repository at this point in the history
See issue #66.

This zone is added by MediaWiki core,
so it should be configured by default,
even though it is unused without extensions like TimedMediaHandler.
  • Loading branch information
edwardspec committed Dec 31, 2024
1 parent f85bb57 commit 0d145b0
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
3 changes: 2 additions & 1 deletion ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ List of changes between releases of Extension:AWS.

== master branch (will become AWS 0.13.2 or 0.14.0, depending on magnitude of changes) ==

No changes since AWS 0.13.1.
Minor features:
* Added "transcoded" zone to $wgAWSRepoZones.

== AWS 0.13.1 ==

Expand Down
5 changes: 5 additions & 0 deletions extension.json
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,11 @@
"temp": {
"container": "local-temp",
"path": "/temp"
},
"transcoded": {
"container": "local-transcoded",
"path": "/transcoded",
"isPublic": true
}
}
}
Expand Down
18 changes: 14 additions & 4 deletions tests/phpunit/AmazonS3HooksTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -117,14 +117,16 @@ public function testConfig( array $opt ) {
"$wikiId-local-thumb" => "$wgAWSBucketName/thumb",
"$wikiId-local-deleted" => "$wgAWSBucketName/deleted",
"$wikiId-local-temp" => "$wgAWSBucketName/temp",
"$wikiId-local-transcoded" => "$wgAWSBucketName/transcoded",
];
} elseif ( $wgAWSBucketPrefix ) {
// 4 buckets (deprecated configuration)
// Separate buckets for every zone (deprecated configuration)
$expectedBackend['containerPaths'] = [
"$wikiId-local-public" => "$wgAWSBucketPrefix",
"$wikiId-local-thumb" => "$wgAWSBucketPrefix-thumb",
"$wikiId-local-deleted" => "$wgAWSBucketPrefix-deleted",
"$wikiId-local-temp" => "$wgAWSBucketPrefix-temp",
"$wikiId-local-transcoded" => "$wgAWSBucketPrefix-transcoded",
];
}

Expand All @@ -139,6 +141,11 @@ public function testConfig( array $opt ) {
$expectedHashLevels = $inputConfigs['wgAWSRepoHashLevels'] ?? 0;
$expectedDeletedHashLevels = $inputConfigs['wgAWSRepoDeletedHashLevels'] ?? 0;

$expectedTranscodedZone = [];
if ( isset( $opt['expectedThumbZone']['url'] ) ) {
$expectedTranscodedZone['url'] = str_replace( 'thumb', 'transcoded', $opt['expectedThumbZone']['url'] );
}

$expectedRepo = [
'class' => 'LocalRepo',
'name' => 'local',
Expand All @@ -150,7 +157,8 @@ public function testConfig( array $opt ) {
'public' => $opt['expectedPublicZone'],
'thumb' => $opt['expectedThumbZone'],
'deleted' => [ 'url' => false ],
'temp' => [ 'url' => false ]
'temp' => [ 'url' => false ],
'transcoded' => $expectedTranscodedZone
]
];
}
Expand Down Expand Up @@ -236,7 +244,8 @@ public function configDataProvider() {
'wgAWSBucketName' => 'site-number-four',
'wgAWSBucketDomain' => [
'public' => 'img.example.com',
'thumb' => 'thumb.example.com'
'thumb' => 'thumb.example.com',
'transcoded' => 'transcoded.example.com',
]
],
'expectedPublicZone' => [ 'url' => 'https://img.example.com' ],
Expand Down Expand Up @@ -318,7 +327,8 @@ public function configDataProvider() {
'wgAWSBucketPrefix' => 'site-number-four',
'wgAWSBucketDomain' => [
'public' => 'img.example.com',
'thumb' => 'thumb.example.com'
'thumb' => 'thumb.example.com',
'transcoded' => 'transcoded.example.com'
]
],
'expectedPublicZone' => [ 'url' => 'https://img.example.com' ],
Expand Down
6 changes: 4 additions & 2 deletions tests/travis/OldStyleAWSSettings.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,8 @@
"$wgDBname-local-public" => "${BUCKET}",
"$wgDBname-local-thumb" => "${BUCKET}/thumb",
"$wgDBname-local-deleted" => "${BUCKET}/deleted",
"$wgDBname-local-temp" => "${BUCKET}/temp"
"$wgDBname-local-temp" => "${BUCKET}/temp",
"$wgDBname-local-transcoded" => "${BUCKET}/transcoded"
];

$wgLocalFileRepo = [
Expand All @@ -49,7 +50,8 @@
'public' => [ 'url' => "https://${BUCKET}.s3.amazonaws.com" ],
'thumb' => [ 'url' => "https://${BUCKET}.s3.amazonaws.com/thumb" ],
'temp' => [ 'url' => false ],
'deleted' => [ 'url' => false ]
'deleted' => [ 'url' => false ],
'transcoded' => [ 'url' => "https://${BUCKET}.s3.amazonaws.com/transcoded" ]
]
];

Expand Down

0 comments on commit 0d145b0

Please sign in to comment.