Created
November 17, 2015 09:35
-
-
Save andevsoftware/e6faee5642d481f2b146 to your computer and use it in GitHub Desktop.
PHP - Disable/enable maintenance file
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
<?php | |
try { | |
$filename = 'maintenance.enable'; | |
if (file_exists($filename)) { | |
unlink($filename); | |
echo "Application is now public"; | |
} else { | |
file_put_contents($filename, ''); | |
echo "Application is now hidden"; | |
} | |
} catch(\Exception $e) { | |
echo "Oops. Something went wrong here."; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment