Added some debugging

Signed-off-by: snipe <snipe@snipe.net>
This commit is contained in:
snipe 2022-05-18 03:31:00 -07:00
parent e2fd5199c3
commit 004d567253

View file

@ -41,11 +41,16 @@ class MergeUsersByUsername extends Command
{
// Get the list of users who have an email address as their username
$users = User::where('username', 'LIKE', '%@%')->whereNull('deleted_at')->get();
$this->info($users->count().' total non-deleted users whose usernames contain a @ symbol.');
foreach ($users as $user) {
$parts = explode('@', $user->username);
$bad_users = User::where('username', '=', $parts[0])->whereNull('deleted_at')->with('assets', 'manager', 'userlog', 'licenses', 'consumables', 'accessories', 'managedLocations')->get();
$this->info($bad_users->count().' total non-deleted users whose usernames DO NOT contain a @ symbol.');
foreach ($bad_users as $bad_user) {
$this->info($bad_user->username.' ('.$bad_user->id.') will be merged into '.$user->username.' ('.$user->id.') ');