mirror of
https://github.com/yiisoft/yii2.git
synced 2025-08-26 14:26:54 +08:00
Fixes #17306: Added ".mjs" extensions to mimetypes meta
This commit is contained in:
@ -33,6 +33,13 @@ class MimeTypeController extends Controller
|
||||
'text/xml' => 'application/xml',
|
||||
];
|
||||
|
||||
/**
|
||||
* @var array MIME types to add to the ones parsed from Apache files
|
||||
*/
|
||||
private $additionalMimeTypes = [
|
||||
'mjs' => 'text/javascript',
|
||||
];
|
||||
|
||||
/**
|
||||
* @param string $outFile the mime file to update. Defaults to @yii/helpers/mimeTypes.php
|
||||
* @param string $aliasesOutFile the aliases file to update. Defaults to @yii/helpers/mimeAliases.php
|
||||
@ -47,9 +54,9 @@ class MimeTypeController extends Controller
|
||||
$aliasesOutFile = Yii::getAlias('@yii/helpers/mimeAliases.php');
|
||||
}
|
||||
|
||||
$this->stdout('downloading mime-type file from apache httpd repository...');
|
||||
$this->stdout('Downloading mime-type file from apache httpd repository...');
|
||||
if ($apacheMimeTypesFileContent = file_get_contents('http://svn.apache.org/viewvc/httpd/httpd/trunk/docs/conf/mime.types?view=co')) {
|
||||
$this->stdout("done.\n", Console::FG_GREEN);
|
||||
$this->stdout("Done.\n", Console::FG_GREEN);
|
||||
$this->generateMimeTypesFile($outFile, $apacheMimeTypesFileContent);
|
||||
$this->generateMimeAliasesFile($aliasesOutFile);
|
||||
} else {
|
||||
@ -63,7 +70,7 @@ class MimeTypeController extends Controller
|
||||
*/
|
||||
private function generateMimeTypesFile($outFile, $content)
|
||||
{
|
||||
$this->stdout("generating file $outFile...");
|
||||
$this->stdout("Generating file $outFile...");
|
||||
$mimeMap = [];
|
||||
foreach (explode("\n", $content) as $line) {
|
||||
$line = trim($line);
|
||||
@ -78,6 +85,7 @@ class MimeTypeController extends Controller
|
||||
}
|
||||
}
|
||||
}
|
||||
$mimeMap = array_merge($mimeMap, $this->additionalMimeTypes);
|
||||
ksort($mimeMap);
|
||||
$array = VarDumper::export($mimeMap);
|
||||
$content = <<<EOD
|
||||
|
@ -5,7 +5,7 @@ Yii Framework 2 Change Log
|
||||
------------------------
|
||||
|
||||
- Bug #12077, #12135, #17263: Fixed PostgreSQL version of `alterColumn()` to accept properly `ColumnSchemaBuilder` definition of column (bizley)
|
||||
|
||||
- Bug #17306: Added ".mjs" extensions to mimetypes meta (samdark)
|
||||
|
||||
2.0.18 April 23, 2019
|
||||
---------------------
|
||||
|
@ -448,6 +448,7 @@ return [
|
||||
'mime' => 'message/rfc822',
|
||||
'mj2' => 'video/mj2',
|
||||
'mjp2' => 'video/mj2',
|
||||
'mjs' => 'text/javascript',
|
||||
'mk3d' => 'video/x-matroska',
|
||||
'mka' => 'audio/x-matroska',
|
||||
'mks' => 'video/x-matroska',
|
||||
@ -479,6 +480,7 @@ return [
|
||||
'mpkg' => 'application/vnd.apple.installer+xml',
|
||||
'mpm' => 'application/vnd.blueice.multipass',
|
||||
'mpn' => 'application/vnd.mophun.application',
|
||||
0 => 'application/vnd.lotus-1-2-3',
|
||||
'mpp' => 'application/vnd.ms-project',
|
||||
'mpt' => 'application/vnd.ms-project',
|
||||
'mpy' => 'application/vnd.ibm.minipay',
|
||||
@ -991,5 +993,4 @@ return [
|
||||
'zir' => 'application/vnd.zul',
|
||||
'zirz' => 'application/vnd.zul',
|
||||
'zmm' => 'application/vnd.handheld-entertainment+xml',
|
||||
123 => 'application/vnd.lotus-1-2-3',
|
||||
];
|
||||
|
Reference in New Issue
Block a user