-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathCheckUserEmailExist.php
More file actions
40 lines (29 loc) · 1.08 KB
/
CheckUserEmailExist.php
File metadata and controls
40 lines (29 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
<?php
namespace App\Console\Commands\User;
use App\Services\WikiUserEmailChecker;
use App\User;
use Illuminate\Console\Command;
class CheckUserEmailExist extends Command {
protected $signature = 'wbs-user:check-email {emails*}';
protected $description = 'Check if emails exist in apidb.users or any MediaWiki user table';
public function handle(WikiUserEmailChecker $emailChecker): int {
$emails = $this->argument('emails');
foreach ($emails as $email) {
$found = false;
if (User::whereEmail($email)->exists()) {
$this->line("FOUND: {$email} in apidb.users");
$found = true;
}
$mwResults = $emailChecker->findEmail($email);
foreach ($mwResults as $location) {
$this->line("FOUND: {$email} in {$location}");
$found = true;
}
if (!$found) {
$this->line("NOT FOUND: {$email}");
}
$this->line('-------------------------------------------------');
}
return 0;
}
}