Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
cfde81aa
Unverified
Commit
cfde81aa
authored
Oct 10, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Using new file mover and improving response message in case of some failures
parent
09055ee1
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
2 deletions
+15
-2
MoveMediaController.php
Modules/Media/Http/Controllers/Api/MoveMediaController.php
+15
-2
No files found.
Modules/Media/Http/Controllers/Api/MoveMediaController.php
View file @
cfde81aa
...
...
@@ -7,6 +7,7 @@ use Modules\Media\Entities\File;
use
Modules\Media\Http\Requests\MoveMediaRequest
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Services\FileMover
;
use
Modules\Media\Services\FolderMover
;
class
MoveMediaController
extends
Controller
...
...
@@ -23,12 +24,22 @@ class MoveMediaController extends Controller
* @var FolderMover
*/
private
$folderMover
;
/**
* @var FileMover
*/
private
$fileMover
;
public
function
__construct
(
FileRepository
$file
,
FolderRepository
$folder
,
FolderMover
$folderMover
)
public
function
__construct
(
FileRepository
$file
,
FolderRepository
$folder
,
FolderMover
$folderMover
,
FileMover
$fileMover
)
{
$this
->
file
=
$file
;
$this
->
folder
=
$folder
;
$this
->
folderMover
=
$folderMover
;
$this
->
fileMover
=
$fileMover
;
}
public
function
__invoke
(
MoveMediaRequest
$request
)
...
...
@@ -43,7 +54,9 @@ class MoveMediaController extends Controller
$file
=
$this
->
file
->
find
(
$file
[
'id'
]);
if
(
$file
->
is_folder
===
false
)
{
$this
->
file
->
move
(
$file
,
$destination
);
if
(
$this
->
fileMover
->
move
(
$file
,
$destination
)
===
false
)
{
$failedMoves
++
;
}
}
if
(
$file
->
is_folder
===
true
)
{
if
(
$this
->
folderMover
->
move
(
$file
,
$destination
)
===
false
)
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment