Changeset View
Changeset View
Standalone View
Standalone View
src/app/Console/Development/UserStatus.php
Show First 20 Lines • Show All 45 Lines • ▼ Show 20 Lines | public function handle() | ||||
'active' => User::STATUS_ACTIVE, | 'active' => User::STATUS_ACTIVE, | ||||
'suspended' => User::STATUS_SUSPENDED, | 'suspended' => User::STATUS_SUSPENDED, | ||||
'deleted' => User::STATUS_DELETED, | 'deleted' => User::STATUS_DELETED, | ||||
'ldapReady' => User::STATUS_LDAP_READY, | 'ldapReady' => User::STATUS_LDAP_READY, | ||||
'imapReady' => User::STATUS_IMAP_READY, | 'imapReady' => User::STATUS_IMAP_READY, | ||||
]; | ]; | ||||
// I'd prefer "-state" and "+state" syntax, but it's not possible | // I'd prefer "-state" and "+state" syntax, but it's not possible | ||||
$delete = false; | |||||
if ($update = $this->option('del')) { | if ($update = $this->option('del')) { | ||||
$delete = true; | $delete = true; | ||||
} elseif ($update = $this->option('add')) { | } elseif ($update = $this->option('add')) { | ||||
$delete = false; | // do nothing | ||||
} | } | ||||
if (!empty($update)) { | if (!empty($update)) { | ||||
$map = \array_change_key_case($statuses); | $map = \array_change_key_case($statuses); | ||||
$update = \strtolower($update); | $update = \strtolower($update); | ||||
if (isset($map[$update])) { | if (isset($map[$update])) { | ||||
if ($delete && $user->status & $map[$update]) { | if ($delete && $user->status & $map[$update]) { | ||||
Show All 20 Lines |