Commit 21bc8e0c authored by Morris Jobke's avatar Morris Jobke
Browse files

Merge pull request #15088 from oparoz/3d-support

Introducing 3D images support (media type)
parents a79d9730 f3fe4668
...@@ -81,6 +81,7 @@ return array( ...@@ -81,6 +81,7 @@ return array(
'impress' => array('text/impress', null), 'impress' => array('text/impress', null),
'jpeg' => array('image/jpeg', null), 'jpeg' => array('image/jpeg', null),
'jpg' => array('image/jpeg', null), 'jpg' => array('image/jpeg', null),
'jps' => array('image/jpeg', null),
'js' => array('application/javascript', 'text/plain'), 'js' => array('application/javascript', 'text/plain'),
'json' => array('application/json', 'text/plain'), 'json' => array('application/json', 'text/plain'),
'k25' => array('image/x-dcraw', null), 'k25' => array('image/x-dcraw', null),
...@@ -103,6 +104,7 @@ return array( ...@@ -103,6 +104,7 @@ return array(
'mp4' => array('video/mp4', null), 'mp4' => array('video/mp4', null),
'mpeg' => array('video/mpeg', null), 'mpeg' => array('video/mpeg', null),
'mpg' => array('video/mpeg', null), 'mpg' => array('video/mpeg', null),
'mpo' => array('image/jpeg', null),
'msi' => array('application/x-msi', null), 'msi' => array('application/x-msi', null),
'nef' => array('image/x-dcraw', null), 'nef' => array('image/x-dcraw', null),
'numbers' => array('application/x-iwork-numbers-sffnumbers', null), 'numbers' => array('application/x-iwork-numbers-sffnumbers', null),
......
...@@ -81,8 +81,8 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { ...@@ -81,8 +81,8 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
$result = \OC_DB::executeAudited(self::existsStmt(), array($correct)); $result = \OC_DB::executeAudited(self::existsStmt(), array($correct));
$exists = $result->fetchOne(); $exists = $result->fetchOne();
if ( ! is_null($correct) ) { if (!is_null($correct)) {
if ( ! $exists ) { if (!$exists) {
// insert mimetype // insert mimetype
\OC_DB::executeAudited(self::insertStmt(), array($correct)); \OC_DB::executeAudited(self::insertStmt(), array($correct));
} }
...@@ -100,17 +100,17 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { ...@@ -100,17 +100,17 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
private function updateMimetypes($updatedMimetypes) { private function updateMimetypes($updatedMimetypes) {
foreach ($updatedMimetypes as $extension => $mimetype ) { foreach ($updatedMimetypes as $extension => $mimetype) {
$result = \OC_DB::executeAudited(self::existsStmt(), array($mimetype)); $result = \OC_DB::executeAudited(self::existsStmt(), array($mimetype));
$exists = $result->fetchOne(); $exists = $result->fetchOne();
if ( ! $exists ) { if (!$exists) {
// insert mimetype // insert mimetype
\OC_DB::executeAudited(self::insertStmt(), array($mimetype)); \OC_DB::executeAudited(self::insertStmt(), array($mimetype));
} }
// change mimetype for files with x extension // change mimetype for files with x extension
\OC_DB::executeAudited(self::updateByNameStmt(), array($mimetype, '%.'.$extension)); \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetype, '%.' . $extension));
} }
} }
...@@ -195,6 +195,15 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { ...@@ -195,6 +195,15 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
self::updateMimetypes($updatedMimetypes); self::updateMimetypes($updatedMimetypes);
} }
private function introduce3dImagesMimeType() {
$updatedMimetypes = array(
'jps' => 'image/jpeg',
'mpo' => 'image/jpeg',
);
self::updateMimetypes($updatedMimetypes);
}
/** /**
* Fix mime types * Fix mime types
*/ */
...@@ -218,5 +227,9 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { ...@@ -218,5 +227,9 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
if ($this->introduceRawMimeType()) { if ($this->introduceRawMimeType()) {
$this->emit('\OC\Repair', 'info', array('Fixed Raw mime types')); $this->emit('\OC\Repair', 'info', array('Fixed Raw mime types'));
} }
if ($this->introduce3dImagesMimeType()) {
$this->emit('\OC\Repair', 'info', array('Fixed 3D images mime types'));
}
} }
} }
This diff is collapsed.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment