mirror of
https://github.com/espocrm/espocrm.git
synced 2026-06-28 06:56:05 +00:00
log dependency
This commit is contained in:
@@ -551,8 +551,8 @@ class Metadata
|
||||
$rowResult = $this->fileManager->unsetJsonContents($filePath, $unsetData);
|
||||
|
||||
if (!$rowResult) {
|
||||
$GLOBALS['log']->warning(
|
||||
'Metadata items ['.$key1.'.'.$key2.'] can be deleted for custom code only.'
|
||||
throw new Error(
|
||||
"Metadata items {$key1}.{$key2} can be deleted for custom code only."
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -35,6 +35,7 @@ use Espo\Core\{
|
||||
Utils\FieldUtil,
|
||||
ORM\EntityManager,
|
||||
ORM\Entity,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
/**
|
||||
@@ -56,16 +57,20 @@ class Manager
|
||||
|
||||
private $fieldUtil;
|
||||
|
||||
private $log;
|
||||
|
||||
public function __construct(
|
||||
Config $config,
|
||||
DataCache $dataCache,
|
||||
EntityManager $entityManager,
|
||||
FieldUtil $fieldUtil
|
||||
FieldUtil $fieldUtil,
|
||||
Log $log
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->dataCache = $dataCache;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
$this->log = $log;
|
||||
|
||||
$this->loadData();
|
||||
}
|
||||
@@ -154,7 +159,7 @@ class Manager
|
||||
|
||||
protected function logDebugEvent(string $event, Entity $entity): void
|
||||
{
|
||||
$GLOBALS['log']->debug("Webhook: {$event} on record {$entity->id}.");
|
||||
$this->log->debug("Webhook: {$event} on record {$entity->id}.");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -40,6 +40,7 @@ use Espo\Core\{
|
||||
Utils\Config,
|
||||
Utils\DateTime as DateTimeUtil,
|
||||
ORM\EntityManager,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Exception;
|
||||
@@ -69,16 +70,20 @@ class Queue
|
||||
|
||||
private $aclManager;
|
||||
|
||||
private $log;
|
||||
|
||||
public function __construct(
|
||||
Sender $sender,
|
||||
Config $config,
|
||||
EntityManager $entityManager,
|
||||
AclManager $aclManager
|
||||
AclManager $aclManager,
|
||||
Log $log
|
||||
) {
|
||||
$this->sender = $sender;
|
||||
$this->config = $config;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->aclManager = $aclManager;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function process(): void
|
||||
@@ -267,7 +272,7 @@ class Queue
|
||||
catch (Exception $e) {
|
||||
$this->failQueueItemList($itemList, true);
|
||||
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"Webhook Queue: Webhook {$webhook->id} sending failed. Error: " . $e->getMessage()
|
||||
);
|
||||
return;
|
||||
@@ -294,7 +299,7 @@ class Queue
|
||||
|
||||
protected function logSending(Webhook $webhook, int $code)
|
||||
{
|
||||
$GLOBALS['log']->debug("Webhook Queue: Webhook {$webhook->id} sent, response code: {$code}.");
|
||||
$this->log->debug("Webhook Queue: Webhook {$webhook->id} sent, response code: {$code}.");
|
||||
}
|
||||
|
||||
protected function failQueueItemList(array $itemList, bool $force = false)
|
||||
|
||||
@@ -34,41 +34,55 @@ use Espo\ORM\Entity;
|
||||
use Espo\Core\{
|
||||
Utils\Metadata,
|
||||
Formula\Manager as FormulaManager,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Exception;
|
||||
|
||||
class Formula
|
||||
{
|
||||
public static $order = 11;
|
||||
|
||||
protected $metadata;
|
||||
protected $formulaManager;
|
||||
private $metadata;
|
||||
|
||||
public function __construct(Metadata $metadata, FormulaManager $formulaManager)
|
||||
private $formulaManager;
|
||||
|
||||
private $log;
|
||||
|
||||
public function __construct(Metadata $metadata, FormulaManager $formulaManager, Log $log)
|
||||
{
|
||||
$this->metadata = $metadata;
|
||||
$this->formulaManager = $formulaManager;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function beforeSave(Entity $entity, array $options = [])
|
||||
{
|
||||
if (!empty($options['skipFormula'])) return;
|
||||
if (!empty($options['skipFormula'])) {
|
||||
return;
|
||||
}
|
||||
|
||||
$scriptList = $this->metadata->get(['formula', $entity->getEntityType(), 'beforeSaveScriptList'], []);
|
||||
$variables = (object)[];
|
||||
|
||||
$variables = (object) [];
|
||||
|
||||
foreach ($scriptList as $script) {
|
||||
try {
|
||||
$this->formulaManager->run($script, $entity, $variables);
|
||||
} catch (\Exception $e) {
|
||||
$GLOBALS['log']->error('Formula failed: ' . $e->getMessage());
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->log->error('Formula failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
$customScript = $this->metadata->get(['formula', $entity->getEntityType(), 'beforeSaveCustomScript']);
|
||||
|
||||
if ($customScript) {
|
||||
try {
|
||||
$this->formulaManager->run($customScript, $entity, $variables);
|
||||
} catch (\Exception $e) {
|
||||
$GLOBALS['log']->error('Formula failed: ' . $e->getMessage());
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$this->log->error('Formula failed: ' . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,6 +38,7 @@ use Espo\Core\{
|
||||
InjectableFactory,
|
||||
Select\SelectBuilderFactory,
|
||||
ServiceFactory,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Espo\ORM\Entity;
|
||||
@@ -81,6 +82,8 @@ class Cleanup implements Job
|
||||
|
||||
protected $serviceFactory;
|
||||
|
||||
protected $log;
|
||||
|
||||
public function __construct(
|
||||
Config $config,
|
||||
EntityManager $entityManager,
|
||||
@@ -88,7 +91,8 @@ class Cleanup implements Job
|
||||
FileManager $fileManager,
|
||||
InjectableFactory $injectableFactory,
|
||||
SelectBuilderFactory $selectBuilderFactory,
|
||||
ServiceFactory $serviceFactory
|
||||
ServiceFactory $serviceFactory,
|
||||
Log $log
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->entityManager = $entityManager;
|
||||
@@ -97,6 +101,7 @@ class Cleanup implements Job
|
||||
$this->injectableFactory = $injectableFactory;
|
||||
$this->selectBuilderFactory = $selectBuilderFactory;
|
||||
$this->serviceFactory = $serviceFactory;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function run(): void
|
||||
@@ -130,7 +135,7 @@ class Cleanup implements Job
|
||||
$injectableFactory->create($className)->process();
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error("Cleanup: {$name}: " . $e->getMessage());
|
||||
$this->log->error("Cleanup: {$name}: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -589,7 +594,7 @@ class Cleanup implements Job
|
||||
$this->entityManager->getQueryExecutor()->execute($delete);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error("Cleanup: " . $e->getMessage());
|
||||
$this->log->error("Cleanup: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -731,7 +736,7 @@ class Cleanup implements Job
|
||||
$service->cleanup($entity->id);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error("Cleanup job: Cleanup scope {$scope}: " . $e->getMessage());
|
||||
$this->log->error("Cleanup job: Cleanup scope {$scope}: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -32,6 +32,7 @@ namespace Espo\Modules\Crm\Jobs;
|
||||
use Espo\Core\{
|
||||
ORM\EntityManager,
|
||||
Job\Job,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Espo\{
|
||||
@@ -49,11 +50,14 @@ class ProcessMassEmail implements Job
|
||||
|
||||
private $entityManager;
|
||||
|
||||
public function __construct(Processor $processor, Queue $queue, EntityManager $entityManager)
|
||||
private $log;
|
||||
|
||||
public function __construct(Processor $processor, Queue $queue, EntityManager $entityManager, Log $log)
|
||||
{
|
||||
$this->processor = $processor;
|
||||
$this->queue = $queue;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function run() : void
|
||||
@@ -71,7 +75,7 @@ class ProcessMassEmail implements Job
|
||||
$this->queue->create($massEmail);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'Job ProcessMassEmail#createQueue ' . $massEmail->id . ': [' . $e->getCode() . '] ' .
|
||||
$e->getMessage()
|
||||
);
|
||||
@@ -90,7 +94,7 @@ class ProcessMassEmail implements Job
|
||||
$this->processor->process($massEmail);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'Job ProcessMassEmail#processSending '. $massEmail->id . ': [' . $e->getCode() . '] ' .
|
||||
$e->getMessage()
|
||||
);
|
||||
|
||||
@@ -34,6 +34,7 @@ use Espo\Core\{
|
||||
ORM\EntityManager,
|
||||
Utils\Config,
|
||||
Job\Job,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Espo\Modules\Crm\Business\Reminder\EmailReminder;
|
||||
@@ -52,11 +53,18 @@ class SendEmailReminders implements Job
|
||||
|
||||
private $config;
|
||||
|
||||
public function __construct(InjectableFactory $injectableFactory, EntityManager $entityManager, Config $config)
|
||||
{
|
||||
private $log;
|
||||
|
||||
public function __construct(
|
||||
InjectableFactory $injectableFactory,
|
||||
EntityManager $entityManager,
|
||||
Config $config,
|
||||
Log $log
|
||||
) {
|
||||
$this->injectableFactory = $injectableFactory;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->config = $config;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function run() : void
|
||||
@@ -90,7 +98,7 @@ class SendEmailReminders implements Job
|
||||
$emailReminder->send($entity);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"Email reminder '{$entity->id}': " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ use Espo\Core\{
|
||||
Utils\Config,
|
||||
WebSocket\Submission as WebSocketSubmission,
|
||||
Job\Job,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Throwable;
|
||||
@@ -49,11 +50,18 @@ class SubmitPopupReminders implements Job
|
||||
|
||||
private $webSocketSubmission;
|
||||
|
||||
public function __construct(EntityManager $entityManager, Config $config, WebSocketSubmission $webSocketSubmission)
|
||||
{
|
||||
private $log;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
Config $config,
|
||||
WebSocketSubmission $webSocketSubmission,
|
||||
Log $log
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->config = $config;
|
||||
$this->webSocketSubmission = $webSocketSubmission;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function run() : void
|
||||
@@ -146,7 +154,7 @@ class SubmitPopupReminders implements Job
|
||||
'list' => $list
|
||||
]);
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error('Job SubmitPopupReminders: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
$this->log->error('Job SubmitPopupReminders: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ use Espo\Core\{
|
||||
Mail\EmailSender,
|
||||
Mail\Sender,
|
||||
Mail\Mail\Header\XQueueItemId,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Espo\{
|
||||
@@ -74,18 +75,22 @@ class Processor
|
||||
|
||||
private $emailTemplateService = null;
|
||||
|
||||
protected $log;
|
||||
|
||||
public function __construct(
|
||||
Config $config,
|
||||
ServiceFactory $serviceFactory,
|
||||
EntityManager $entityManager,
|
||||
Language $defaultLanguage,
|
||||
EmailSender $emailSender
|
||||
EmailSender $emailSender,
|
||||
Log $log
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->serviceFactory = $serviceFactory;
|
||||
$this->entityManager = $entityManager;
|
||||
$this->defaultLanguage = $defaultLanguage;
|
||||
$this->emailSender = $emailSender;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function process(Entity $massEmail, bool $isTest = false) : void
|
||||
@@ -484,7 +489,7 @@ class Processor
|
||||
|
||||
$this->entityManager->saveEntity($queueItem);
|
||||
|
||||
$GLOBALS['log']->error('MassEmail#sendQueueItem: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
$this->log->error('MassEmail#sendQueueItem: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -40,6 +40,7 @@ use Espo\Core\{
|
||||
Utils\Config,
|
||||
Utils\Language,
|
||||
Utils\FieldUtil,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Espo\Entities\User;
|
||||
@@ -80,6 +81,8 @@ class App
|
||||
|
||||
protected $fieldUtil;
|
||||
|
||||
protected $log;
|
||||
|
||||
public function __construct(
|
||||
Config $config,
|
||||
EntityManager $entityManager,
|
||||
@@ -92,7 +95,8 @@ class App
|
||||
ServiceFactory $serviceFactory,
|
||||
User $user,
|
||||
Preferences $preferences,
|
||||
FieldUtil $fieldUtil
|
||||
FieldUtil $fieldUtil,
|
||||
Log $log
|
||||
) {
|
||||
$this->config = $config;
|
||||
$this->entityManager = $entityManager;
|
||||
@@ -106,6 +110,7 @@ class App
|
||||
$this->user = $user;
|
||||
$this->preferences = $preferences;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function getUserData(): array
|
||||
@@ -169,7 +174,7 @@ class App
|
||||
$itemParams = $this->injectableFactory->create($className)->get();
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error("appParam {$paramKey}: " . $e->getMessage());
|
||||
$this->log->error("appParam {$paramKey}: " . $e->getMessage());
|
||||
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -289,7 +289,7 @@ class Email extends Record implements
|
||||
|
||||
$this->getEntityManager()->saveEntity($entity, ['silent' => true]);
|
||||
|
||||
$GLOBALS['log']->error("Email sending:" . $e->getMessage() . "; " . $e->getCode());
|
||||
$this->log->error("Email sending:" . $e->getMessage() . "; " . $e->getCode());
|
||||
|
||||
$errorData = [
|
||||
'id' => $entity->id,
|
||||
@@ -311,7 +311,7 @@ class Email extends Record implements
|
||||
$inboundEmailService->storeSentMessage($inboundEmail, $message);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"Email sending: Could not store sent email (Group Email Account {$inboundEmail->id}): " .
|
||||
$e->getMessage() . "."
|
||||
);
|
||||
@@ -326,7 +326,7 @@ class Email extends Record implements
|
||||
$emailAccountService->storeSentMessage($emailAccount, $message);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"Email sending: Could not store sent email (Email Account {$emailAccount->id}): " .
|
||||
$e->getMessage() . "."
|
||||
);
|
||||
@@ -354,7 +354,7 @@ class Email extends Record implements
|
||||
$handler = $this->getInjection('injectableFactory')->create($handlerClassName);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"Email sending: Could not create Smtp Handler for {$emailAddress}. Error: " .
|
||||
$e->getMessage() . "."
|
||||
);
|
||||
@@ -852,7 +852,7 @@ class Email extends Record implements
|
||||
->send($email);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->warning("Email sending:" . $e->getMessage() . "; " . $e->getCode());
|
||||
$this->log->warning("Email sending:" . $e->getMessage() . "; " . $e->getCode());
|
||||
|
||||
$errorData = [
|
||||
'message' => $e->getMessage(),
|
||||
|
||||
@@ -173,7 +173,7 @@ class EmailAccount extends Record implements
|
||||
try {
|
||||
$handler = $this->injectableFactory->create($handlerClassName);
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"EmailAccount: Could not create Imap Handler. Error: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
@@ -199,7 +199,7 @@ class EmailAccount extends Record implements
|
||||
try {
|
||||
$handler = $this->injectableFactory->create($handlerClassName);
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"EmailAccount: Could not create Imap Handler for {$emailAddress}. Error: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
@@ -376,7 +376,7 @@ class EmailAccount extends Record implements
|
||||
$storage->selectFolder($folder);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'EmailAccount '.$emailAccount->id.' (Select Folder) [' . $e->getCode() . '] ' .$e->getMessage()
|
||||
);
|
||||
continue;
|
||||
@@ -484,7 +484,7 @@ class EmailAccount extends Record implements
|
||||
}
|
||||
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'EmailAccount '.$emailAccount->id.
|
||||
' (Get Message): [' . $e->getCode() . '] ' .$e->getMessage()
|
||||
);
|
||||
@@ -577,7 +577,7 @@ class EmailAccount extends Record implements
|
||||
$message, $userId, $teamIdList, $userIdList, $filterCollection, $fetchOnlyHeader, $folderData
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'EmailAccount '.$emailAccount->id.' (Import Message): [' . $e->getCode() . '] ' .
|
||||
$e->getMessage()
|
||||
);
|
||||
@@ -656,7 +656,7 @@ class EmailAccount extends Record implements
|
||||
$handler = $this->injectableFactory->create($handlerClassName);
|
||||
}
|
||||
catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"EmailAccount: Could not create Smtp Handler for account {$emailAccount->id}. Error: " .
|
||||
$e->getMessage()
|
||||
);
|
||||
|
||||
@@ -259,7 +259,7 @@ class InboundEmail extends RecordService implements
|
||||
try {
|
||||
$storage->selectFolder($folder);
|
||||
} catch (Exception $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'InboundEmail '.$emailAccount->id.' (Select Folder) [' . $e->getCode() . '] ' .$e->getMessage()
|
||||
);
|
||||
|
||||
@@ -346,7 +346,7 @@ class InboundEmail extends RecordService implements
|
||||
try {
|
||||
$toSkip = $this->processBouncedMessage($message) || $toSkip;
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'InboundEmail ' . $emailAccount->id .
|
||||
' (Process Bounced Message: [' . $e->getCode() . '] ' .$e->getMessage()
|
||||
);
|
||||
@@ -379,7 +379,7 @@ class InboundEmail extends RecordService implements
|
||||
}
|
||||
}
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'InboundEmail '.$emailAccount->id.
|
||||
' (Get Message): [' . $e->getCode() . '] ' .$e->getMessage()
|
||||
);
|
||||
@@ -413,7 +413,7 @@ class InboundEmail extends RecordService implements
|
||||
}
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'InboundEmail '.$emailAccount->id.' (Post Import Logic): [' . $e->getCode() . '] ' .$e->getMessage()
|
||||
);
|
||||
}
|
||||
@@ -501,7 +501,7 @@ class InboundEmail extends RecordService implements
|
||||
$message, $userId, $teamIdList, $userIdList, $filterCollection, $fetchOnlyHeader, $folderData
|
||||
);
|
||||
} catch (Exception $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
'InboundEmail '.$emailAccount->id.' (Import Message): [' . $e->getCode() . '] ' .
|
||||
$e->getMessage()
|
||||
);
|
||||
@@ -926,7 +926,7 @@ class InboundEmail extends RecordService implements
|
||||
return true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$GLOBALS['log']->error("Inbound Email: Auto-reply error: " . $e->getMessage());
|
||||
$this->log->error("Inbound Email: Auto-reply error: " . $e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1121,7 +1121,7 @@ class InboundEmail extends RecordService implements
|
||||
try {
|
||||
$handler = $this->injectableFactory->create($handlerClassName);
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"InboundEmail: Could not create Imap Handler. Error: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
@@ -1209,7 +1209,7 @@ class InboundEmail extends RecordService implements
|
||||
try {
|
||||
$handler = $this->injectableFactory->create($handlerClassName);
|
||||
} catch (Throwable $e) {
|
||||
$GLOBALS['log']->error(
|
||||
$this->log->error(
|
||||
"InboundEmail: Could not create Smtp Handler for account {$emailAccount->id}. Error: " . $e->getMessage()
|
||||
);
|
||||
}
|
||||
|
||||
@@ -95,6 +95,7 @@ class Record implements Crud,
|
||||
Di\FieldValidationManagerAware,
|
||||
Di\RecordServiceContainerAware,
|
||||
Di\SelectBuilderFactoryAware,
|
||||
Di\LogAware,
|
||||
|
||||
/** for backward compatibility, to be removed */
|
||||
\Espo\Core\Interfaces\Injectable
|
||||
@@ -113,6 +114,7 @@ class Record implements Crud,
|
||||
use Di\FieldValidationManagerSetter;
|
||||
use Di\RecordServiceContainerSetter;
|
||||
use Di\SelectBuilderFactorySetter;
|
||||
use Di\LogSetter;
|
||||
|
||||
/** for backward compatibility, to be removed */
|
||||
use \Espo\Core\Traits\Injectable;
|
||||
|
||||
@@ -44,6 +44,7 @@ use Espo\Core\{
|
||||
Utils\TemplateFileManager,
|
||||
Mail\EmailSender as EmailSender,
|
||||
Utils\Util,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Exception;
|
||||
@@ -69,6 +70,8 @@ class AssignmentProcessor
|
||||
|
||||
protected $metadata;
|
||||
|
||||
protected $log;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
HtmlizerFactory $htmlizerFactory,
|
||||
@@ -76,7 +79,8 @@ class AssignmentProcessor
|
||||
Config $config,
|
||||
TemplateFileManager $templateFileManager,
|
||||
Metadata $metadata,
|
||||
Language $language
|
||||
Language $language,
|
||||
Log $log
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->htmlizerFactory = $htmlizerFactory;
|
||||
@@ -85,6 +89,7 @@ class AssignmentProcessor
|
||||
$this->templateFileManager = $templateFileManager;
|
||||
$this->metadata = $metadata;
|
||||
$this->language = $language;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function process(StdClass $data): void
|
||||
@@ -205,7 +210,7 @@ class AssignmentProcessor
|
||||
$this->emailSender->send($email);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
$this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -47,6 +47,7 @@ use Espo\Core\{
|
||||
Utils\TemplateFileManager,
|
||||
Mail\EmailSender as EmailSender,
|
||||
Utils\Util,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Michelf\Markdown;
|
||||
@@ -79,6 +80,8 @@ class Processor
|
||||
|
||||
protected $metadata;
|
||||
|
||||
protected $log;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
HtmlizerFactory $htmlizerFactory,
|
||||
@@ -88,7 +91,8 @@ class Processor
|
||||
InjectableFactory $injectableFactory,
|
||||
TemplateFileManager $templateFileManager,
|
||||
Metadata $metadata,
|
||||
Language $language
|
||||
Language $language,
|
||||
Log $log
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->htmlizerFactory = $htmlizerFactory;
|
||||
@@ -99,6 +103,7 @@ class Processor
|
||||
$this->templateFileManager = $templateFileManager;
|
||||
$this->metadata = $metadata;
|
||||
$this->language = $language;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
protected $emailNotificationEntityHandlerHash = [];
|
||||
@@ -351,7 +356,7 @@ class Processor
|
||||
$this->emailSender->send($email);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
$this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -553,7 +558,7 @@ class Processor
|
||||
$sender->send($email);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
$this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -679,7 +684,7 @@ class Processor
|
||||
$this->emailSender->send($email);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
$this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -805,7 +810,7 @@ class Processor
|
||||
$this->emailSender->send($email);
|
||||
}
|
||||
catch (Exception $e) {
|
||||
$GLOBALS['log']->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
$this->log->error('EmailNotification: [' . $e->getCode() . '] ' .$e->getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -39,6 +39,7 @@ use Espo\Core\{
|
||||
FileStorage\Manager as FileStorageManager,
|
||||
Record\ServiceContainer as RecordServiceContainer,
|
||||
Utils\DateTime as DateTimeUtil,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Espo\{
|
||||
@@ -75,6 +76,8 @@ class Import
|
||||
|
||||
protected $fileStorageManager;
|
||||
|
||||
protected $log;
|
||||
|
||||
public function __construct(
|
||||
AclManager $aclManager,
|
||||
EntityManager $entityManager,
|
||||
@@ -82,7 +85,8 @@ class Import
|
||||
Config $config,
|
||||
User $user,
|
||||
FileStorageManager $fileStorageManager,
|
||||
RecordServiceContainer $recordServiceContainer
|
||||
RecordServiceContainer $recordServiceContainer,
|
||||
Log $log
|
||||
) {
|
||||
$this->aclManager = $aclManager;
|
||||
$this->entityManager = $entityManager;
|
||||
@@ -91,6 +95,7 @@ class Import
|
||||
$this->user = $user;
|
||||
$this->fileStorageManager = $fileStorageManager;
|
||||
$this->recordServiceContainer = $recordServiceContainer;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -369,7 +374,7 @@ class Import
|
||||
]);
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$GLOBALS['log']->error('Import Error: '. $e->getMessage());
|
||||
$this->log->error('Import Error: '. $e->getMessage());
|
||||
|
||||
$import->set('status', 'Failed');
|
||||
}
|
||||
@@ -556,7 +561,7 @@ class Import
|
||||
$result['isUpdated'] = true;
|
||||
}
|
||||
} catch (Exception $e) {
|
||||
$GLOBALS['log']->error("Import: " . $e->getMessage());
|
||||
$this->log->error("Import: " . $e->getMessage());
|
||||
}
|
||||
|
||||
return (object) $result;
|
||||
|
||||
@@ -41,6 +41,7 @@ use Espo\Core\{
|
||||
Utils\Config,
|
||||
Utils\DateTime as DateTimeUtil,
|
||||
ServiceFactory,
|
||||
Utils\Log,
|
||||
};
|
||||
|
||||
use Espo\{
|
||||
@@ -70,6 +71,8 @@ class LeadCapture
|
||||
|
||||
protected $dateTime;
|
||||
|
||||
protected $log;
|
||||
|
||||
public function __construct(
|
||||
EntityManager $entityManager,
|
||||
FieldUtil $fieldUtil,
|
||||
@@ -78,7 +81,8 @@ class LeadCapture
|
||||
HookManager $hookManager,
|
||||
EmailSender $emailSender,
|
||||
Config $config,
|
||||
DateTimeUtil $dateTime
|
||||
DateTimeUtil $dateTime,
|
||||
Log $log
|
||||
) {
|
||||
$this->entityManager = $entityManager;
|
||||
$this->fieldUtil = $fieldUtil;
|
||||
@@ -88,6 +92,7 @@ class LeadCapture
|
||||
$this->emailSender = $emailSender;
|
||||
$this->config = $config;
|
||||
$this->dateTime = $dateTime;
|
||||
$this->log = $log;
|
||||
}
|
||||
|
||||
public function capture(string $apiKey, StdClass $data)
|
||||
@@ -143,7 +148,7 @@ class LeadCapture
|
||||
$isAlreadyOptedIn = $this->isTargetOptedIn($target, $leadCapture->get('targetListId'));
|
||||
|
||||
if ($isAlreadyOptedIn) {
|
||||
$GLOBALS['log']->debug("LeadCapture: Already opted in. Skipped.");
|
||||
$this->log->debug("LeadCapture: Already opted in. Skipped.");
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user