Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Commands/Status/Health.php
Show All 16 Lines | |||||
class Health extends Command | class Health extends Command | ||||
{ | { | ||||
/** | /** | ||||
* The name and signature of the console command. | * The name and signature of the console command. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $signature = 'status:health'; | protected $signature = 'status:health {--check=*: Valid checks are DB, Redis, IMAP, LDAP, Roundcube, Meet, DAV, Mollie, OpenExchangeRates}'; | ||||
Lint: Generic.Files.LineLength.TooLong: Line exceeds 120 characters; contains 144 characters | |||||
/** | /** | ||||
* The console command description. | * The console command description. | ||||
* | * | ||||
* @var string | * @var string | ||||
*/ | */ | ||||
protected $description = 'Check health of backends'; | protected $description = 'Check health of backends'; | ||||
▲ Show 20 Lines • Show All 131 Lines • ▼ Show 20 Lines | class Health extends Command | ||||
/** | /** | ||||
* Execute the console command. | * Execute the console command. | ||||
* | * | ||||
* @return mixed | * @return mixed | ||||
*/ | */ | ||||
public function handle() | public function handle() | ||||
{ | { | ||||
$result = 0; | $result = 0; | ||||
$steps = $this->option('check'); | |||||
if (empty($steps)) { | |||||
$steps = [ | $steps = [ | ||||
'DB', 'Redis', 'IMAP', 'Roundcube', 'Meet', 'DAV', 'Mollie', 'OpenExchangeRates', | 'DB', 'Redis', 'IMAP', 'Roundcube', 'Meet', 'DAV', 'Mollie', 'OpenExchangeRates', | ||||
]; | ]; | ||||
if (\config('app.with_ldap')) { | if (\config('app.with_ldap')) { | ||||
array_unshift($steps, 'LDAP'); | array_unshift($steps, 'LDAP'); | ||||
} | } | ||||
} | |||||
foreach ($steps as $step) { | foreach ($steps as $step) { | ||||
$func = "check{$step}"; | $func = "check{$step}"; | ||||
$this->line("Checking {$step}..."); | $this->line("Checking {$step}..."); | ||||
if ($this->{$func}()) { | if ($this->{$func}()) { | ||||
$this->info("OK"); | $this->info("OK"); | ||||
Show All 9 Lines |
Line exceeds 120 characters; contains 144 characters