|
8 | 8 |
|
9 | 9 | namespace OCA\Files_Sharing\Repair; |
10 | 10 |
|
| 11 | +use OC\Files\Cache\CacheEntry; |
11 | 12 | use OC\Files\SetupManager; |
12 | 13 | use OCA\Files_Sharing\ShareTargetValidator; |
13 | 14 | use OCP\DB\QueryBuilder\IQueryBuilder; |
@@ -111,12 +112,23 @@ public function run(IOutput $output) { |
111 | 112 | ); |
112 | 113 | $newTarget = $userFolder->getRelativePath($absoluteNewTarget); |
113 | 114 |
|
114 | | - $this->moveShare((string)$shareInfo['id'], $newTarget); |
| 115 | + if ($newTarget !== $oldTarget) { |
| 116 | + $this->moveShare((string)$shareInfo['id'], $newTarget); |
115 | 117 |
|
116 | | - $oldMountPoint = "/{$recipient->getUID()}/files$oldTarget/"; |
117 | | - $newMountPoint = "/{$recipient->getUID()}/files$newTarget/"; |
118 | | - $userMounts[$newMountPoint] = $userMounts[$oldMountPoint]; |
119 | | - unset($userMounts[$oldMountPoint]); |
| 118 | + $oldMountPoint = "/{$recipient->getUID()}/files$oldTarget/"; |
| 119 | + $newMountPoint = "/{$recipient->getUID()}/files$newTarget/"; |
| 120 | + |
| 121 | + /** @var ICachedMountInfo $mount */ |
| 122 | + $mount = $userMounts[$oldMountPoint]; |
| 123 | + $userMounts[$newMountPoint] = $mount; |
| 124 | + unset($userMounts[$oldMountPoint]); |
| 125 | + |
| 126 | + $this->userMountCache->removeMount($oldMountPoint); |
| 127 | + $this->userMountCache->addMount($recipient, $newMountPoint, new CacheEntry([ |
| 128 | + 'fileid' => $mount->getRootId(), |
| 129 | + 'storage' => $mount->getStorageId(), |
| 130 | + ]), $mount->getMountProvider(), $mount->getMountId()); |
| 131 | + } |
120 | 132 | } catch (\Exception $e) { |
121 | 133 | $msg = 'error cleaning up share target: ' . $e->getMessage(); |
122 | 134 | $this->logger->error($msg, ['exception' => $e, 'app' => 'files_sharing']); |
|
0 commit comments