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
bc7a09b6
Unverified
Commit
bc7a09b6
authored
Oct 10, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moving the file and folder movers inside their own namespace
parent
6bc55223
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
11 additions
and
12 deletions
+11
-12
MoveMediaController.php
Modules/Media/Http/Controllers/Api/MoveMediaController.php
+3
-3
FileMover.php
Modules/Media/Services/Movers/FileMover.php
+2
-3
FolderMover.php
Modules/Media/Services/Movers/FolderMover.php
+2
-2
MoverInterface.php
Modules/Media/Services/Movers/MoverInterface.php
+2
-2
FileMoverTest.php
Modules/Media/Tests/FileMoverTest.php
+1
-1
FolderMoverTest.php
Modules/Media/Tests/FolderMoverTest.php
+1
-1
No files found.
Modules/Media/Http/Controllers/Api/MoveMediaController.php
View file @
bc7a09b6
...
@@ -7,8 +7,8 @@ use Modules\Media\Entities\File;
...
@@ -7,8 +7,8 @@ use Modules\Media\Entities\File;
use
Modules\Media\Http\Requests\MoveMediaRequest
;
use
Modules\Media\Http\Requests\MoveMediaRequest
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Services\FileMover
;
use
Modules\Media\Services\
Movers\
FileMover
;
use
Modules\Media\Services\FolderMover
;
use
Modules\Media\Services\
Movers\
FolderMover
;
class
MoveMediaController
extends
Controller
class
MoveMediaController
extends
Controller
{
{
...
@@ -49,7 +49,7 @@ class MoveMediaController extends Controller
...
@@ -49,7 +49,7 @@ class MoveMediaController extends Controller
$failedMoves
=
0
;
$failedMoves
=
0
;
foreach
(
$request
->
get
(
'files'
)
as
$file
)
{
foreach
(
$request
->
get
(
'files'
)
as
$file
)
{
$file
=
$this
->
file
->
find
(
$file
[
'id'
]);
$file
=
$this
->
file
->
find
(
$file
[
'id'
]);
// $this->>mover->move($file, $destination)
if
(
$file
->
is_folder
===
false
)
{
if
(
$file
->
is_folder
===
false
)
{
if
(
$this
->
fileMover
->
move
(
$file
,
$destination
)
===
false
)
{
if
(
$this
->
fileMover
->
move
(
$file
,
$destination
)
===
false
)
{
$failedMoves
++
;
$failedMoves
++
;
...
...
Modules/Media/Services/FileMover.php
→
Modules/Media/Services/
Movers/
FileMover.php
View file @
bc7a09b6
<?php
<?php
namespace
Modules\Media\Services
;
namespace
Modules\Media\Services
\Movers
;
use
Illuminate\Contracts\Filesystem\Factory
;
use
Illuminate\Contracts\Filesystem\Factory
;
use
League\Flysystem\FileExistsException
;
use
League\Flysystem\FileExistsException
;
...
@@ -9,9 +9,8 @@ use Modules\Media\Image\Thumbnail;
...
@@ -9,9 +9,8 @@ use Modules\Media\Image\Thumbnail;
use
Modules\Media\Image\ThumbnailManager
;
use
Modules\Media\Image\ThumbnailManager
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\ValueObjects\MediaPath
;
class
FileMover
implements
Mover
final
class
FileMover
implements
MoverInterface
{
{
/**
/**
* All the different images types where thumbnails should be created
* All the different images types where thumbnails should be created
...
...
Modules/Media/Services/FolderMover.php
→
Modules/Media/Services/
Movers/
FolderMover.php
View file @
bc7a09b6
<?php
<?php
namespace
Modules\Media\Services
;
namespace
Modules\Media\Services
\Movers
;
use
Illuminate\Contracts\Filesystem\Factory
;
use
Illuminate\Contracts\Filesystem\Factory
;
use
League\Flysystem\FileExistsException
;
use
League\Flysystem\FileExistsException
;
...
@@ -8,7 +8,7 @@ use Modules\Media\Entities\File;
...
@@ -8,7 +8,7 @@ use Modules\Media\Entities\File;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Repositories\FolderRepository
;
final
class
FolderMover
implements
Mover
final
class
FolderMover
implements
Mover
Interface
{
{
/**
/**
* @var Factory
* @var Factory
...
...
Modules/Media/Services/Mover.php
→
Modules/Media/Services/Mover
s/MoverInterface
.php
View file @
bc7a09b6
<?php
<?php
namespace
Modules\Media\Services
;
namespace
Modules\Media\Services
\Movers
;
use
Modules\Media\Entities\File
;
use
Modules\Media\Entities\File
;
interface
Mover
interface
Mover
Interface
{
{
public
function
move
(
File
$file
,
File
$destination
)
:
bool
;
public
function
move
(
File
$file
,
File
$destination
)
:
bool
;
}
}
Modules/Media/Tests/FileMoverTest.php
View file @
bc7a09b6
...
@@ -5,7 +5,7 @@ namespace Modules\Media\Tests;
...
@@ -5,7 +5,7 @@ namespace Modules\Media\Tests;
use
Modules\Media\Entities\File
;
use
Modules\Media\Entities\File
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FileRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Services\FileMover
;
use
Modules\Media\Services\
Movers\
FileMover
;
use
Modules\Media\Services\FileService
;
use
Modules\Media\Services\FileService
;
final
class
FileMoverTest
extends
MediaTestCase
final
class
FileMoverTest
extends
MediaTestCase
...
...
Modules/Media/Tests/FolderMoverTest.php
View file @
bc7a09b6
...
@@ -5,7 +5,7 @@ namespace Modules\Media\Tests;
...
@@ -5,7 +5,7 @@ namespace Modules\Media\Tests;
use
Modules\Media\Entities\File
;
use
Modules\Media\Entities\File
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Repositories\FolderRepository
;
use
Modules\Media\Services\FileService
;
use
Modules\Media\Services\FileService
;
use
Modules\Media\Services\FolderMover
;
use
Modules\Media\Services\
Movers\
FolderMover
;
final
class
FolderMoverTest
extends
MediaTestCase
final
class
FolderMoverTest
extends
MediaTestCase
{
{
...
...
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