Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 11 additions & 5 deletions src/Illuminate/Foundation/Console/DownCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Foundation\Console;

use Exception;
use Illuminate\Console\Command;
use Illuminate\Support\InteractsWithTime;

Expand Down Expand Up @@ -32,12 +33,17 @@ class DownCommand extends Command
*/
public function handle()
{
file_put_contents(
storage_path('framework/down'),
json_encode($this->getDownFilePayload(), JSON_PRETTY_PRINT)
);
try {
file_put_contents(storage_path('framework/down'),
json_encode($this->getDownFilePayload(),
JSON_PRETTY_PRINT));
$this->comment('Application is now in maintenance mode.');
} catch (Exception $e) {
$this->error('Application is failed to enter maintenance mode.');
$this->error($e->getMessage());

$this->comment('Application is now in maintenance mode.');
return false;
}
}

/**
Expand Down
16 changes: 14 additions & 2 deletions src/Illuminate/Foundation/Console/UpCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Illuminate\Foundation\Console;

use Exception;
use Illuminate\Console\Command;

class UpCommand extends Command
Expand All @@ -27,8 +28,19 @@ class UpCommand extends Command
*/
public function handle()
{
@unlink(storage_path('framework/down'));
try {
if (! file_exists(storage_path('framework/down'))) {
$this->comment('Application is already up.');

$this->info('Application is now live.');
return true;
}
unlink(storage_path('framework/down'));
$this->info('Application is now live.');
} catch (Exception $e) {
$this->error('Application is failed to up.');
$this->error($e->getMessage());

return false;
}
}
}