Skip to content

Commit 0414613

Browse files
Vincent Petrytomneedham
authored andcommitted
Workaround for Oracle trigger for fileid
1 parent cce6f98 commit 0414613

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

lib/private/repair/repairmismatchfilecachepath.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -412,6 +412,19 @@ private function getOrCreateEntry($storageId, $path, $reuseFileId = null) {
412412

413413
// If we reused the fileid then this is the id to return
414414
if($reuseFileId !== null) {
415+
// with Oracle, the trigger gets in the way and does not let us specify
416+
// a fileid value on insert
417+
if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
418+
$lastFileId = $this->connection->lastInsertId('*PREFIX*filecache');
419+
if ($reuseFileId !== $lastFileId) {
420+
// use update to set it directly
421+
$qb = $this->connection->getQueryBuilder();
422+
$qb->update('filecache')
423+
->set('fileid', $qb->createNamedParameter($reuseFileId))
424+
->where($qb->expr()->eq('fileid', $qb->createNamedParameter($lastFileId)));
425+
$qb->execute();
426+
}
427+
}
415428
return $reuseFileId;
416429
} else {
417430
// Else we inserted a new row with auto generated id, use that

0 commit comments

Comments
 (0)