From 42edd5b788dd98da02e3c14751a40cc44b081b4b Mon Sep 17 00:00:00 2001 From: Normal Ra Date: Sat, 28 Jun 2014 00:13:15 +0200 Subject: Add .apk mimetype. --- lib/private/mimetypes.list.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/private/mimetypes.list.php b/lib/private/mimetypes.list.php index d27e9e6348b..c56bd0af2e3 100644 --- a/lib/private/mimetypes.list.php +++ b/lib/private/mimetypes.list.php @@ -31,6 +31,7 @@ return array( '7z' => array('application/x-7z-compressed', null), 'accdb' => array('application/msaccess', null), 'ai' => array('application/illustrator', null), + 'apk' => array('application/vnd.android.package-archive', null), 'avi' => array('video/x-msvideo', null), 'bash' => array('text/x-shellscript', null), 'blend' => array('application/x-blender', null), -- cgit v1.2.3 From 38498af17146f42ac42f9eb119d5642bfd522a09 Mon Sep 17 00:00:00 2001 From: Normal Ra Date: Tue, 12 Aug 2014 14:07:10 +0200 Subject: Add APK mimetype repair scenario. --- lib/repair/repairmimetypes.php | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) (limited to 'lib') diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php index f7618c6e060..00f5340a878 100644 --- a/lib/repair/repairmimetypes.php +++ b/lib/repair/repairmimetypes.php @@ -113,6 +113,44 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { } } + private function fixAPKMimeType() { + $existsStmt = \OC_DB::prepare(' + SELECT count(`mimetype`) + FROM `*PREFIX*mimetypes` + WHERE `mimetype` = ? + '); + + $insertStmt = \OC_DB::prepare(' + INSERT INTO `*PREFIX*mimetypes` ( `mimetype` ) + VALUES ( ? ) + '); + + + $updateByNameStmt = \OC_DB::prepare(' + UPDATE `*PREFIX*filecache` + SET `mimetype` = ( + SELECT `id` + FROM `*PREFIX*mimetypes` + WHERE `mimetype` = ? + ) WHERE `name` LIKE ? + '); + + + $mimeTypeExtension = 'apk'; + $mimeTypeName = 'application/vnd.android.package-archive'; + + $result = \OC_DB::executeAudited($existsStmt, array($mimeTypeName)); + $exists = $result->fetchOne(); + + if ( ! $exists ) { + // insert mimetype + \OC_DB::executeAudited($insertStmt, array($mimeTypeName)); + } + + // change mimetype for files with x extension + \OC_DB::executeAudited($updateByNameStmt, array($mimeTypeName, '%.'.$mimeTypeExtension)); + } + /** * Fix mime types */ @@ -120,6 +158,10 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { if ($this->fixOfficeMimeTypes()) { $this->emit('\OC\Repair', 'info', array('Fixed office mime types')); } + + if ($this->fixAPKMimeType()) { + $this->emit('\OC\Repair', 'info', array('Fixed APK mime type')); + } } } -- cgit v1.2.3 From 1633ec5c87d01f97effa7fc4644e2f62d0816f92 Mon Sep 17 00:00:00 2001 From: Normal Ra Date: Tue, 12 Aug 2014 14:07:38 +0200 Subject: APK mimetype icon to be a generic package icon. --- lib/private/helper.php | 1 + 1 file changed, 1 insertion(+) (limited to 'lib') diff --git a/lib/private/helper.php b/lib/private/helper.php index f90c38d236c..79df2e3255c 100644 --- a/lib/private/helper.php +++ b/lib/private/helper.php @@ -183,6 +183,7 @@ class OC_Helper { 'application/x-gzip' => 'package/x-generic', 'application/x-rar-compressed' => 'package/x-generic', 'application/x-tar' => 'package/x-generic', + 'application/vnd.android.package-archive' => 'package/x-generic', 'application/zip' => 'package/x-generic', 'application/msword' => 'x-office/document', -- cgit v1.2.3 From 1c1fc0870a225201e7ff9878ea2c02ebca0edf9c Mon Sep 17 00:00:00 2001 From: Normal Ra Date: Wed, 13 Aug 2014 11:24:02 +0200 Subject: Remove stray tab characters. --- lib/repair/repairmimetypes.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php index 00f5340a878..e3f4402cfd5 100644 --- a/lib/repair/repairmimetypes.php +++ b/lib/repair/repairmimetypes.php @@ -123,7 +123,7 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { $insertStmt = \OC_DB::prepare(' INSERT INTO `*PREFIX*mimetypes` ( `mimetype` ) VALUES ( ? ) - '); + '); $updateByNameStmt = \OC_DB::prepare(' -- cgit v1.2.3