Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
RefreshLifetime.php
Go to the documentation of this file.
1 <?php
8 
10 {
16  public function execute()
17  {
18  try {
19  $collectionsNames = $this->_getCollectionNames();
20  foreach ($collectionsNames as $collectionName) {
21  $this->_objectManager->create($collectionName)->aggregate();
22  }
23  $this->messageManager->addSuccess(__('You refreshed lifetime statistics.'));
24  } catch (\Magento\Framework\Exception\LocalizedException $e) {
25  $this->messageManager->addError($e->getMessage());
26  } catch (\Exception $e) {
27  $this->messageManager->addError(__('We can\'t refresh lifetime statistics.'));
28  $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
29  }
30 
31  if ($this->_getSession()->isFirstPageAfterLogin()) {
32  $this->_redirect('adminhtml/*');
33  } else {
34  $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl('*/*'));
35  }
36  }
37 }
__()
Definition: __.php:13