File tree Expand file tree Collapse file tree 2 files changed +26
-2
lines changed
lib/internal/Magento/Framework Expand file tree Collapse file tree 2 files changed +26
-2
lines changed Original file line number Diff line number Diff line change 7
7
8
8
use Magento \Framework \App \Filesystem \DirectoryList ;
9
9
use Magento \Framework \Filesystem ;
10
- use Symfony \ Component \ HttpFoundation \ IpUtils ;
10
+ use Magento \ Framework \ HTTP \ IpChecker ;
11
11
12
12
/**
13
13
* Application Maintenance Mode
@@ -62,7 +62,7 @@ public function isOn($remoteAddr = '')
62
62
if (!$ this ->flagDir ->isExist (self ::FLAG_FILENAME )) {
63
63
return false ;
64
64
}
65
- return !IpUtils:: checkIp ($ remoteAddr , $ this ->getAddressInfo ());
65
+ return !IpChecker:: isInRange ($ remoteAddr , $ this ->getAddressInfo ());
66
66
}
67
67
68
68
/**
Original file line number Diff line number Diff line change
1
+ <?php
2
+ /**
3
+ * Copyright © Magento, Inc. All rights reserved.
4
+ * See COPYING.txt for license details.
5
+ */
6
+ namespace Magento \Framework \HTTP ;
7
+
8
+ use Symfony \Component \HttpFoundation \IpUtils ;
9
+
10
+ class IpChecker
11
+ {
12
+ /**
13
+ * Checks if an IPv4 or IPv6 address is contained in the list of given IPs or subnets.
14
+ *
15
+ * @param string $requestIp IP to check
16
+ * @param string|array $ips List of IPs or subnets (can be a string if only a single one)
17
+ *
18
+ * @return bool Whether the IP is contained in the list of given IPs or subnets
19
+ */
20
+ public static function isInRange ($ requestIp , $ ips )
21
+ {
22
+ return IpUtils::checkIp ($ requestIp , $ ips );
23
+ }
24
+ }
You can’t perform that action at this time.
0 commit comments