Skip to content

Commit

Permalink
Workaround for Oracle trigger for fileid
Browse files Browse the repository at this point in the history
  • Loading branch information
Vincent Petry committed Sep 19, 2017
1 parent b62ff20 commit 4c15721
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions lib/private/Repair/RepairMismatchFileCachePath.php
Original file line number Diff line number Diff line change
Expand Up @@ -413,6 +413,20 @@ private function getOrCreateEntry($storageId, $path, $reuseFileId = null) {

// If we reused the fileid then this is the id to return
if($reuseFileId !== null) {
// with Oracle, the trigger gets in the way and does not let us specify
// a fileid value on insert
if ($this->connection->getDatabasePlatform() instanceof OraclePlatform) {
$lastFileId = $this->connection->lastInsertId('*PREFIX*filecache');
if ($reuseFileId !== $lastFileId) {
// use update to set it directly
$qb = $this->connection->getQueryBuilder();
$qb->update('filecache')
->set('fileid', $qb->createNamedParameter($reuseFileId))
->where($qb->expr()->eq('fileid', $qb->createNamedParameter($lastFileId)));
$qb->execute();
}
}

return $reuseFileId;
} else {
// Else we inserted a new row with auto generated id, use that
Expand Down

0 comments on commit 4c15721

Please sign in to comment.