Skip to content

Instantly share code, notes, and snippets.

@rootindex
Last active January 11, 2016 09:27
Show Gist options
  • Save rootindex/f9352d6751174998397c to your computer and use it in GitHub Desktop.
Save rootindex/f9352d6751174998397c to your computer and use it in GitHub Desktop.
Magento2 Maintenance Mode
<?php
// 1) Enabled maintenance mode by creating file .maintenance.flag in the var folder
// 2) By pass maintenance mode by creating file .maintenance.ip in the var folder
// 3) IP addresses does not work for ranges only individual ip addresses
if (!preg_match('/^[^\s,]+(,[^\s,]+)*$/', $addresses)) {
throw new \InvalidArgumentException("One or more IP-addresses is expected (comma-separated)\n");
}
// 4) Comma seperate ip addresses without any spaces
// ?) Creating a folder called .maintenance.flag will also trigger maintenance mode
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment