@@ -6,37 +6,37 @@ |
||
6 | 6 | $baseDir = $vendorDir; |
7 | 7 | |
8 | 8 | return array( |
9 | - 'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir . '/../lib/Activity/FavoriteProvider.php', |
|
10 | - 'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir . '/../lib/Activity/Filter/Favorites.php', |
|
11 | - 'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir . '/../lib/Activity/Filter/FileChanges.php', |
|
12 | - 'OCA\\Files\\Activity\\Helper' => $baseDir . '/../lib/Activity/Helper.php', |
|
13 | - 'OCA\\Files\\Activity\\Provider' => $baseDir . '/../lib/Activity/Provider.php', |
|
14 | - 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir . '/../lib/Activity/Settings/FavoriteAction.php', |
|
15 | - 'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir . '/../lib/Activity/Settings/FileChanged.php', |
|
16 | - 'OCA\\Files\\Activity\\Settings\\FileCreated' => $baseDir . '/../lib/Activity/Settings/FileCreated.php', |
|
17 | - 'OCA\\Files\\Activity\\Settings\\FileDeleted' => $baseDir . '/../lib/Activity/Settings/FileDeleted.php', |
|
18 | - 'OCA\\Files\\Activity\\Settings\\FileFavorite' => $baseDir . '/../lib/Activity/Settings/FileFavorite.php', |
|
19 | - 'OCA\\Files\\Activity\\Settings\\FileRestored' => $baseDir . '/../lib/Activity/Settings/FileRestored.php', |
|
20 | - 'OCA\\Files\\App' => $baseDir . '/../lib/App.php', |
|
21 | - 'OCA\\Files\\AppInfo\\Application' => $baseDir . '/../lib/AppInfo/Application.php', |
|
22 | - 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir . '/../lib/BackgroundJob/CleanupFileLocks.php', |
|
23 | - 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir . '/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
24 | - 'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir . '/../lib/BackgroundJob/ScanFiles.php', |
|
25 | - 'OCA\\Files\\Capabilities' => $baseDir . '/../lib/Capabilities.php', |
|
26 | - 'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir . '/../lib/Collaboration/Resources/Listener.php', |
|
27 | - 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir . '/../lib/Collaboration/Resources/ResourceProvider.php', |
|
28 | - 'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir . '/../lib/Command/DeleteOrphanedFiles.php', |
|
29 | - 'OCA\\Files\\Command\\Scan' => $baseDir . '/../lib/Command/Scan.php', |
|
30 | - 'OCA\\Files\\Command\\ScanAppData' => $baseDir . '/../lib/Command/ScanAppData.php', |
|
31 | - 'OCA\\Files\\Command\\TransferOwnership' => $baseDir . '/../lib/Command/TransferOwnership.php', |
|
32 | - 'OCA\\Files\\Controller\\AjaxController' => $baseDir . '/../lib/Controller/AjaxController.php', |
|
33 | - 'OCA\\Files\\Controller\\ApiController' => $baseDir . '/../lib/Controller/ApiController.php', |
|
34 | - 'OCA\\Files\\Controller\\ViewController' => $baseDir . '/../lib/Controller/ViewController.php', |
|
35 | - 'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => $baseDir . '/../lib/Event/LoadAdditionalScriptsEvent.php', |
|
36 | - 'OCA\\Files\\Event\\LoadSidebar' => $baseDir . '/../lib/Event/LoadSidebar.php', |
|
37 | - 'OCA\\Files\\Exception\\TransferOwnershipException' => $baseDir . '/../lib/Exception/TransferOwnershipException.php', |
|
38 | - 'OCA\\Files\\Helper' => $baseDir . '/../lib/Helper.php', |
|
39 | - 'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php', |
|
40 | - 'OCA\\Files\\Service\\OwnershipTransferService' => $baseDir . '/../lib/Service/OwnershipTransferService.php', |
|
41 | - 'OCA\\Files\\Service\\TagService' => $baseDir . '/../lib/Service/TagService.php', |
|
9 | + 'OCA\\Files\\Activity\\FavoriteProvider' => $baseDir.'/../lib/Activity/FavoriteProvider.php', |
|
10 | + 'OCA\\Files\\Activity\\Filter\\Favorites' => $baseDir.'/../lib/Activity/Filter/Favorites.php', |
|
11 | + 'OCA\\Files\\Activity\\Filter\\FileChanges' => $baseDir.'/../lib/Activity/Filter/FileChanges.php', |
|
12 | + 'OCA\\Files\\Activity\\Helper' => $baseDir.'/../lib/Activity/Helper.php', |
|
13 | + 'OCA\\Files\\Activity\\Provider' => $baseDir.'/../lib/Activity/Provider.php', |
|
14 | + 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => $baseDir.'/../lib/Activity/Settings/FavoriteAction.php', |
|
15 | + 'OCA\\Files\\Activity\\Settings\\FileChanged' => $baseDir.'/../lib/Activity/Settings/FileChanged.php', |
|
16 | + 'OCA\\Files\\Activity\\Settings\\FileCreated' => $baseDir.'/../lib/Activity/Settings/FileCreated.php', |
|
17 | + 'OCA\\Files\\Activity\\Settings\\FileDeleted' => $baseDir.'/../lib/Activity/Settings/FileDeleted.php', |
|
18 | + 'OCA\\Files\\Activity\\Settings\\FileFavorite' => $baseDir.'/../lib/Activity/Settings/FileFavorite.php', |
|
19 | + 'OCA\\Files\\Activity\\Settings\\FileRestored' => $baseDir.'/../lib/Activity/Settings/FileRestored.php', |
|
20 | + 'OCA\\Files\\App' => $baseDir.'/../lib/App.php', |
|
21 | + 'OCA\\Files\\AppInfo\\Application' => $baseDir.'/../lib/AppInfo/Application.php', |
|
22 | + 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => $baseDir.'/../lib/BackgroundJob/CleanupFileLocks.php', |
|
23 | + 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => $baseDir.'/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
24 | + 'OCA\\Files\\BackgroundJob\\ScanFiles' => $baseDir.'/../lib/BackgroundJob/ScanFiles.php', |
|
25 | + 'OCA\\Files\\Capabilities' => $baseDir.'/../lib/Capabilities.php', |
|
26 | + 'OCA\\Files\\Collaboration\\Resources\\Listener' => $baseDir.'/../lib/Collaboration/Resources/Listener.php', |
|
27 | + 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => $baseDir.'/../lib/Collaboration/Resources/ResourceProvider.php', |
|
28 | + 'OCA\\Files\\Command\\DeleteOrphanedFiles' => $baseDir.'/../lib/Command/DeleteOrphanedFiles.php', |
|
29 | + 'OCA\\Files\\Command\\Scan' => $baseDir.'/../lib/Command/Scan.php', |
|
30 | + 'OCA\\Files\\Command\\ScanAppData' => $baseDir.'/../lib/Command/ScanAppData.php', |
|
31 | + 'OCA\\Files\\Command\\TransferOwnership' => $baseDir.'/../lib/Command/TransferOwnership.php', |
|
32 | + 'OCA\\Files\\Controller\\AjaxController' => $baseDir.'/../lib/Controller/AjaxController.php', |
|
33 | + 'OCA\\Files\\Controller\\ApiController' => $baseDir.'/../lib/Controller/ApiController.php', |
|
34 | + 'OCA\\Files\\Controller\\ViewController' => $baseDir.'/../lib/Controller/ViewController.php', |
|
35 | + 'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => $baseDir.'/../lib/Event/LoadAdditionalScriptsEvent.php', |
|
36 | + 'OCA\\Files\\Event\\LoadSidebar' => $baseDir.'/../lib/Event/LoadSidebar.php', |
|
37 | + 'OCA\\Files\\Exception\\TransferOwnershipException' => $baseDir.'/../lib/Exception/TransferOwnershipException.php', |
|
38 | + 'OCA\\Files\\Helper' => $baseDir.'/../lib/Helper.php', |
|
39 | + 'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => $baseDir.'/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php', |
|
40 | + 'OCA\\Files\\Service\\OwnershipTransferService' => $baseDir.'/../lib/Service/OwnershipTransferService.php', |
|
41 | + 'OCA\\Files\\Service\\TagService' => $baseDir.'/../lib/Service/TagService.php', |
|
42 | 42 | ); |
@@ -6,59 +6,59 @@ |
||
6 | 6 | |
7 | 7 | class ComposerStaticInitFiles |
8 | 8 | { |
9 | - public static $prefixLengthsPsr4 = array ( |
|
9 | + public static $prefixLengthsPsr4 = array( |
|
10 | 10 | 'O' => |
11 | - array ( |
|
11 | + array( |
|
12 | 12 | 'OCA\\Files\\' => 10, |
13 | 13 | ), |
14 | 14 | ); |
15 | 15 | |
16 | - public static $prefixDirsPsr4 = array ( |
|
16 | + public static $prefixDirsPsr4 = array( |
|
17 | 17 | 'OCA\\Files\\' => |
18 | - array ( |
|
19 | - 0 => __DIR__ . '/..' . '/../lib', |
|
18 | + array( |
|
19 | + 0 => __DIR__.'/..'.'/../lib', |
|
20 | 20 | ), |
21 | 21 | ); |
22 | 22 | |
23 | - public static $classMap = array ( |
|
24 | - 'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__ . '/..' . '/../lib/Activity/FavoriteProvider.php', |
|
25 | - 'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__ . '/..' . '/../lib/Activity/Filter/Favorites.php', |
|
26 | - 'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__ . '/..' . '/../lib/Activity/Filter/FileChanges.php', |
|
27 | - 'OCA\\Files\\Activity\\Helper' => __DIR__ . '/..' . '/../lib/Activity/Helper.php', |
|
28 | - 'OCA\\Files\\Activity\\Provider' => __DIR__ . '/..' . '/../lib/Activity/Provider.php', |
|
29 | - 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__ . '/..' . '/../lib/Activity/Settings/FavoriteAction.php', |
|
30 | - 'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileChanged.php', |
|
31 | - 'OCA\\Files\\Activity\\Settings\\FileCreated' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileCreated.php', |
|
32 | - 'OCA\\Files\\Activity\\Settings\\FileDeleted' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileDeleted.php', |
|
33 | - 'OCA\\Files\\Activity\\Settings\\FileFavorite' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileFavorite.php', |
|
34 | - 'OCA\\Files\\Activity\\Settings\\FileRestored' => __DIR__ . '/..' . '/../lib/Activity/Settings/FileRestored.php', |
|
35 | - 'OCA\\Files\\App' => __DIR__ . '/..' . '/../lib/App.php', |
|
36 | - 'OCA\\Files\\AppInfo\\Application' => __DIR__ . '/..' . '/../lib/AppInfo/Application.php', |
|
37 | - 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__ . '/..' . '/../lib/BackgroundJob/CleanupFileLocks.php', |
|
38 | - 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__ . '/..' . '/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
39 | - 'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__ . '/..' . '/../lib/BackgroundJob/ScanFiles.php', |
|
40 | - 'OCA\\Files\\Capabilities' => __DIR__ . '/..' . '/../lib/Capabilities.php', |
|
41 | - 'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/Listener.php', |
|
42 | - 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__ . '/..' . '/../lib/Collaboration/Resources/ResourceProvider.php', |
|
43 | - 'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__ . '/..' . '/../lib/Command/DeleteOrphanedFiles.php', |
|
44 | - 'OCA\\Files\\Command\\Scan' => __DIR__ . '/..' . '/../lib/Command/Scan.php', |
|
45 | - 'OCA\\Files\\Command\\ScanAppData' => __DIR__ . '/..' . '/../lib/Command/ScanAppData.php', |
|
46 | - 'OCA\\Files\\Command\\TransferOwnership' => __DIR__ . '/..' . '/../lib/Command/TransferOwnership.php', |
|
47 | - 'OCA\\Files\\Controller\\AjaxController' => __DIR__ . '/..' . '/../lib/Controller/AjaxController.php', |
|
48 | - 'OCA\\Files\\Controller\\ApiController' => __DIR__ . '/..' . '/../lib/Controller/ApiController.php', |
|
49 | - 'OCA\\Files\\Controller\\ViewController' => __DIR__ . '/..' . '/../lib/Controller/ViewController.php', |
|
50 | - 'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => __DIR__ . '/..' . '/../lib/Event/LoadAdditionalScriptsEvent.php', |
|
51 | - 'OCA\\Files\\Event\\LoadSidebar' => __DIR__ . '/..' . '/../lib/Event/LoadSidebar.php', |
|
52 | - 'OCA\\Files\\Exception\\TransferOwnershipException' => __DIR__ . '/..' . '/../lib/Exception/TransferOwnershipException.php', |
|
53 | - 'OCA\\Files\\Helper' => __DIR__ . '/..' . '/../lib/Helper.php', |
|
54 | - 'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__ . '/..' . '/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php', |
|
55 | - 'OCA\\Files\\Service\\OwnershipTransferService' => __DIR__ . '/..' . '/../lib/Service/OwnershipTransferService.php', |
|
56 | - 'OCA\\Files\\Service\\TagService' => __DIR__ . '/..' . '/../lib/Service/TagService.php', |
|
23 | + public static $classMap = array( |
|
24 | + 'OCA\\Files\\Activity\\FavoriteProvider' => __DIR__.'/..'.'/../lib/Activity/FavoriteProvider.php', |
|
25 | + 'OCA\\Files\\Activity\\Filter\\Favorites' => __DIR__.'/..'.'/../lib/Activity/Filter/Favorites.php', |
|
26 | + 'OCA\\Files\\Activity\\Filter\\FileChanges' => __DIR__.'/..'.'/../lib/Activity/Filter/FileChanges.php', |
|
27 | + 'OCA\\Files\\Activity\\Helper' => __DIR__.'/..'.'/../lib/Activity/Helper.php', |
|
28 | + 'OCA\\Files\\Activity\\Provider' => __DIR__.'/..'.'/../lib/Activity/Provider.php', |
|
29 | + 'OCA\\Files\\Activity\\Settings\\FavoriteAction' => __DIR__.'/..'.'/../lib/Activity/Settings/FavoriteAction.php', |
|
30 | + 'OCA\\Files\\Activity\\Settings\\FileChanged' => __DIR__.'/..'.'/../lib/Activity/Settings/FileChanged.php', |
|
31 | + 'OCA\\Files\\Activity\\Settings\\FileCreated' => __DIR__.'/..'.'/../lib/Activity/Settings/FileCreated.php', |
|
32 | + 'OCA\\Files\\Activity\\Settings\\FileDeleted' => __DIR__.'/..'.'/../lib/Activity/Settings/FileDeleted.php', |
|
33 | + 'OCA\\Files\\Activity\\Settings\\FileFavorite' => __DIR__.'/..'.'/../lib/Activity/Settings/FileFavorite.php', |
|
34 | + 'OCA\\Files\\Activity\\Settings\\FileRestored' => __DIR__.'/..'.'/../lib/Activity/Settings/FileRestored.php', |
|
35 | + 'OCA\\Files\\App' => __DIR__.'/..'.'/../lib/App.php', |
|
36 | + 'OCA\\Files\\AppInfo\\Application' => __DIR__.'/..'.'/../lib/AppInfo/Application.php', |
|
37 | + 'OCA\\Files\\BackgroundJob\\CleanupFileLocks' => __DIR__.'/..'.'/../lib/BackgroundJob/CleanupFileLocks.php', |
|
38 | + 'OCA\\Files\\BackgroundJob\\DeleteOrphanedItems' => __DIR__.'/..'.'/../lib/BackgroundJob/DeleteOrphanedItems.php', |
|
39 | + 'OCA\\Files\\BackgroundJob\\ScanFiles' => __DIR__.'/..'.'/../lib/BackgroundJob/ScanFiles.php', |
|
40 | + 'OCA\\Files\\Capabilities' => __DIR__.'/..'.'/../lib/Capabilities.php', |
|
41 | + 'OCA\\Files\\Collaboration\\Resources\\Listener' => __DIR__.'/..'.'/../lib/Collaboration/Resources/Listener.php', |
|
42 | + 'OCA\\Files\\Collaboration\\Resources\\ResourceProvider' => __DIR__.'/..'.'/../lib/Collaboration/Resources/ResourceProvider.php', |
|
43 | + 'OCA\\Files\\Command\\DeleteOrphanedFiles' => __DIR__.'/..'.'/../lib/Command/DeleteOrphanedFiles.php', |
|
44 | + 'OCA\\Files\\Command\\Scan' => __DIR__.'/..'.'/../lib/Command/Scan.php', |
|
45 | + 'OCA\\Files\\Command\\ScanAppData' => __DIR__.'/..'.'/../lib/Command/ScanAppData.php', |
|
46 | + 'OCA\\Files\\Command\\TransferOwnership' => __DIR__.'/..'.'/../lib/Command/TransferOwnership.php', |
|
47 | + 'OCA\\Files\\Controller\\AjaxController' => __DIR__.'/..'.'/../lib/Controller/AjaxController.php', |
|
48 | + 'OCA\\Files\\Controller\\ApiController' => __DIR__.'/..'.'/../lib/Controller/ApiController.php', |
|
49 | + 'OCA\\Files\\Controller\\ViewController' => __DIR__.'/..'.'/../lib/Controller/ViewController.php', |
|
50 | + 'OCA\\Files\\Event\\LoadAdditionalScriptsEvent' => __DIR__.'/..'.'/../lib/Event/LoadAdditionalScriptsEvent.php', |
|
51 | + 'OCA\\Files\\Event\\LoadSidebar' => __DIR__.'/..'.'/../lib/Event/LoadSidebar.php', |
|
52 | + 'OCA\\Files\\Exception\\TransferOwnershipException' => __DIR__.'/..'.'/../lib/Exception/TransferOwnershipException.php', |
|
53 | + 'OCA\\Files\\Helper' => __DIR__.'/..'.'/../lib/Helper.php', |
|
54 | + 'OCA\\Files\\Listener\\LegacyLoadAdditionalScriptsAdapter' => __DIR__.'/..'.'/../lib/Listener/LegacyLoadAdditionalScriptsAdapter.php', |
|
55 | + 'OCA\\Files\\Service\\OwnershipTransferService' => __DIR__.'/..'.'/../lib/Service/OwnershipTransferService.php', |
|
56 | + 'OCA\\Files\\Service\\TagService' => __DIR__.'/..'.'/../lib/Service/TagService.php', |
|
57 | 57 | ); |
58 | 58 | |
59 | 59 | public static function getInitializer(ClassLoader $loader) |
60 | 60 | { |
61 | - return \Closure::bind(function () use ($loader) { |
|
61 | + return \Closure::bind(function() use ($loader) { |
|
62 | 62 | $loader->prefixLengthsPsr4 = ComposerStaticInitFiles::$prefixLengthsPsr4; |
63 | 63 | $loader->prefixDirsPsr4 = ComposerStaticInitFiles::$prefixDirsPsr4; |
64 | 64 | $loader->classMap = ComposerStaticInitFiles::$classMap; |
@@ -41,69 +41,69 @@ |
||
41 | 41 | |
42 | 42 | class TransferOwnership extends Command { |
43 | 43 | |
44 | - /** @var IUserManager */ |
|
45 | - private $userManager; |
|
44 | + /** @var IUserManager */ |
|
45 | + private $userManager; |
|
46 | 46 | |
47 | - /** @var OwnershipTransferService */ |
|
48 | - private $transferService; |
|
47 | + /** @var OwnershipTransferService */ |
|
48 | + private $transferService; |
|
49 | 49 | |
50 | - public function __construct(IUserManager $userManager, |
|
51 | - OwnershipTransferService $transferService) { |
|
52 | - parent::__construct(); |
|
53 | - $this->userManager = $userManager; |
|
54 | - $this->transferService = $transferService; |
|
55 | - } |
|
50 | + public function __construct(IUserManager $userManager, |
|
51 | + OwnershipTransferService $transferService) { |
|
52 | + parent::__construct(); |
|
53 | + $this->userManager = $userManager; |
|
54 | + $this->transferService = $transferService; |
|
55 | + } |
|
56 | 56 | |
57 | - protected function configure() { |
|
58 | - $this |
|
59 | - ->setName('files:transfer-ownership') |
|
60 | - ->setDescription('All files and folders are moved to another user - shares are moved as well.') |
|
61 | - ->addArgument( |
|
62 | - 'source-user', |
|
63 | - InputArgument::REQUIRED, |
|
64 | - 'owner of files which shall be moved' |
|
65 | - ) |
|
66 | - ->addArgument( |
|
67 | - 'destination-user', |
|
68 | - InputArgument::REQUIRED, |
|
69 | - 'user who will be the new owner of the files' |
|
70 | - ) |
|
71 | - ->addOption( |
|
72 | - 'path', |
|
73 | - null, |
|
74 | - InputOption::VALUE_REQUIRED, |
|
75 | - 'selectively provide the path to transfer. For example --path="folder_name"', |
|
76 | - '' |
|
77 | - ); |
|
78 | - } |
|
57 | + protected function configure() { |
|
58 | + $this |
|
59 | + ->setName('files:transfer-ownership') |
|
60 | + ->setDescription('All files and folders are moved to another user - shares are moved as well.') |
|
61 | + ->addArgument( |
|
62 | + 'source-user', |
|
63 | + InputArgument::REQUIRED, |
|
64 | + 'owner of files which shall be moved' |
|
65 | + ) |
|
66 | + ->addArgument( |
|
67 | + 'destination-user', |
|
68 | + InputArgument::REQUIRED, |
|
69 | + 'user who will be the new owner of the files' |
|
70 | + ) |
|
71 | + ->addOption( |
|
72 | + 'path', |
|
73 | + null, |
|
74 | + InputOption::VALUE_REQUIRED, |
|
75 | + 'selectively provide the path to transfer. For example --path="folder_name"', |
|
76 | + '' |
|
77 | + ); |
|
78 | + } |
|
79 | 79 | |
80 | - protected function execute(InputInterface $input, OutputInterface $output) { |
|
81 | - $sourceUserObject = $this->userManager->get($input->getArgument('source-user')); |
|
82 | - $destinationUserObject = $this->userManager->get($input->getArgument('destination-user')); |
|
80 | + protected function execute(InputInterface $input, OutputInterface $output) { |
|
81 | + $sourceUserObject = $this->userManager->get($input->getArgument('source-user')); |
|
82 | + $destinationUserObject = $this->userManager->get($input->getArgument('destination-user')); |
|
83 | 83 | |
84 | - if (!$sourceUserObject instanceof IUser) { |
|
85 | - $output->writeln("<error>Unknown source user " . $input->getArgument('source-user') . "</error>"); |
|
86 | - return 1; |
|
87 | - } |
|
84 | + if (!$sourceUserObject instanceof IUser) { |
|
85 | + $output->writeln("<error>Unknown source user " . $input->getArgument('source-user') . "</error>"); |
|
86 | + return 1; |
|
87 | + } |
|
88 | 88 | |
89 | - if (!$destinationUserObject instanceof IUser) { |
|
90 | - $output->writeln("<error>Unknown destination user " . $input->getArgument('destination-user') . "</error>"); |
|
91 | - return 1; |
|
92 | - } |
|
89 | + if (!$destinationUserObject instanceof IUser) { |
|
90 | + $output->writeln("<error>Unknown destination user " . $input->getArgument('destination-user') . "</error>"); |
|
91 | + return 1; |
|
92 | + } |
|
93 | 93 | |
94 | - try { |
|
95 | - $this->transferService->transfer( |
|
96 | - $sourceUserObject, |
|
97 | - $destinationUserObject, |
|
98 | - ltrim($input->getOption('path'), '/'), |
|
99 | - $output |
|
100 | - ); |
|
101 | - } catch (TransferOwnershipException $e) { |
|
102 | - $output->writeln("<error>" . $e->getMessage() . "</error>"); |
|
103 | - return $e->getCode() !== 0 ? $e->getCode() : 1; |
|
104 | - } |
|
94 | + try { |
|
95 | + $this->transferService->transfer( |
|
96 | + $sourceUserObject, |
|
97 | + $destinationUserObject, |
|
98 | + ltrim($input->getOption('path'), '/'), |
|
99 | + $output |
|
100 | + ); |
|
101 | + } catch (TransferOwnershipException $e) { |
|
102 | + $output->writeln("<error>" . $e->getMessage() . "</error>"); |
|
103 | + return $e->getCode() !== 0 ? $e->getCode() : 1; |
|
104 | + } |
|
105 | 105 | |
106 | - return 0; |
|
107 | - } |
|
106 | + return 0; |
|
107 | + } |
|
108 | 108 | |
109 | 109 | } |
@@ -82,12 +82,12 @@ discard block |
||
82 | 82 | $destinationUserObject = $this->userManager->get($input->getArgument('destination-user')); |
83 | 83 | |
84 | 84 | if (!$sourceUserObject instanceof IUser) { |
85 | - $output->writeln("<error>Unknown source user " . $input->getArgument('source-user') . "</error>"); |
|
85 | + $output->writeln("<error>Unknown source user ".$input->getArgument('source-user')."</error>"); |
|
86 | 86 | return 1; |
87 | 87 | } |
88 | 88 | |
89 | 89 | if (!$destinationUserObject instanceof IUser) { |
90 | - $output->writeln("<error>Unknown destination user " . $input->getArgument('destination-user') . "</error>"); |
|
90 | + $output->writeln("<error>Unknown destination user ".$input->getArgument('destination-user')."</error>"); |
|
91 | 91 | return 1; |
92 | 92 | } |
93 | 93 | |
@@ -99,7 +99,7 @@ discard block |
||
99 | 99 | $output |
100 | 100 | ); |
101 | 101 | } catch (TransferOwnershipException $e) { |
102 | - $output->writeln("<error>" . $e->getMessage() . "</error>"); |
|
102 | + $output->writeln("<error>".$e->getMessage()."</error>"); |
|
103 | 103 | return $e->getCode() !== 0 ? $e->getCode() : 1; |
104 | 104 | } |
105 | 105 |
@@ -45,232 +45,232 @@ |
||
45 | 45 | |
46 | 46 | class OwnershipTransferService { |
47 | 47 | |
48 | - /** @var IEncryptionManager */ |
|
49 | - private $encryptionManager; |
|
48 | + /** @var IEncryptionManager */ |
|
49 | + private $encryptionManager; |
|
50 | 50 | |
51 | - /** @var IShareManager */ |
|
52 | - private $shareManager; |
|
51 | + /** @var IShareManager */ |
|
52 | + private $shareManager; |
|
53 | 53 | |
54 | - /** @var IMountManager */ |
|
55 | - private $mountManager; |
|
54 | + /** @var IMountManager */ |
|
55 | + private $mountManager; |
|
56 | 56 | |
57 | - public function __construct(IEncryptionManager $manager, |
|
58 | - IShareManager $shareManager, |
|
59 | - IMountManager $mountManager) { |
|
60 | - $this->encryptionManager = $manager; |
|
61 | - $this->shareManager = $shareManager; |
|
62 | - $this->mountManager = $mountManager; |
|
63 | - } |
|
57 | + public function __construct(IEncryptionManager $manager, |
|
58 | + IShareManager $shareManager, |
|
59 | + IMountManager $mountManager) { |
|
60 | + $this->encryptionManager = $manager; |
|
61 | + $this->shareManager = $shareManager; |
|
62 | + $this->mountManager = $mountManager; |
|
63 | + } |
|
64 | 64 | |
65 | - /** |
|
66 | - * @param IUser $sourceUser |
|
67 | - * @param IUser $destinationUser |
|
68 | - * @param string $path |
|
69 | - * |
|
70 | - * @throws TransferOwnershipException |
|
71 | - */ |
|
72 | - public function transfer(IUser $sourceUser, |
|
73 | - IUser $destinationUser, |
|
74 | - string $path, |
|
75 | - ?OutputInterface $output = null): void { |
|
76 | - $output = $output ?? new NullOutput(); |
|
77 | - $sourceUid = $sourceUser->getUID(); |
|
78 | - $destinationUid = $destinationUser->getUID(); |
|
79 | - $sourcePath = rtrim($sourceUid . '/files/' . $path, '/'); |
|
65 | + /** |
|
66 | + * @param IUser $sourceUser |
|
67 | + * @param IUser $destinationUser |
|
68 | + * @param string $path |
|
69 | + * |
|
70 | + * @throws TransferOwnershipException |
|
71 | + */ |
|
72 | + public function transfer(IUser $sourceUser, |
|
73 | + IUser $destinationUser, |
|
74 | + string $path, |
|
75 | + ?OutputInterface $output = null): void { |
|
76 | + $output = $output ?? new NullOutput(); |
|
77 | + $sourceUid = $sourceUser->getUID(); |
|
78 | + $destinationUid = $destinationUser->getUID(); |
|
79 | + $sourcePath = rtrim($sourceUid . '/files/' . $path, '/'); |
|
80 | 80 | |
81 | - // target user has to be ready |
|
82 | - if (!$this->encryptionManager->isReadyForUser($destinationUid)) { |
|
83 | - throw new TransferOwnershipException("The target user is not ready to accept files. The user has at least to be logged in once.", 2); |
|
84 | - } |
|
81 | + // target user has to be ready |
|
82 | + if (!$this->encryptionManager->isReadyForUser($destinationUid)) { |
|
83 | + throw new TransferOwnershipException("The target user is not ready to accept files. The user has at least to be logged in once.", 2); |
|
84 | + } |
|
85 | 85 | |
86 | - $date = date('Y-m-d H-i-s'); |
|
87 | - $finalTarget = "$destinationUid/files/transferred from $sourceUid on $date"; |
|
86 | + $date = date('Y-m-d H-i-s'); |
|
87 | + $finalTarget = "$destinationUid/files/transferred from $sourceUid on $date"; |
|
88 | 88 | |
89 | - // setup filesystem |
|
90 | - Filesystem::initMountPoints($sourceUid); |
|
91 | - Filesystem::initMountPoints($destinationUid); |
|
89 | + // setup filesystem |
|
90 | + Filesystem::initMountPoints($sourceUid); |
|
91 | + Filesystem::initMountPoints($destinationUid); |
|
92 | 92 | |
93 | - $view = new View(); |
|
94 | - if (!$view->is_dir($sourcePath)) { |
|
95 | - throw new TransferOwnershipException("Unknown path provided: $path", 1); |
|
96 | - } |
|
93 | + $view = new View(); |
|
94 | + if (!$view->is_dir($sourcePath)) { |
|
95 | + throw new TransferOwnershipException("Unknown path provided: $path", 1); |
|
96 | + } |
|
97 | 97 | |
98 | - // analyse source folder |
|
99 | - $this->analyse( |
|
100 | - $sourceUid, |
|
101 | - $destinationUid, |
|
102 | - $sourcePath, |
|
103 | - $view, |
|
104 | - $output |
|
105 | - ); |
|
98 | + // analyse source folder |
|
99 | + $this->analyse( |
|
100 | + $sourceUid, |
|
101 | + $destinationUid, |
|
102 | + $sourcePath, |
|
103 | + $view, |
|
104 | + $output |
|
105 | + ); |
|
106 | 106 | |
107 | - // collect all the shares |
|
108 | - $shares = $this->collectUsersShares( |
|
109 | - $sourceUid, |
|
110 | - $output |
|
111 | - ); |
|
107 | + // collect all the shares |
|
108 | + $shares = $this->collectUsersShares( |
|
109 | + $sourceUid, |
|
110 | + $output |
|
111 | + ); |
|
112 | 112 | |
113 | - // transfer the files |
|
114 | - $this->transferFiles( |
|
115 | - $sourceUid, |
|
116 | - $sourcePath, |
|
117 | - $finalTarget, |
|
118 | - $view, |
|
119 | - $output |
|
120 | - ); |
|
113 | + // transfer the files |
|
114 | + $this->transferFiles( |
|
115 | + $sourceUid, |
|
116 | + $sourcePath, |
|
117 | + $finalTarget, |
|
118 | + $view, |
|
119 | + $output |
|
120 | + ); |
|
121 | 121 | |
122 | - // restore the shares |
|
123 | - $this->restoreShares( |
|
124 | - $sourceUid, |
|
125 | - $destinationUid, |
|
126 | - $shares, |
|
127 | - $output |
|
128 | - ); |
|
129 | - } |
|
122 | + // restore the shares |
|
123 | + $this->restoreShares( |
|
124 | + $sourceUid, |
|
125 | + $destinationUid, |
|
126 | + $shares, |
|
127 | + $output |
|
128 | + ); |
|
129 | + } |
|
130 | 130 | |
131 | - private function walkFiles(View $view, $path, Closure $callBack) { |
|
132 | - foreach ($view->getDirectoryContent($path) as $fileInfo) { |
|
133 | - if (!$callBack($fileInfo)) { |
|
134 | - return; |
|
135 | - } |
|
136 | - if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
|
137 | - $this->walkFiles($view, $fileInfo->getPath(), $callBack); |
|
138 | - } |
|
139 | - } |
|
140 | - } |
|
131 | + private function walkFiles(View $view, $path, Closure $callBack) { |
|
132 | + foreach ($view->getDirectoryContent($path) as $fileInfo) { |
|
133 | + if (!$callBack($fileInfo)) { |
|
134 | + return; |
|
135 | + } |
|
136 | + if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
|
137 | + $this->walkFiles($view, $fileInfo->getPath(), $callBack); |
|
138 | + } |
|
139 | + } |
|
140 | + } |
|
141 | 141 | |
142 | - /** |
|
143 | - * @param OutputInterface $output |
|
144 | - * |
|
145 | - * @throws \Exception |
|
146 | - */ |
|
147 | - protected function analyse(string $sourceUid, |
|
148 | - string $destinationUid, |
|
149 | - string $sourcePath, |
|
150 | - View $view, |
|
151 | - OutputInterface $output): void { |
|
152 | - $output->writeln('Validating quota'); |
|
153 | - $size = $view->getFileInfo($sourcePath, false)->getSize(false); |
|
154 | - $freeSpace = $view->free_space($destinationUid . '/files/'); |
|
155 | - if ($size > $freeSpace) { |
|
156 | - $output->writeln('<error>Target user does not have enough free space available</error>'); |
|
157 | - throw new \Exception('Execution terminated'); |
|
158 | - } |
|
142 | + /** |
|
143 | + * @param OutputInterface $output |
|
144 | + * |
|
145 | + * @throws \Exception |
|
146 | + */ |
|
147 | + protected function analyse(string $sourceUid, |
|
148 | + string $destinationUid, |
|
149 | + string $sourcePath, |
|
150 | + View $view, |
|
151 | + OutputInterface $output): void { |
|
152 | + $output->writeln('Validating quota'); |
|
153 | + $size = $view->getFileInfo($sourcePath, false)->getSize(false); |
|
154 | + $freeSpace = $view->free_space($destinationUid . '/files/'); |
|
155 | + if ($size > $freeSpace) { |
|
156 | + $output->writeln('<error>Target user does not have enough free space available</error>'); |
|
157 | + throw new \Exception('Execution terminated'); |
|
158 | + } |
|
159 | 159 | |
160 | - $output->writeln("Analysing files of $sourceUid ..."); |
|
161 | - $progress = new ProgressBar($output); |
|
162 | - $progress->start(); |
|
160 | + $output->writeln("Analysing files of $sourceUid ..."); |
|
161 | + $progress = new ProgressBar($output); |
|
162 | + $progress->start(); |
|
163 | 163 | |
164 | - $encryptedFiles = []; |
|
165 | - $this->walkFiles($view, $sourcePath, |
|
166 | - function (FileInfo $fileInfo) use ($progress) { |
|
167 | - if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
|
168 | - // only analyze into folders from main storage, |
|
169 | - if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
|
170 | - return false; |
|
171 | - } |
|
172 | - return true; |
|
173 | - } |
|
174 | - $progress->advance(); |
|
175 | - if ($fileInfo->isEncrypted()) { |
|
176 | - $encryptedFiles[] = $fileInfo; |
|
177 | - } |
|
178 | - return true; |
|
179 | - }); |
|
180 | - $progress->finish(); |
|
181 | - $output->writeln(''); |
|
164 | + $encryptedFiles = []; |
|
165 | + $this->walkFiles($view, $sourcePath, |
|
166 | + function (FileInfo $fileInfo) use ($progress) { |
|
167 | + if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
|
168 | + // only analyze into folders from main storage, |
|
169 | + if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
|
170 | + return false; |
|
171 | + } |
|
172 | + return true; |
|
173 | + } |
|
174 | + $progress->advance(); |
|
175 | + if ($fileInfo->isEncrypted()) { |
|
176 | + $encryptedFiles[] = $fileInfo; |
|
177 | + } |
|
178 | + return true; |
|
179 | + }); |
|
180 | + $progress->finish(); |
|
181 | + $output->writeln(''); |
|
182 | 182 | |
183 | - // no file is allowed to be encrypted |
|
184 | - if (!empty($encryptedFiles)) { |
|
185 | - $output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
|
186 | - foreach ($encryptedFiles as $encryptedFile) { |
|
187 | - /** @var FileInfo $encryptedFile */ |
|
188 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
189 | - } |
|
190 | - throw new \Exception('Execution terminated.'); |
|
191 | - } |
|
192 | - } |
|
183 | + // no file is allowed to be encrypted |
|
184 | + if (!empty($encryptedFiles)) { |
|
185 | + $output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
|
186 | + foreach ($encryptedFiles as $encryptedFile) { |
|
187 | + /** @var FileInfo $encryptedFile */ |
|
188 | + $output->writeln(" " . $encryptedFile->getPath()); |
|
189 | + } |
|
190 | + throw new \Exception('Execution terminated.'); |
|
191 | + } |
|
192 | + } |
|
193 | 193 | |
194 | - private function collectUsersShares(string $sourceUid, |
|
195 | - OutputInterface $output): array { |
|
196 | - $output->writeln("Collecting all share information for files and folder of $sourceUid ..."); |
|
194 | + private function collectUsersShares(string $sourceUid, |
|
195 | + OutputInterface $output): array { |
|
196 | + $output->writeln("Collecting all share information for files and folder of $sourceUid ..."); |
|
197 | 197 | |
198 | - $shares = []; |
|
199 | - $progress = new ProgressBar($output); |
|
200 | - foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE, \OCP\Share::SHARE_TYPE_ROOM] as $shareType) { |
|
201 | - $offset = 0; |
|
202 | - while (true) { |
|
203 | - $sharePage = $this->shareManager->getSharesBy($sourceUid, $shareType, null, true, 50, $offset); |
|
204 | - $progress->advance(count($sharePage)); |
|
205 | - if (empty($sharePage)) { |
|
206 | - break; |
|
207 | - } |
|
208 | - $shares = array_merge($shares, $sharePage); |
|
209 | - $offset += 50; |
|
210 | - } |
|
211 | - } |
|
198 | + $shares = []; |
|
199 | + $progress = new ProgressBar($output); |
|
200 | + foreach ([\OCP\Share::SHARE_TYPE_GROUP, \OCP\Share::SHARE_TYPE_USER, \OCP\Share::SHARE_TYPE_LINK, \OCP\Share::SHARE_TYPE_REMOTE, \OCP\Share::SHARE_TYPE_ROOM] as $shareType) { |
|
201 | + $offset = 0; |
|
202 | + while (true) { |
|
203 | + $sharePage = $this->shareManager->getSharesBy($sourceUid, $shareType, null, true, 50, $offset); |
|
204 | + $progress->advance(count($sharePage)); |
|
205 | + if (empty($sharePage)) { |
|
206 | + break; |
|
207 | + } |
|
208 | + $shares = array_merge($shares, $sharePage); |
|
209 | + $offset += 50; |
|
210 | + } |
|
211 | + } |
|
212 | 212 | |
213 | - $progress->finish(); |
|
214 | - $output->writeln(''); |
|
215 | - return $shares; |
|
216 | - } |
|
213 | + $progress->finish(); |
|
214 | + $output->writeln(''); |
|
215 | + return $shares; |
|
216 | + } |
|
217 | 217 | |
218 | - protected function transferFiles(string $sourceUid, |
|
219 | - string $sourcePath, |
|
220 | - string $finalTarget, |
|
221 | - View $view, |
|
222 | - OutputInterface $output): void { |
|
223 | - $output->writeln("Transferring files to $finalTarget ..."); |
|
218 | + protected function transferFiles(string $sourceUid, |
|
219 | + string $sourcePath, |
|
220 | + string $finalTarget, |
|
221 | + View $view, |
|
222 | + OutputInterface $output): void { |
|
223 | + $output->writeln("Transferring files to $finalTarget ..."); |
|
224 | 224 | |
225 | - // This change will help user to transfer the folder specified using --path option. |
|
226 | - // Else only the content inside folder is transferred which is not correct. |
|
227 | - if ($sourcePath !== "$sourceUid/files") { |
|
228 | - $view->mkdir($finalTarget); |
|
229 | - $finalTarget = $finalTarget . '/' . basename($sourcePath); |
|
230 | - } |
|
231 | - $view->rename($sourcePath, $finalTarget); |
|
232 | - if (!is_dir("$sourceUid/files")) { |
|
233 | - // because the files folder is moved away we need to recreate it |
|
234 | - $view->mkdir("$sourceUid/files"); |
|
235 | - } |
|
236 | - } |
|
225 | + // This change will help user to transfer the folder specified using --path option. |
|
226 | + // Else only the content inside folder is transferred which is not correct. |
|
227 | + if ($sourcePath !== "$sourceUid/files") { |
|
228 | + $view->mkdir($finalTarget); |
|
229 | + $finalTarget = $finalTarget . '/' . basename($sourcePath); |
|
230 | + } |
|
231 | + $view->rename($sourcePath, $finalTarget); |
|
232 | + if (!is_dir("$sourceUid/files")) { |
|
233 | + // because the files folder is moved away we need to recreate it |
|
234 | + $view->mkdir("$sourceUid/files"); |
|
235 | + } |
|
236 | + } |
|
237 | 237 | |
238 | - private function restoreShares(string $sourceUid, |
|
239 | - string $destinationUid, |
|
240 | - array $shares, |
|
241 | - OutputInterface $output) { |
|
242 | - $output->writeln("Restoring shares ..."); |
|
243 | - $progress = new ProgressBar($output, count($shares)); |
|
238 | + private function restoreShares(string $sourceUid, |
|
239 | + string $destinationUid, |
|
240 | + array $shares, |
|
241 | + OutputInterface $output) { |
|
242 | + $output->writeln("Restoring shares ..."); |
|
243 | + $progress = new ProgressBar($output, count($shares)); |
|
244 | 244 | |
245 | - foreach ($shares as $share) { |
|
246 | - try { |
|
247 | - if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && |
|
248 | - $share->getSharedWith() === $destinationUid) { |
|
249 | - // Unmount the shares before deleting, so we don't try to get the storage later on. |
|
250 | - $shareMountPoint = $this->mountManager->find('/' . $destinationUid . '/files' . $share->getTarget()); |
|
251 | - if ($shareMountPoint) { |
|
252 | - $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
|
253 | - } |
|
254 | - $this->shareManager->deleteShare($share); |
|
255 | - } else { |
|
256 | - if ($share->getShareOwner() === $sourceUid) { |
|
257 | - $share->setShareOwner($destinationUid); |
|
258 | - } |
|
259 | - if ($share->getSharedBy() === $sourceUid) { |
|
260 | - $share->setSharedBy($destinationUid); |
|
261 | - } |
|
245 | + foreach ($shares as $share) { |
|
246 | + try { |
|
247 | + if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && |
|
248 | + $share->getSharedWith() === $destinationUid) { |
|
249 | + // Unmount the shares before deleting, so we don't try to get the storage later on. |
|
250 | + $shareMountPoint = $this->mountManager->find('/' . $destinationUid . '/files' . $share->getTarget()); |
|
251 | + if ($shareMountPoint) { |
|
252 | + $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
|
253 | + } |
|
254 | + $this->shareManager->deleteShare($share); |
|
255 | + } else { |
|
256 | + if ($share->getShareOwner() === $sourceUid) { |
|
257 | + $share->setShareOwner($destinationUid); |
|
258 | + } |
|
259 | + if ($share->getSharedBy() === $sourceUid) { |
|
260 | + $share->setSharedBy($destinationUid); |
|
261 | + } |
|
262 | 262 | |
263 | - $this->shareManager->updateShare($share); |
|
264 | - } |
|
265 | - } catch (\OCP\Files\NotFoundException $e) { |
|
266 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
267 | - } catch (\Exception $e) { |
|
268 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
269 | - } |
|
270 | - $progress->advance(); |
|
271 | - } |
|
272 | - $progress->finish(); |
|
273 | - $output->writeln(''); |
|
274 | - } |
|
263 | + $this->shareManager->updateShare($share); |
|
264 | + } |
|
265 | + } catch (\OCP\Files\NotFoundException $e) { |
|
266 | + $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
267 | + } catch (\Exception $e) { |
|
268 | + $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
269 | + } |
|
270 | + $progress->advance(); |
|
271 | + } |
|
272 | + $progress->finish(); |
|
273 | + $output->writeln(''); |
|
274 | + } |
|
275 | 275 | |
276 | 276 | } |
@@ -76,7 +76,7 @@ discard block |
||
76 | 76 | $output = $output ?? new NullOutput(); |
77 | 77 | $sourceUid = $sourceUser->getUID(); |
78 | 78 | $destinationUid = $destinationUser->getUID(); |
79 | - $sourcePath = rtrim($sourceUid . '/files/' . $path, '/'); |
|
79 | + $sourcePath = rtrim($sourceUid.'/files/'.$path, '/'); |
|
80 | 80 | |
81 | 81 | // target user has to be ready |
82 | 82 | if (!$this->encryptionManager->isReadyForUser($destinationUid)) { |
@@ -151,7 +151,7 @@ discard block |
||
151 | 151 | OutputInterface $output): void { |
152 | 152 | $output->writeln('Validating quota'); |
153 | 153 | $size = $view->getFileInfo($sourcePath, false)->getSize(false); |
154 | - $freeSpace = $view->free_space($destinationUid . '/files/'); |
|
154 | + $freeSpace = $view->free_space($destinationUid.'/files/'); |
|
155 | 155 | if ($size > $freeSpace) { |
156 | 156 | $output->writeln('<error>Target user does not have enough free space available</error>'); |
157 | 157 | throw new \Exception('Execution terminated'); |
@@ -163,7 +163,7 @@ discard block |
||
163 | 163 | |
164 | 164 | $encryptedFiles = []; |
165 | 165 | $this->walkFiles($view, $sourcePath, |
166 | - function (FileInfo $fileInfo) use ($progress) { |
|
166 | + function(FileInfo $fileInfo) use ($progress) { |
|
167 | 167 | if ($fileInfo->getType() === FileInfo::TYPE_FOLDER) { |
168 | 168 | // only analyze into folders from main storage, |
169 | 169 | if (!$fileInfo->getStorage()->instanceOfStorage(IHomeStorage::class)) { |
@@ -185,7 +185,7 @@ discard block |
||
185 | 185 | $output->writeln("<error>Some files are encrypted - please decrypt them first</error>"); |
186 | 186 | foreach ($encryptedFiles as $encryptedFile) { |
187 | 187 | /** @var FileInfo $encryptedFile */ |
188 | - $output->writeln(" " . $encryptedFile->getPath()); |
|
188 | + $output->writeln(" ".$encryptedFile->getPath()); |
|
189 | 189 | } |
190 | 190 | throw new \Exception('Execution terminated.'); |
191 | 191 | } |
@@ -226,7 +226,7 @@ discard block |
||
226 | 226 | // Else only the content inside folder is transferred which is not correct. |
227 | 227 | if ($sourcePath !== "$sourceUid/files") { |
228 | 228 | $view->mkdir($finalTarget); |
229 | - $finalTarget = $finalTarget . '/' . basename($sourcePath); |
|
229 | + $finalTarget = $finalTarget.'/'.basename($sourcePath); |
|
230 | 230 | } |
231 | 231 | $view->rename($sourcePath, $finalTarget); |
232 | 232 | if (!is_dir("$sourceUid/files")) { |
@@ -247,7 +247,7 @@ discard block |
||
247 | 247 | if ($share->getShareType() === \OCP\Share::SHARE_TYPE_USER && |
248 | 248 | $share->getSharedWith() === $destinationUid) { |
249 | 249 | // Unmount the shares before deleting, so we don't try to get the storage later on. |
250 | - $shareMountPoint = $this->mountManager->find('/' . $destinationUid . '/files' . $share->getTarget()); |
|
250 | + $shareMountPoint = $this->mountManager->find('/'.$destinationUid.'/files'.$share->getTarget()); |
|
251 | 251 | if ($shareMountPoint) { |
252 | 252 | $this->mountManager->removeMount($shareMountPoint->getMountPoint()); |
253 | 253 | } |
@@ -263,9 +263,9 @@ discard block |
||
263 | 263 | $this->shareManager->updateShare($share); |
264 | 264 | } |
265 | 265 | } catch (\OCP\Files\NotFoundException $e) { |
266 | - $output->writeln('<error>Share with id ' . $share->getId() . ' points at deleted file, skipping</error>'); |
|
266 | + $output->writeln('<error>Share with id '.$share->getId().' points at deleted file, skipping</error>'); |
|
267 | 267 | } catch (\Exception $e) { |
268 | - $output->writeln('<error>Could not restore share with id ' . $share->getId() . ':' . $e->getTraceAsString() . '</error>'); |
|
268 | + $output->writeln('<error>Could not restore share with id '.$share->getId().':'.$e->getTraceAsString().'</error>'); |
|
269 | 269 | } |
270 | 270 | $progress->advance(); |
271 | 271 | } |