Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php
2
 
3
namespace Illuminate\Foundation\Console;
4
 
5
use Exception;
6
use Illuminate\Console\Command;
7
use Illuminate\Foundation\Events\MaintenanceModeDisabled;
8
use Symfony\Component\Console\Attribute\AsCommand;
9
 
10
#[AsCommand(name: 'up')]
11
class UpCommand extends Command
12
{
13
    /**
14
     * The console command name.
15
     *
16
     * @var string
17
     */
18
    protected $name = 'up';
19
 
20
    /**
21
     * The name of the console command.
22
     *
23
     * This name is used to identify the command during lazy loading.
24
     *
25
     * @var string|null
26
     *
27
     * @deprecated
28
     */
29
    protected static $defaultName = 'up';
30
 
31
    /**
32
     * The console command description.
33
     *
34
     * @var string
35
     */
36
    protected $description = 'Bring the application out of maintenance mode';
37
 
38
    /**
39
     * Execute the console command.
40
     *
41
     * @return int
42
     */
43
    public function handle()
44
    {
45
        try {
46
            if (! $this->laravel->maintenanceMode()->active()) {
47
                $this->components->info('Application is already up.');
48
 
49
                return 0;
50
            }
51
 
52
            $this->laravel->maintenanceMode()->deactivate();
53
 
54
            if (is_file(storage_path('framework/maintenance.php'))) {
55
                unlink(storage_path('framework/maintenance.php'));
56
            }
57
 
58
            $this->laravel->get('events')->dispatch(new MaintenanceModeDisabled());
59
 
60
            $this->components->info('Application is now live.');
61
        } catch (Exception $e) {
62
            $this->components->error(sprintf(
63
                'Failed to disable maintenance mode: %s.',
64
                $e->getMessage(),
65
            ));
66
 
67
            return 1;
68
        }
69
 
70
        return 0;
71
    }
72
}