X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/1aa4d0dc59fb118c6cf28fd71af366c1882da74b..refs/pull/2023/head:/app/Console/Commands/DeleteUsers.php diff --git a/app/Console/Commands/DeleteUsers.php b/app/Console/Commands/DeleteUsers.php index 8829d3992..c73c883de 100644 --- a/app/Console/Commands/DeleteUsers.php +++ b/app/Console/Commands/DeleteUsers.php @@ -2,11 +2,12 @@ namespace BookStack\Console\Commands; -use BookStack\User; -use BookStack\Repos\UserRepo; +use BookStack\Auth\User; +use BookStack\Auth\UserRepo; use Illuminate\Console\Command; -class DeleteUsers extends Command{ +class DeleteUsers extends Command +{ /** * The name and signature of the console command. @@ -24,7 +25,7 @@ class DeleteUsers extends Command{ * * @var string */ - protected $description = 'Delete users that are not "admin" or system users.'; + protected $description = 'Delete users that are not "admin" or system users'; public function __construct(User $user, UserRepo $userRepo) { @@ -37,14 +38,11 @@ class DeleteUsers extends Command{ { $confirm = $this->ask('This will delete all users from the system that are not "admin" or system users. Are you sure you want to continue? (Type "yes" to continue)'); $numDeleted = 0; - if (strtolower(trim($confirm)) === 'yes') - { + if (strtolower(trim($confirm)) === 'yes') { $totalUsers = $this->user->count(); $users = $this->user->where('system_name', '=', null)->with('roles')->get(); - foreach ($users as $user) - { - if ($user->hasSystemRole('admin')) - { + foreach ($users as $user) { + if ($user->hasSystemRole('admin')) { // don't delete users with "admin" role continue; } @@ -52,11 +50,8 @@ class DeleteUsers extends Command{ ++$numDeleted; } $this->info("Deleted $numDeleted of $totalUsers total users."); - } - else - { + } else { $this->info('Exiting...'); } } - }