email import: get rid of file manager
This commit is contained in:
@@ -38,16 +38,13 @@ class Importer
|
||||
{
|
||||
private $entityManager;
|
||||
|
||||
private $fileManager;
|
||||
|
||||
private $config;
|
||||
|
||||
private $filtersMatcher;
|
||||
|
||||
public function __construct($entityManager, $fileManager, $config)
|
||||
public function __construct($entityManager, $config)
|
||||
{
|
||||
$this->entityManager = $entityManager;
|
||||
$this->fileManager = $fileManager;
|
||||
$this->config = $config;
|
||||
$this->filtersMatcher = new FiltersMatcher();
|
||||
}
|
||||
@@ -62,11 +59,6 @@ class Importer
|
||||
return $this->config;
|
||||
}
|
||||
|
||||
protected function getFileManager()
|
||||
{
|
||||
return $this->fileManager;
|
||||
}
|
||||
|
||||
protected function getFiltersMatcher()
|
||||
{
|
||||
return $this->filtersMatcher;
|
||||
@@ -475,13 +467,10 @@ class Importer
|
||||
$content = base64_decode($content);
|
||||
}
|
||||
|
||||
$attachment->set('size', strlen($content));
|
||||
$attachment->set('contents', $content);
|
||||
|
||||
$this->getEntityManager()->saveEntity($attachment);
|
||||
|
||||
$path = $this->getEntityManager()->getRepository('Attachment')->getFilePath($attachment);
|
||||
$this->getFileManager()->putContents($path, $content);
|
||||
|
||||
if ($disposition == 'attachment') {
|
||||
$attachmentsIds = $email->get('attachmentsIds');
|
||||
$attachmentsIds[] = $attachment->id;
|
||||
|
||||
@@ -45,15 +45,9 @@ class EmailAccount extends Record
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->dependencies[] = 'fileManager';
|
||||
$this->dependencies[] = 'crypt';
|
||||
}
|
||||
|
||||
protected function getFileManager()
|
||||
{
|
||||
return $this->injections['fileManager'];
|
||||
}
|
||||
|
||||
protected function getCrypt()
|
||||
{
|
||||
return $this->injections['crypt'];
|
||||
@@ -181,7 +175,7 @@ class EmailAccount extends Record
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
$importer = new \Espo\Core\Mail\Importer($this->getEntityManager(), $this->getFileManager(), $this->getConfig());
|
||||
$importer = new \Espo\Core\Mail\Importer($this->getEntityManager(), $this->getConfig());
|
||||
|
||||
$maxSize = $this->getConfig()->get('emailMessageMaxSize');
|
||||
|
||||
|
||||
@@ -70,16 +70,10 @@ class InboundEmail extends \Espo\Services\Record
|
||||
|
||||
protected function init()
|
||||
{
|
||||
$this->dependencies[] = 'fileManager';
|
||||
$this->dependencies[] = 'mailSender';
|
||||
$this->dependencies[] = 'crypt';
|
||||
}
|
||||
|
||||
protected function getFileManager()
|
||||
{
|
||||
return $this->injections['fileManager'];
|
||||
}
|
||||
|
||||
protected function getMailSender()
|
||||
{
|
||||
return $this->injections['mailSender'];
|
||||
@@ -158,7 +152,7 @@ class InboundEmail extends \Espo\Services\Record
|
||||
throw new Error();
|
||||
}
|
||||
|
||||
$importer = new \Espo\Core\Mail\Importer($this->getEntityManager(), $this->getFileManager(), $this->getConfig());
|
||||
$importer = new \Espo\Core\Mail\Importer($this->getEntityManager(), $this->getConfig());
|
||||
|
||||
$maxSize = $this->getConfig()->get('emailMessageMaxSize');
|
||||
|
||||
|
||||
Reference in New Issue
Block a user