|
@@ -98,7 +98,7 @@ discard block |
|
|
block discarded – undo |
|
98
|
98
|
$output = $output ?? new NullOutput(); |
|
99
|
99
|
$sourceUid = $sourceUser->getUID(); |
|
100
|
100
|
$destinationUid = $destinationUser->getUID(); |
|
101
|
|
- $sourcePath = rtrim($sourceUid . '/files/' . $path, '/'); |
|
|
101
|
+ $sourcePath = rtrim($sourceUid.'/files/'.$path, '/'); |
|
102
|
102
|
|
|
103
|
103
|
// If encryption is on we have to ensure the user has logged in before and that all encryption modules are ready |
|
104
|
104
|
if (($this->encryptionManager->isEnabled() && $destinationUser->getLastLogin() === 0) |
|
@@ -206,7 +206,7 @@ discard block |
|
|
block discarded – undo |
|
206
|
206
|
OutputInterface $output): void { |
|
207
|
207
|
$output->writeln('Validating quota'); |
|
208
|
208
|
$size = $view->getFileInfo($sourcePath, false)->getSize(false); |
|
209
|
|
- $freeSpace = $view->free_space($destinationUid . '/files/'); |
|
|
209
|
+ $freeSpace = $view->free_space($destinationUid.'/files/'); |
|
210
|
210
|
if ($size > $freeSpace && $freeSpace !== FileInfo::SPACE_UNKNOWN) { |
|
211
|
211
|
$output->writeln('<error>Target user does not have enough free space available.</error>'); |
|
212
|
212
|
throw new \Exception('Execution terminated.'); |
|
@@ -218,7 +218,7 @@ discard block |
|
|
block discarded – undo |
|
218
|
218
|
|
|
219
|
219
|
$encryptedFiles = []; |
|
220
|
220
|
$this->walkFiles($view, $sourcePath, |
|
221
|
|
- function (FileInfo $fileInfo) use ($progress) { |
|
|
221
|
+ function(FileInfo $fileInfo) use ($progress) { |
|
222
|
222
|
if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
|
223
|
223
|
// only analyze into folders from main storage, |
|
224
|
224
|
if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
|
@@ -240,7 +240,7 @@ discard block |
|
|
block discarded – undo |
|
240
|
240
|
$output->writeln("<error>Some files are encrypted - please decrypt them first.</error>"); |
|
241
|
241
|
foreach ($encryptedFiles as $encryptedFile) { |
|
242
|
242
|
/** @var FileInfo $encryptedFile */ |
|
243
|
|
- $output->writeln(" " . $encryptedFile->getPath()); |
|
|
243
|
+ $output->writeln(" ".$encryptedFile->getPath()); |
|
244
|
244
|
} |
|
245
|
245
|
throw new \Exception('Execution terminated.'); |
|
246
|
246
|
} |
|
@@ -263,7 +263,7 @@ discard block |
|
|
block discarded – undo |
|
263
|
263
|
break; |
|
264
|
264
|
} |
|
265
|
265
|
if ($path !== "$sourceUid/files") { |
|
266
|
|
- $sharePage = array_filter($sharePage, function (IShare $share) use ($view, $path) { |
|
|
266
|
+ $sharePage = array_filter($sharePage, function(IShare $share) use ($view, $path) { |
|
267
|
267
|
try { |
|
268
|
268
|
$relativePath = $view->getPath($share->getNodeId()); |
|
269
|
269
|
$singleFileTranfer = $view->is_file($path); |
|
@@ -272,8 +272,8 @@ discard block |
|
|
block discarded – undo |
|
272
|
272
|
} |
|
273
|
273
|
|
|
274
|
274
|
return mb_strpos( |
|
275
|
|
- Filesystem::normalizePath($relativePath . '/', false), |
|
276
|
|
- Filesystem::normalizePath($path . '/', false)) === 0; |
|
|
275
|
+ Filesystem::normalizePath($relativePath.'/', false), |
|
|
276
|
+ Filesystem::normalizePath($path.'/', false)) === 0; |
|
277
|
277
|
} catch (\Exception $e) { |
|
278
|
278
|
return false; |
|
279
|
279
|
} |
|
@@ -303,7 +303,7 @@ discard block |
|
|
block discarded – undo |
|
303
|
303
|
// Else only the content inside folder is transferred which is not correct. |
|
304
|
304
|
if ($sourcePath !== "$sourceUid/files") { |
|
305
|
305
|
$view->mkdir($finalTarget); |
|
306
|
|
- $finalTarget = $finalTarget . '/' . basename($sourcePath); |
|
|
306
|
+ $finalTarget = $finalTarget.'/'.basename($sourcePath); |
|
307
|
307
|
} |
|
308
|
308
|
if ($view->rename($sourcePath, $finalTarget) === false) { |
|
309
|
309
|
throw new TransferOwnershipException("Could not transfer files.", 1); |
|
@@ -326,7 +326,7 @@ discard block |
|
|
block discarded – undo |
|
326
|
326
|
if ($share->getShareType() === IShare::TYPE_USER && |
|
327
|
327
|
$share->getSharedWith() === $destinationUid) { |
|
328
|
328
|
// Unmount the shares before deleting, so we don't try to get the storage later on. |
|
329
|
|
- $shareMountPoint = $this->mountManager->find('/' . $destinationUid . '/files' . $share->getTarget()); |
|
|
329
|
+ $shareMountPoint = $this->mountManager->find('/'.$destinationUid.'/files'.$share->getTarget()); |
|
330
|
330
|
if ($shareMountPoint) { |
|
331
|
331
|
$this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
|
332
|
332
|
} |
|
@@ -348,9 +348,9 @@ discard block |
|
|
block discarded – undo |
|
348
|
348
|
$this->shareManager->updateShare($share); |
|
349
|
349
|
} |
|
350
|
350
|
} catch (\OCP\Files\NotFoundException $e) { |
|
351
|
|
- $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
|
351
|
+ $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
352
|
352
|
} catch (\Throwable $e) { |
|
353
|
|
- $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
|
353
|
+ $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
354
|
354
|
} |
|
355
|
355
|
$progress->advance(); |
|
356
|
356
|
} |