Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ReportSystemCacheFlushToNewRelic.php
Go to the documentation of this file.
1 <?php
7 
11 
16 {
20  protected $config;
21 
26 
31 
37  public function __construct(
39  \Magento\Backend\Model\Auth\Session $backendAuthSession,
40  \Magento\NewRelicReporting\Model\Apm\DeploymentsFactory $deploymentsFactory
41  ) {
42  $this->config = $config;
43  $this->backendAuthSession = $backendAuthSession;
44  $this->deploymentsFactory = $deploymentsFactory;
45  }
46 
54  public function execute(Observer $observer)
55  {
56  if ($this->config->isNewRelicEnabled()) {
57  $user = $this->backendAuthSession->getUser();
58  if ($user->getId()) {
59  $this->deploymentsFactory->create()->setDeployment(
60  'Cache Flush',
61  $user->getUserName() . ' flushed the cache.',
62  $user->getUserName()
63  );
64  }
65  }
66  }
67 }
$user
Definition: dummy_user.php:13
__construct(Config $config, \Magento\Backend\Model\Auth\Session $backendAuthSession, \Magento\NewRelicReporting\Model\Apm\DeploymentsFactory $deploymentsFactory)