26 $currentDate = $this->_objectManager->get(
27 \
Magento\Framework\Stdlib\DateTime\TimezoneInterface::class
29 $date = $currentDate->modify(
'-25 hours');
30 foreach ($collectionsNames as $collectionName) {
31 $this->_objectManager->create($collectionName)->aggregate($date);
33 $this->messageManager->addSuccess(
__(
'Recent statistics have been updated.'));
34 }
catch (\
Magento\Framework\Exception\LocalizedException $e) {
35 $this->messageManager->addError($e->getMessage());
36 }
catch (\Exception $e) {
37 $this->messageManager->addError(
__(
'We can\'t refresh recent statistics.'));
38 $this->_objectManager->get(\Psr\Log\LoggerInterface::class)->critical($e);
41 if ($this->
_getSession()->isFirstPageAfterLogin()) {
_redirect($path, $arguments=[])