Skip to content

Instantly share code, notes, and snippets.

@zofe
Forked from tacone/index.php
Created October 19, 2016 14:22
Show Gist options
  • Save zofe/6f87a530ffdf764f73e057efb0d6b667 to your computer and use it in GitHub Desktop.
Save zofe/6f87a530ffdf764f73e057efb0d6b667 to your computer and use it in GitHub Desktop.
<?php
/*
|--------------------------------------------------------------------------
| Check for maintenance
|--------------------------------------------------------------------------
|
| Se l'applicazione è standby proviamo ad aspettare che torni su. In questo
| modo l'utente non riceve messaggi di errore durante il deploy, non perde
| i dati inviati nel form, etc.
*/
$max = 120;
$seconds = 1;
$n = 1;
set_time_limit( (int)ini_get('max_execution_time') + ($seconds * $max));
while(file_exists(__DIR__.'/../storage/framework/down') && $n <= $max ) {
sleep($seconds);
$n++;
clearstatcache(true);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment