From bc52f121626bb1bb1f67bc1f876d0420d153b3d1 Mon Sep 17 00:00:00 2001
From: Robin Appelman <icewind@owncloud.com>
Date: Sat, 15 Dec 2012 02:29:34 +0100
Subject: [PATCH] dont insert and entry in the filecache during upgrade if the
 id already exists in the filecache

most likely the result from an incompelte upgrade
---
 lib/files/cache/upgrade.php | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lib/files/cache/upgrade.php b/lib/files/cache/upgrade.php
index ebac387de9..9219deebef 100644
--- a/lib/files/cache/upgrade.php
+++ b/lib/files/cache/upgrade.php
@@ -29,7 +29,13 @@ class Upgrade {
 			return;
 		}
 
+		$checkExistingQuery = \OC_DB::prepare('SELECT `fileid` FROM `*PREFIX*filecache` WHERE `fileid` = ?');
+
 		while ($row = $oldEntriesResult->fetchRow()) {
+			if($checkExistingQuery->execute(array($row['id']))->fetchRow()){
+				continue;
+			}
+
 			list($storage, $internalPath) = \OC\Files\Filesystem::resolvePath($row['path']);
 			/**
 			 * @var \OC\Files\Storage\Storage $storage
-- 
GitLab