@@ -161,14 +161,15 @@ private function markParentAsOutdated($mountId, $path, OutputInterface $output)
161
161
$ parent = '' ;
162
162
}
163
163
164
+ $ pathHash = md5 (trim (\OC_Util::normalizeUnicode ($ parent ), '/ ' ));
164
165
try {
165
- $ this ->updateQuery ->execute ([$ parent , $ mountId ]);
166
+ $ this ->updateQuery ->execute ([$ mountId , $ pathHash ]);
166
167
} catch (DriverException $ ex ) {
167
168
$ this ->logger ->logException ($ ex , ['app ' => 'files_external ' , 'message ' => 'Error while trying to mark folder as outdated ' , 'level ' => ILogger::WARN ]);
168
169
$ this ->connection = $ this ->reconnectToDatabase ($ this ->connection , $ output );
169
170
$ output ->writeln ('<info>Needed to reconnect to the database</info> ' );
170
171
$ this ->updateQuery = $ this ->getUpdateQuery ($ this ->connection );
171
- $ this ->updateQuery ->execute ([$ parent , $ mountId ]);
172
+ $ this ->updateQuery ->execute ([$ mountId , $ pathHash ]);
172
173
}
173
174
}
174
175
@@ -204,9 +205,11 @@ private function logUpdate(IChange $change, OutputInterface $output) {
204
205
private function getUpdateQuery (IDBConnection $ connection ) {
205
206
// the query builder doesn't really like subqueries with parameters
206
207
return $ connection ->prepare (
207
- 'UPDATE *PREFIX*filecache SET size = -1
208
- WHERE `path` = ?
209
- AND `storage` IN (SELECT storage_id FROM *PREFIX*mounts WHERE mount_id = ?) '
208
+ 'UPDATE *PREFIX*filecache
209
+ INNER JOIN *PREFIX*mounts
210
+ ON (*PREFIX*filecache.storage = *PREFIX*mounts.storage_id)
211
+ SET size = -1
212
+ WHERE `path_hash` = ? '
210
213
);
211
214
}
212
215
0 commit comments