[Pkg-owncloud-commits] [owncloud] 346/457: Reduce amount of rows to update

David Prévot taffit at moszumanska.debian.org
Sun Jun 28 20:06:38 UTC 2015


This is an automated email from the git hooks/post-receive script.

taffit pushed a commit to branch stable8
in repository owncloud.

commit 262d7e659dd5afddc7339bac60da164753b243ad
Author: Victor Dubiniuk <victor.dubiniuk at gmail.com>
Date:   Tue Jun 9 01:02:26 2015 +0300

    Reduce amount of rows to update
---
 lib/repair/repairmimetypes.php | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

diff --git a/lib/repair/repairmimetypes.php b/lib/repair/repairmimetypes.php
index 1b36894..76050f3 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));
 		}
 	}
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud.git



More information about the Pkg-owncloud-commits mailing list