|
@@ -123,7 +123,7 @@ discard block |
|
|
block discarded – undo |
|
123
|
123
|
$this->sourceUser = $sourceUserObject->getUID(); |
|
124
|
124
|
$this->destinationUser = $destinationUserObject->getUID(); |
|
125
|
125
|
$sourcePathOption = ltrim($input->getOption('path'), '/'); |
|
126
|
|
- $this->sourcePath = rtrim($this->sourceUser . '/files/' . $sourcePathOption, '/'); |
|
|
126
|
+ $this->sourcePath = rtrim($this->sourceUser.'/files/'.$sourcePathOption, '/'); |
|
127
|
127
|
|
|
128
|
128
|
// target user has to be ready |
|
129
|
129
|
if (!\OC::$server->getEncryptionManager()->isReadyForUser($this->destinationUser)) { |
|
@@ -180,7 +180,7 @@ discard block |
|
|
block discarded – undo |
|
180
|
180
|
$self = $this; |
|
181
|
181
|
|
|
182
|
182
|
$this->walkFiles($view, $this->sourcePath, |
|
183
|
|
- function (FileInfo $fileInfo) use ($progress, $self) { |
|
|
183
|
+ function(FileInfo $fileInfo) use ($progress, $self) { |
|
184
|
184
|
if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
|
185
|
185
|
// only analyze into folders from main storage, |
|
186
|
186
|
if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
|
@@ -201,9 +201,9 @@ discard block |
|
|
block discarded – undo |
|
201
|
201
|
// no file is allowed to be encrypted |
|
202
|
202
|
if (!empty($this->encryptedFiles)) { |
|
203
|
203
|
$output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
|
204
|
|
- foreach($this->encryptedFiles as $encryptedFile) { |
|
|
204
|
+ foreach ($this->encryptedFiles as $encryptedFile) { |
|
205
|
205
|
/** @var FileInfo $encryptedFile */ |
|
206
|
|
- $output->writeln(" " . $encryptedFile->getPath()); |
|
|
206
|
+ $output->writeln(" ".$encryptedFile->getPath()); |
|
207
|
207
|
} |
|
208
|
208
|
throw new \Exception('Execution terminated.'); |
|
209
|
209
|
} |
|
@@ -217,7 +217,7 @@ discard block |
|
|
block discarded – undo |
|
217
|
217
|
$output->writeln("Collecting all share information for files and folder of $this->sourceUser ..."); |
|
218
|
218
|
|
|
219
|
219
|
$progress = new ProgressBar($output, count($this->shares)); |
|
220
|
|
- foreach([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
|
220
|
+ foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE] as $shareType) { |
|
221
|
221
|
$offset = 0; |
|
222
|
222
|
while (true) { |
|
223
|
223
|
$sharePage = $this->shareManager->getSharesBy($this->sourceUser, $shareType, null, true, 50, $offset); |
|
@@ -243,9 +243,9 @@ discard block |
|
|
block discarded – undo |
|
243
|
243
|
|
|
244
|
244
|
// This change will help user to transfer the folder specified using --path option. |
|
245
|
245
|
// Else only the content inside folder is transferred which is not correct. |
|
246
|
|
- if($this->sourcePath !== "$this->sourceUser/files") { |
|
|
246
|
+ if ($this->sourcePath !== "$this->sourceUser/files") { |
|
247
|
247
|
$view->mkdir($this->finalTarget); |
|
248
|
|
- $this->finalTarget = $this->finalTarget . '/' . basename($this->sourcePath); |
|
|
248
|
+ $this->finalTarget = $this->finalTarget.'/'.basename($this->sourcePath); |
|
249
|
249
|
} |
|
250
|
250
|
$view->rename($this->sourcePath, $this->finalTarget); |
|
251
|
251
|
if (!is_dir("$this->sourceUser/files")) { |
|
@@ -261,12 +261,12 @@ discard block |
|
|
block discarded – undo |
|
261
|
261
|
$output->writeln("Restoring shares ..."); |
|
262
|
262
|
$progress = new ProgressBar($output, count($this->shares)); |
|
263
|
263
|
|
|
264
|
|
- foreach($this->shares as $share) { |
|
|
264
|
+ foreach ($this->shares as $share) { |
|
265
|
265
|
try { |
|
266
|
266
|
if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && |
|
267
|
267
|
$share->getSharedWith() === $this->destinationUser) { |
|
268
|
268
|
// Unmount the shares before deleting, so we don't try to get the storage later on. |
|
269
|
|
- $shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget()); |
|
|
269
|
+ $shareMountPoint = $this->mountManager->find('/'.$this->destinationUser.'/files'.$share->getTarget()); |
|
270
|
270
|
if ($shareMountPoint) { |
|
271
|
271
|
$this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
|
272
|
272
|
} |
|
@@ -282,9 +282,9 @@ discard block |
|
|
block discarded – undo |
|
282
|
282
|
$this->shareManager->updateShare($share); |
|
283
|
283
|
} |
|
284
|
284
|
} catch (\OCP\Files\NotFoundException $e) { |
|
285
|
|
- $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
|
285
|
+ $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
286
|
286
|
} catch (\Exception $e) { |
|
287
|
|
- $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
|
287
|
+ $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
288
|
288
|
} |
|
289
|
289
|
$progress->advance(); |
|
290
|
290
|
} |