diff options
author | Morris Jobke <hey@morrisjobke.de> | 2015-06-10 15:57:21 +0200 |
---|---|---|
committer | Morris Jobke <hey@morrisjobke.de> | 2015-06-10 15:57:21 +0200 |
commit | be6ba653eab6e7262c01aca8f93bbab6c2e76f00 (patch) | |
tree | 436221ce2382d4ad206bfb4114b77ddba054faab | |
parent | 4747c7f50911742cda47b14f6e6fab0181738e71 (diff) | |
parent | 0235e5edd37478ce34eb259b48376d452cdf36c2 (diff) | |
download | nextcloud-server-be6ba653eab6e7262c01aca8f93bbab6c2e76f00.tar.gz nextcloud-server-be6ba653eab6e7262c01aca8f93bbab6c2e76f00.zip |
Merge pull request #16814 from owncloud/improve-repair
Reduce amount of rows to update
-rw-r--r-- | lib/repair/repairmimetypes.php | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php index 1b36894eed8..fa6aa1130d6 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,13 @@ class RepairMimeTypes extends BasicEmitter implements \OC\RepairStep { // insert mimetype \OC_DB::executeAudited(self::insertStmt(), array($mimetype)); } + + // get target mimetype id + $result = \OC_DB::executeAudited(self::getIdStmt(), array($mimetype)); + $mimetypeId = $result->fetchOne(); // change mimetype for files with x extension - \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetype, '%.' . $extension)); + \OC_DB::executeAudited(self::updateByNameStmt(), array($mimetypeId, $mimetypeId, '%.' . $extension)); } } |