Merge pull request #7027 from nextcloud/Rello-patch-1

Rello patch 1
This commit is contained in:
Morris Jobke 2017-11-09 09:41:01 +01:00 committed by GitHub
commit eab2b3b7ae
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 25 additions and 5 deletions

View File

@ -92,6 +92,7 @@ class RepairMimeTypes implements IRepairStep {
$this->folderMimeTypeId = (int)$result->fetchOne();
}
$count = 0;
foreach ($updatedMimetypes as $extension => $mimetype) {
$result = \OC_DB::executeAudited(self::existsStmt(), array($mimetype));
$exists = $result->fetchOne();
@ -106,8 +107,10 @@ class RepairMimeTypes implements IRepairStep {
$mimetypeId = $result->fetchOne();
// change mimetype for files with x extension
\OC_DB::executeAudited(self::updateByNameStmt(), array($mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.' . $extension));
$count += \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetypeId, $this->folderMimeTypeId, $mimetypeId, '%.' . $extension));
}
return $count;
}
private function introduceImageTypes() {
@ -116,7 +119,7 @@ class RepairMimeTypes implements IRepairStep {
'webp' => 'image/webp',
);
$this->updateMimetypes($updatedMimetypes);
return $this->updateMimetypes($updatedMimetypes);
}
private function introduceWindowsProgramTypes() {
@ -126,7 +129,7 @@ class RepairMimeTypes implements IRepairStep {
'cmd' => 'application/cmd',
);
$this->updateMimetypes($updatedMimetypes);
return $this->updateMimetypes($updatedMimetypes);
}
private function introduceLocationTypes() {
@ -137,7 +140,7 @@ class RepairMimeTypes implements IRepairStep {
'tcx' => 'application/vnd.garmin.tcx+xml',
];
$this->updateMimetypes($updatedMimetypes);
return $this->updateMimetypes($updatedMimetypes);
}
private function introduceInternetShortcutTypes() {
@ -146,7 +149,17 @@ class RepairMimeTypes implements IRepairStep {
'webloc' => 'application/internet-shortcut'
];
$this->updateMimetypes($updatedMimetypes);
return $this->updateMimetypes($updatedMimetypes);
}
private function introduceStreamingTypes() {
$updatedMimetypes = [
'm3u' => 'audio/mpegurl',
'm3u8' => 'audio/mpegurl',
'pls' => 'audio/x-scpls'
];
return $this->updateMimetypes($updatedMimetypes);
}
/**
@ -174,5 +187,9 @@ class RepairMimeTypes implements IRepairStep {
if (version_compare($ocVersionFromBeforeUpdate, '13.0.0.3', '<') && $this->introduceInternetShortcutTypes()) {
$out->info('Fixed internet-shortcut mime types');
}
if (version_compare($ocVersionFromBeforeUpdate, '13.0.0.6', '<') && $this->introduceStreamingTypes()) {
$out->info('Fixed streaming mime types');
}
}
}

View File

@ -88,6 +88,8 @@
"ldif": ["text/x-ldif"],
"lwp": ["application/vnd.lotus-wordpro"],
"m2t": ["video/mp2t"],
"m3u": ["audio/mpegurl"],
"m3u8": ["audio/mpegurl"],
"m4a": ["audio/mp4"],
"m4b": ["audio/m4b"],
"m4v": ["video/mp4"],
@ -129,6 +131,7 @@
"pef": ["image/x-dcraw"],
"php": ["application/x-php"],
"pl": ["application/x-perl"],
"pls": ["audio/x-scpls"],
"png": ["image/png"],
"pot": ["application/vnd.ms-powerpoint"],
"potm": ["application/vnd.ms-powerpoint.template.macroEnabled.12"],