Reduce amount of rows to update
This commit is contained in:
parent
429bd7ce37
commit
262d7e659d
|
@ -76,11 +76,8 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
|
|||
private static function updateByNameStmt() {
|
||||
return \OC_DB::prepare('
|
||||
UPDATE `*PREFIX*filecache`
|
||||
SET `mimetype` = (
|
||||
SELECT `id`
|
||||
FROM `*PREFIX*mimetypes`
|
||||
WHERE `mimetype` = ?
|
||||
) WHERE `name` ILIKE ?
|
||||
SET `mimetype` = ?
|
||||
WHERE `mimetype` <> ? AND `name` ILIKE ?
|
||||
');
|
||||
}
|
||||
|
||||
|
@ -123,8 +120,11 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep {
|
|||
\OC_DB::executeAudited(self::insertStmt(), array($mimetype));
|
||||
}
|
||||
|
||||
// get target mimetype id
|
||||
$mimetypeId = \OC_DB::executeAudited(self::getIdStmt(), array($mimetype));
|
||||
|
||||
// change mimetype for files with x extension
|
||||
\OC_DB::executeAudited(self::updateByNameStmt(), array($mimetype, '%.' . $extension));
|
||||
\OC_DB::executeAudited(self::updateByNameStmt(), array($mimetypeId, $mimetypeId, '%.' . $extension));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue