email import: get rid of file manager

This commit is contained in:
yuri
2016-08-01 10:16:09 +03:00
parent 6cf66aa88e
commit 4859f54f42
3 changed files with 4 additions and 27 deletions
+2 -13
View File
@@ -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;
+1 -7
View File
@@ -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');
+1 -7
View File
@@ -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');