Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Nextcloud
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TeDomum
Nextcloud
Commits
fc4c1077
Unverified
Commit
fc4c1077
authored
5 years ago
by
Roeland Jago Douma
Browse files
Options
Downloads
Patches
Plain Diff
Check quota before transfer ownership
Fixes #15664 Signed-off-by:
Roeland Jago Douma
<
roeland@famdouma.nl
>
parent
eee21c89
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/files/lib/Command/TransferOwnership.php
+14
-2
14 additions, 2 deletions
apps/files/lib/Command/TransferOwnership.php
with
14 additions
and
2 deletions
apps/files/lib/Command/TransferOwnership.php
+
14
−
2
View file @
fc4c1077
...
...
@@ -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.'
);
}
}
/**
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment