27 private $_filePath =
'app/etc/config.php';
34 private $_verificationTimeOut = 2;
64 \
Magento\Backend\
App\ConfigInterface $backendConfig,
66 \
Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory
69 $this->_backendConfig = $backendConfig;
71 $this->_curlFactory = $curlFactory;
79 private function _canShowNotification()
81 if ($this->_cache->load(self::VERIFICATION_RESULT_CACHE_KEY)) {
85 if ($this->_isFileAccessible()) {
89 $adminSessionLifetime = (int)$this->_backendConfig->getValue(
'admin/security/session_lifetime');
90 $this->_cache->save(
true, self::VERIFICATION_RESULT_CACHE_KEY, [], $adminSessionLifetime);
99 private function _isFileAccessible()
101 $unsecureBaseURL = $this->_config->getValue(Store::XML_PATH_UNSECURE_BASE_URL,
'default');
104 $http = $this->_curlFactory->create();
105 $http->setConfig([
'timeout' => $this->_verificationTimeOut]);
107 $responseBody = $http->read();
111 return $responseCode == 200;
131 return $this->_canShowNotification();
142 'Your web server is set up incorrectly and allows unauthorized access to sensitive files. ' 143 .
'Please contact your hosting provider.' 154 return \Magento\Framework\Notification\MessageInterface::SEVERITY_CRITICAL;
__construct(\Magento\Framework\App\CacheInterface $cache, \Magento\Backend\App\ConfigInterface $backendConfig, \Magento\Framework\App\Config\ScopeConfigInterface $config, \Magento\Framework\HTTP\Adapter\CurlFactory $curlFactory)
const VERIFICATION_RESULT_CACHE_KEY
static extractCode($response_str)