8
8
namespace Magento \Backend \App \Area ;
9
9
10
10
use Magento \Backend \Setup \ConfigOptionsList ;
11
+ use Magento \Framework \App \Config \ScopeConfigInterface ;
11
12
use Magento \Framework \App \DeploymentConfig ;
13
+ use Magento \Store \Model \ScopeInterface ;
14
+ use Magento \Store \Model \Store ;
12
15
13
16
class FrontNameResolver implements \Magento \Framework \App \Area \FrontNameResolverInterface
14
17
{
@@ -38,24 +41,22 @@ class FrontNameResolver implements \Magento\Framework\App\Area\FrontNameResolver
38
41
*/
39
42
protected $ deploymentConfig ;
40
43
41
- /**
42
- * @var \Magento\Backend\Model\UrlInterface
43
- */
44
- protected $ backendUrl ;
44
+ /** @var ScopeConfigInterface */
45
+ private $ configInterface ;
45
46
46
47
/**
47
48
* @param \Magento\Backend\App\Config $config
48
49
* @param DeploymentConfig $deploymentConfig
49
- * @param \Magento\Backend\Model\UrlInterface $backendUrl
50
+ * @param ScopeConfigInterface $configInterface
50
51
*/
51
52
public function __construct (
52
53
\Magento \Backend \App \Config $ config ,
53
54
DeploymentConfig $ deploymentConfig ,
54
- \ Magento \ Backend \ Model \ UrlInterface $ backendUrl
55
+ ScopeConfigInterface $ configInterface
55
56
) {
56
57
$ this ->config = $ config ;
57
58
$ this ->defaultFrontName = $ deploymentConfig ->get (ConfigOptionsList::CONFIG_PATH_BACKEND_FRONTNAME );
58
- $ this ->backendUrl = $ backendUrl ;
59
+ $ this ->configInterface = $ configInterface ;
59
60
}
60
61
61
62
/**
@@ -82,7 +83,8 @@ public function getFrontName($checkHost = false)
82
83
*/
83
84
public function isHostBackend ()
84
85
{
85
- $ backendHost = parse_url (trim ($ this ->backendUrl ->getBaseUrl ()), PHP_URL_HOST );
86
+ $ backendUrl = $ this ->configInterface ->getValue (Store::XML_PATH_UNSECURE_BASE_URL , ScopeInterface::SCOPE_STORE );
87
+ $ backendHost = parse_url (trim ($ backendUrl ), PHP_URL_HOST );
86
88
$ host = isset ($ _SERVER ['HTTP_HOST ' ]) ? $ _SERVER ['HTTP_HOST ' ] : '' ;
87
89
return (strcasecmp ($ backendHost , $ host ) === 0 );
88
90
}
0 commit comments