Added mimetype repair step

* Version number increased
This commit is contained in:
Roeland Jago Douma 2015-10-02 15:28:03 +02:00
parent 57ceee13a9
commit c80dd82fe4
3 changed files with 125 additions and 1 deletions

View File

@ -250,6 +250,39 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
self::updateMimetypes($updatedMimetypes);
}
private function introduceJavaMimeType() {
$updatedMimetypes = array(
'class' => 'application/java',
'java' => 'text/x-java-source',
);
self::updateMimetypes($updatedMimetypes);
}
private function introduceHppMimeType() {
$updatedMimetypes = array(
'hpp' => 'text/x-h',
);
self::updateMimetypes($updatedMimetypes);
}
private function introduceRssMimeType() {
$updatedMimetypes = array(
'rss' => 'application/rss+xml',
);
self::updateMimetypes($updatedMimetypes);
}
private function introduceRtfMimeType() {
$updatedMimetypes = array(
'rtf' => 'text/rtf',
);
self::updateMimetypes($updatedMimetypes);
}
/**
* Fix mime types
*/
@ -294,5 +327,24 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
$this->emit('\OC\Repair', 'info', array('Fixed Yaml/Yml mime types'));
}
}
// Mimetype updates from #19272
if (version_compare($ocVersionFromBeforeUpdate, '8.2.0.8', '<')) {
if ($this->introduceJavaMimeType()) {
$this->emit('\OC\Repair', 'info', array('Fixed java/class mime types'));
}
if ($this->introduceHppMimeType()) {
$this->emit('\OC\Repair', 'info', array('Fixed hpp mime type'));
}
if ($this->introduceRssMimeType()) {
$this->emit('\OC\Repair', 'info', array('Fixed rss mime type'));
}
if ($this->introduceRtfMimeType()) {
$this->emit('\OC\Repair', 'info', array('Fixed rtf mime type'));
}
}
}
}

View File

@ -282,6 +282,68 @@ class RepairMimeTypes extends \Test\TestCase {
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
}
/**
* Test renaming the java mime types
*/
public function testRenameJavaMimeType() {
$currentMimeTypes = [
['test.java', 'application/octet-stream'],
['test.class', 'application/octet-stream'],
];
$fixedMimeTypes = [
['test.java', 'text/x-java-source'],
['test.class', 'application/java'],
];
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
}
/**
* Test renaming the hpp mime type
*/
public function testRenameHppMimeType() {
$currentMimeTypes = [
['test.hpp', 'application/octet-stream'],
];
$fixedMimeTypes = [
['test.hpp', 'text/x-h'],
];
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
}
/**
* Test renaming the rss mime type
*/
public function testRenameRssMimeType() {
$currentMimeTypes = [
['test.rss', 'application/octet-stream'],
];
$fixedMimeTypes = [
['test.rss', 'application/rss+xml'],
];
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
}
/**
* Test renaming the hpp mime type
*/
public function testRenameRtfMimeType() {
$currentMimeTypes = [
['test.rtf', 'application/octet-stream'],
];
$fixedMimeTypes = [
['test.rtf', 'text/rtf'],
];
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);
}
/**
* Test renaming and splitting old office mime types when
* new ones already exist
@ -399,6 +461,11 @@ class RepairMimeTypes extends \Test\TestCase {
['test.cnf', 'text/plain'],
['test.yaml', 'application/yaml'],
['test.yml', 'application/yaml'],
['test.java', 'text/x-java-source'],
['test.class', 'application/java'],
['test.hpp', 'text/x-h'],
['test.rss', 'application/rss+xml'],
['test.rtf', 'text/rtf'],
];
$fixedMimeTypes = [
@ -438,6 +505,11 @@ class RepairMimeTypes extends \Test\TestCase {
['test.cnf', 'text/plain'],
['test.yaml', 'application/yaml'],
['test.yml', 'application/yaml'],
['test.java', 'text/x-java-source'],
['test.class', 'application/java'],
['test.hpp', 'text/x-h'],
['test.rss', 'application/rss+xml'],
['test.rtf', 'text/rtf'],
];
$this->renameMimeTypes($currentMimeTypes, $fixedMimeTypes);

View File

@ -23,7 +23,7 @@
// We only can count up. The 4. digit is only for the internal patchlevel to trigger DB upgrades
// between betas, final and RCs. This is _not_ the public version number. Reset minor/patchlevel
// when updating major/minor version number.
$OC_Version = array(8, 2, 0, 7);
$OC_Version = array(8, 2, 0, 8);
// The human readable string
$OC_VersionString = '8.2 beta1';