diff options
author | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2015-06-09 01:02:26 +0300 |
---|---|---|
committer | Victor Dubiniuk <victor.dubiniuk@gmail.com> | 2015-06-09 01:04:42 +0300 |
commit | 262d7e659dd5afddc7339bac60da164753b243ad (patch) | |
tree | 3d912a2d3cccb72ed589e392e600b13688b9b1cc /lib/repair | |
parent | 429bd7ce3772ffea312280feb3e4089f47681935 (diff) | |
download | nextcloud-server-262d7e659dd5afddc7339bac60da164753b243ad.tar.gz nextcloud-server-262d7e659dd5afddc7339bac60da164753b243ad.zip |
Reduce amount of rows to update
Diffstat (limited to 'lib/repair')
-rw-r--r-- | lib/repair/repairmimetypes.php | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php index 1b36894eed8..76050f32f18 100644 --- a/lib/repair/repairmimetypes.php +++ b/lib/repair/repairmimetypes.php @@ -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 ? '); } @@ -122,9 +119,12 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { // insert mimetype \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)); } } |