Created
December 7, 2016 19:25
-
-
Save molotovbliss/16a36c803f3f01cf22359d0d58b80c44 to your computer and use it in GitHub Desktop.
Maintenance flag bypass via IP whitelist file var/maintenance-whitelist.txt for Magento v1.x
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (file_exists($maintenanceFile)) { | |
$whitelistIps = []; | |
if (file_exists('var/maintenance-whitelist.txt')) { | |
$whitelistIps = explode("\n", trim(file_get_contents('var/maintenance-whitelist.txt'))); | |
$whitelistIps = array_map(function($value) { | |
return preg_replace('%^\s*([0-9\.]+).*$%', '$1', $value); | |
}, $whitelistIps); | |
} | |
if (!in_array($_SERVER['REMOTE_ADDR'], $whitelistIps)) { | |
include_once dirname(__FILE__) . '/errors/503.php'; | |
exit; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment