Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/apps
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2019-11-13 21:56:29 +0300
committerGitHub <noreply@github.com>2019-11-13 21:56:29 +0300
commitbfda90d9d4b7a7eb07312e01c52cda882fa31ab5 (patch)
treecb5372f356b1bcd4981ecc10b0ea4ad2b8b195cc /apps
parent4ef8ff56600bfb6543567902c12a8281c20da4ee (diff)
parent5c94ae2c2589170208f75c24a0b8a70963174226 (diff)
Merge pull request #17927 from nextcloud/backport/17924/stable16
[stable16] Check quota before transfer ownership
Diffstat (limited to 'apps')
-rw-r--r--apps/files/lib/Command/TransferOwnership.php16
1 files changed, 14 insertions, 2 deletions
diff --git a/apps/files/lib/Command/TransferOwnership.php b/apps/files/lib/Command/TransferOwnership.php
index f417898f217..a77a02a4947 100644
--- a/apps/files/lib/Command/TransferOwnership.php
+++ b/apps/files/lib/Command/TransferOwnership.php
@@ -32,6 +32,7 @@ use OC\Files\Filesystem;
use OC\Files\View;
use OCP\Files\FileInfo;
use OCP\Files\IHomeStorage;
+use OCP\Files\IRootFolder;
use OCP\Files\Mount\IMountManager;
use OCP\IUser;
use OCP\IUserManager;
@@ -76,7 +77,10 @@ class TransferOwnership extends Command {
/** @var string */
private $finalTarget;
- public function __construct(IUserManager $userManager, IManager $shareManager, IMountManager $mountManager) {
+ public function __construct(IUserManager $userManager,
+ IManager $shareManager,
+ IMountManager $mountManager,
+ IRootFolder $rootFolder) {
$this->userManager = $userManager;
$this->shareManager = $shareManager;
$this->mountManager = $mountManager;
@@ -174,6 +178,15 @@ class TransferOwnership extends Command {
*/
protected function analyse(OutputInterface $output) {
$view = new View();
+
+ $output->writeln('Validating quota');
+ $size = $view->getFileInfo($this->sourcePath, false)->getSize(false);
+ $freeSpace = $view->free_space($this->destinationUser . '/files/');
+ if ($size > $freeSpace) {
+ $output->writeln('<error>Target user does not have enough free space available</error>');
+ throw new \Exception('Execution terminated');
+ }
+
$output->writeln("Analysing files of $this->sourceUser ...");
$progress = new ProgressBar($output);
$progress->start();
@@ -207,7 +220,6 @@ class TransferOwnership extends Command {
}
throw new \Exception('Execution terminated.');
}
-
}
/**