Moved attachment path conversion functions to own service.

This commit is contained in:
Jan Böhmer 2019-09-28 16:06:37 +02:00
parent ac238c65a0
commit da46257757
8 changed files with 513 additions and 88 deletions

View file

@ -4,6 +4,7 @@ namespace App\Command;
use App\Services\AttachmentHelper;
use App\Services\AttachmentReverseSearch;
use App\Services\Attachments\AttachmentPathResolver;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Helper\Table;
use Symfony\Component\Console\Input\InputArgument;
@ -24,10 +25,12 @@ class CleanAttachmentsCommand extends Command
protected $attachment_helper;
protected $reverseSearch;
protected $mimeTypeGuesser;
protected $pathResolver;
public function __construct(AttachmentHelper $attachmentHelper, AttachmentReverseSearch $reverseSearch)
public function __construct(AttachmentHelper $attachmentHelper, AttachmentReverseSearch $reverseSearch, AttachmentPathResolver $pathResolver)
{
$this->attachment_helper = $attachmentHelper;
$this->pathResolver = $pathResolver;
$this->reverseSearch = $reverseSearch;
$this->mimeTypeGuesser = new MimeTypes();
parent::__construct();
@ -45,7 +48,7 @@ class CleanAttachmentsCommand extends Command
{
$io = new SymfonyStyle($input, $output);
$mediaPath = $this->attachment_helper->getMediaPath();
$mediaPath = $this->pathResolver->getMediaPath();
$io->note("The media path is " . $mediaPath);
$finder = new Finder();