diff --git a/src/app/Console/Commands/DomainStatus.php b/src/app/Console/Development/DomainStatus.php similarity index 98% rename from src/app/Console/Commands/DomainStatus.php rename to src/app/Console/Development/DomainStatus.php index 71938af0..8eb5e3d4 100644 --- a/src/app/Console/Commands/DomainStatus.php +++ b/src/app/Console/Development/DomainStatus.php @@ -1,86 +1,86 @@ argument('domain'))->firstOrFail(); $this->info("Found domain: {$domain->id}"); $statuses = [ 'active' => Domain::STATUS_ACTIVE, 'suspended' => Domain::STATUS_SUSPENDED, 'deleted' => Domain::STATUS_DELETED, 'ldapReady' => Domain::STATUS_LDAP_READY, 'verified' => Domain::STATUS_VERIFIED, 'confirmed' => Domain::STATUS_CONFIRMED, ]; // I'd prefer "-state" and "+state" syntax, but it's not possible if ($update = $this->option('del')) { $delete = true; } elseif ($update = $this->option('add')) { $delete = false; } if (!empty($update)) { $map = \array_change_key_case($statuses); $update = \strtolower($update); if (isset($map[$update])) { if ($delete && $domain->status & $map[$update]) { $domain->status ^= $map[$update]; $domain->save(); } elseif (!$delete && !($domain->status & $map[$update])) { $domain->status |= $map[$update]; $domain->save(); } } } $domain_state = []; foreach (\array_keys($statuses) as $state) { $func = 'is' . \ucfirst($state); if ($domain->$func()) { $domain_state[] = $state; } } $this->info("Status: " . \implode(',', $domain_state)); } } diff --git a/src/app/Console/Commands/UserStatus.php b/src/app/Console/Development/UserStatus.php similarity index 98% rename from src/app/Console/Commands/UserStatus.php rename to src/app/Console/Development/UserStatus.php index 79c90102..18e81145 100644 --- a/src/app/Console/Commands/UserStatus.php +++ b/src/app/Console/Development/UserStatus.php @@ -1,85 +1,85 @@ argument('userid'))->firstOrFail(); $this->info("Found user: {$user->id}"); $statuses = [ 'active' => User::STATUS_ACTIVE, 'suspended' => User::STATUS_SUSPENDED, 'deleted' => User::STATUS_DELETED, 'ldapReady' => User::STATUS_LDAP_READY, 'imapReady' => User::STATUS_IMAP_READY, ]; // I'd prefer "-state" and "+state" syntax, but it's not possible if ($update = $this->option('del')) { $delete = true; } elseif ($update = $this->option('add')) { $delete = false; } if (!empty($update)) { $map = \array_change_key_case($statuses); $update = \strtolower($update); if (isset($map[$update])) { if ($delete && $user->status & $map[$update]) { $user->status ^= $map[$update]; $user->save(); } elseif (!$delete && !($user->status & $map[$update])) { $user->status |= $map[$update]; $user->save(); } } } $user_state = []; foreach (\array_keys($statuses) as $state) { $func = 'is' . \ucfirst($state); if ($user->$func()) { $user_state[] = $state; } } $this->info("Status: " . \implode(',', $user_state)); } } diff --git a/src/app/Console/Kernel.php b/src/app/Console/Kernel.php index a55aa89c..e9123e07 100644 --- a/src/app/Console/Kernel.php +++ b/src/app/Console/Kernel.php @@ -1,43 +1,47 @@ command('inspire') // ->hourly(); } /** * Register the commands for the application. * * @return void */ protected function commands() { $this->load(__DIR__ . '/Commands'); + if (\app('env') != 'production') { + $this->load(__DIR__ . '/Development'); + } + include base_path('routes/console.php'); } } diff --git a/src/app/Http/Middleware/RequestLogger.php b/src/app/Http/Middleware/RequestLogger.php index aa3e9ccd..a5a90c0c 100644 --- a/src/app/Http/Middleware/RequestLogger.php +++ b/src/app/Http/Middleware/RequestLogger.php @@ -1,25 +1,25 @@ fullUrl(); $method = $request->getMethod(); \Log::debug("C: $method $url -> " . var_export($request->bearerToken(), true)); // On error response this is so noisy that makes the log unusable // \Log::debug("S: " . var_export($response->getContent(), true)); } } }