aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files
diff options
context:
space:
mode:
authorJoas Schilling <nickvergessen@owncloud.com>2016-04-04 09:08:55 +0200
committerJoas Schilling <nickvergessen@owncloud.com>2016-04-04 09:10:43 +0200
commitdd5f38e35196de9971760e7845b7eec740f340fc (patch)
tree565acb067df237ca3408cb99a7dbc2e53d955275 /apps/files
parentd857f7caf2bc6d2528ea1c31cec8a0729776651c (diff)
downloadnextcloud-server-dd5f38e35196de9971760e7845b7eec740f340fc.tar.gz
nextcloud-server-dd5f38e35196de9971760e7845b7eec740f340fc.zip
Inject the Mount Manager
Diffstat (limited to 'apps/files')
-rw-r--r--apps/files/appinfo/register_command.php3
-rw-r--r--apps/files/command/transferownership.php13
2 files changed, 10 insertions, 6 deletions
diff --git a/apps/files/appinfo/register_command.php b/apps/files/appinfo/register_command.php
index e77087a229a..dad78186c62 100644
--- a/apps/files/appinfo/register_command.php
+++ b/apps/files/appinfo/register_command.php
@@ -24,8 +24,9 @@
$dbConnection = \OC::$server->getDatabaseConnection();
$userManager = OC::$server->getUserManager();
$shareManager = \OC::$server->getShareManager();
+$mountManager = \OC::$server->getMountManager();
/** @var Symfony\Component\Console\Application $application */
$application->add(new OCA\Files\Command\Scan($userManager));
$application->add(new OCA\Files\Command\DeleteOrphanedFiles($dbConnection));
-$application->add(new OCA\Files\Command\TransferOwnership($userManager, $shareManager));
+$application->add(new OCA\Files\Command\TransferOwnership($userManager, $shareManager, $mountManager));
diff --git a/apps/files/command/transferownership.php b/apps/files/command/transferownership.php
index 98dbc428220..6bf2fae6bdf 100644
--- a/apps/files/command/transferownership.php
+++ b/apps/files/command/transferownership.php
@@ -24,7 +24,7 @@ namespace OCA\Files\Command;
use OC\Files\Filesystem;
use OC\Files\View;
use OCP\Files\FileInfo;
-use OCP\Files\Folder;
+use OCP\Files\Mount\IMountManager;
use OCP\IUserManager;
use OCP\Share\IManager;
use OCP\Share\IShare;
@@ -42,6 +42,9 @@ class TransferOwnership extends Command {
/** @var IManager */
private $shareManager;
+ /** @var IMountManager */
+ private $mountManager;
+
/** @var FileInfo[] */
private $allFiles = [];
@@ -60,9 +63,10 @@ class TransferOwnership extends Command {
/** @var string */
private $finalTarget;
- public function __construct(IUserManager $userManager, IManager $shareManager) {
+ public function __construct(IUserManager $userManager, IManager $shareManager, IMountManager $mountManager) {
$this->userManager = $userManager;
$this->shareManager = $shareManager;
+ $this->mountManager = $mountManager;
parent::__construct();
}
@@ -203,14 +207,13 @@ class TransferOwnership extends Command {
private function restoreShares(OutputInterface $output) {
$output->writeln("Restoring shares ...");
$progress = new ProgressBar($output, count($this->shares));
- $mountManager = Filesystem::getMountManager($this->destinationUser);
foreach($this->shares as $share) {
if ($share->getSharedWith() === $this->destinationUser) {
// Unmount the shares before deleting, so we don't try to get the storage later on.
- $shareMountPoint = $mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget());
+ $shareMountPoint = $this->mountManager->find('/' . $this->destinationUser . '/files' . $share->getTarget());
if ($shareMountPoint) {
- $mountManager->removeMount($shareMountPoint->getMountPoint());
+ $this->mountManager->removeMount($shareMountPoint->getMountPoint());
}
$this->shareManager->deleteShare($share);
} else {