Skip to content

Instantly share code, notes, and snippets.

@andevsoftware
Created November 17, 2015 09:35
Show Gist options
  • Save andevsoftware/e6faee5642d481f2b146 to your computer and use it in GitHub Desktop.
Save andevsoftware/e6faee5642d481f2b146 to your computer and use it in GitHub Desktop.
PHP - Disable/enable maintenance file
<?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