![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/cartforge.co/app/code/Xtento/StockImport/Controller/Adminhtml/ |
<?php /** * Product: Xtento_StockImport * ID: u66QkJ5rBwmimhUzUElhIKqqWRvsbhC3WLqSMk5AjmQ= * Last Modified: 2019-02-05T17:10:52+00:00 * File: app/code/Xtento/StockImport/Controller/Adminhtml/Action.php * Copyright: Copyright (c) XTENTO GmbH & Co. KG <[email protected]> / All rights reserved. */ namespace Xtento\StockImport\Controller\Adminhtml; abstract class Action extends \Magento\Backend\App\Action { /** * @var \Xtento\StockImport\Helper\Module */ protected $moduleHelper; /** * @var \Xtento\XtCore\Helper\Cron */ protected $cronHelper; /** * @var \Magento\Framework\App\Config\ScopeConfigInterface */ protected $scopeConfig; /** * @var \Xtento\StockImport\Model\ResourceModel\Profile\CollectionFactory */ protected $profileCollectionFactory; /** * Action constructor. * * @param \Magento\Backend\App\Action\Context $context * @param \Xtento\StockImport\Helper\Module $moduleHelper * @param \Xtento\XtCore\Helper\Cron $cronHelper * @param \Xtento\StockImport\Model\ResourceModel\Profile\CollectionFactory $profileCollectionFactory * @param \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig */ public function __construct( \Magento\Backend\App\Action\Context $context, \Xtento\StockImport\Helper\Module $moduleHelper, \Xtento\XtCore\Helper\Cron $cronHelper, \Xtento\StockImport\Model\ResourceModel\Profile\CollectionFactory $profileCollectionFactory, \Magento\Framework\App\Config\ScopeConfigInterface $scopeConfig ) { parent::__construct($context); $this->moduleHelper = $moduleHelper; $this->cronHelper = $cronHelper; $this->profileCollectionFactory = $profileCollectionFactory; $this->scopeConfig = $scopeConfig; } protected function healthCheck() { // Has the module been installed properly? if (!$this->moduleHelper->isModuleProperlyInstalled()) { if ($this->getRequest()->getActionName() !== 'installation') { return '*/index/installation'; } else { return true; } } else { if ($this->getRequest()->getActionName() == 'installation') { return '*/profile/index'; } } // Check module status if (!$this->moduleHelper->confirmEnabled(true) || !$this->moduleHelper->isModuleEnabled()) { if ($this->getRequest()->getActionName() !== 'disabled') { return '*/index/disabled'; } } else { if ($this->getRequest()->getActionName() == 'disabled') { return '*/profile/index'; } } if ($this->getRequest()->getActionName() !== 'redirect') { // Check if this module was made for the edition (CE/PE/EE) it's being run in if ($this->moduleHelper->isWrongEdition()) { $this->addError( __( 'Attention: The installed extension version is not compatible with the Enterprise Edition of Magento. The compatibility of the currently installed extension version has only been confirmed with the Community Edition of Magento. Please go to <a href="https://www.xtento.com" target="_blank">www.xtento.com</a> to purchase or download the Enterprise Edition of this extension in our store if you\'ve already purchased it.' ) ); } // Check cronjob status if (!$this->scopeConfig->isSetFlag('stockimport/general/disable_cron_warning')) { $profileCollection = $this->profileCollectionFactory->create(); $profileCollection->addFieldToFilter('enabled', 1); // Profile enabled $profileCollection->addFieldToFilter('cronjob_enabled', 1); // Cronjob enabled if ($profileCollection->getSize() > 0) { if (!$this->cronHelper->isCronRunning()) { if ((time() - $this->cronHelper->getInstallationDate()) > (60 * 30)) { // Module was not installed within the last 30 minutes if ($this->cronHelper->getLastCronExecution() == '') { $this->addWarning( __( 'Cronjob status: Cron doesn\'t seem to be set up at all. Cron did not execute within the last 15 minutes. Please make sure to set up the cronjob as explained <a href="http://support.xtento.com/wiki/Setting_up_the_Magento_cronjob_(Magento_2)" target="_blank">here</a> and check the cron status 15 minutes after setting up the cronjob properly again.' ) ); } else { $this->addWarning( __( 'Cronjob status: Cron doesn\'t seem to be set up properly. Cron did not execute within the last 15 minutes. Please make sure to set up the cronjob as explained <a href="http://support.xtento.com/wiki/Setting_up_the_Magento_cronjob_(Magento_2)" target="_blank">here</a> and check the cron status 15 minutes after setting up the cronjob properly again.' ) ); } } // Cron status wasn't checked yet. Please check back in 30 minutes. } } } } return true; } protected function addWarning($messageText) { return $this->addMsg('warning', $messageText); } protected function addError($messageText) { return $this->addMsg('error', $messageText); } protected function addMsg($type, $messageText) { $messages = $this->messageManager->getMessages(); foreach ($messages->getItems() as $message) { if ($message->getText() == $messageText) { return false; } } return ($type === 'error') ? $this->messageManager->addComplexErrorMessage( 'backendHtmlMessage', [ 'html' => (string)$messageText ] ) : $this->messageManager->addComplexWarningMessage( 'backendHtmlMessage', [ 'html' => (string)$messageText ] ); } }